Line REST API documentation

Warning

This is alpha-development version of API and may be the subject to change.

Authentication

For now all API calls are authenticated with HTTP Basic Authentication (username being user email), or using existing session cookie (for GET verb endpoints only).

When 2-factor authentication is enabled for calling account otp query field is required for some calls.

Resources

Note

All currency values are represented as integers in lowest denomination (1 satoshi for Bitcoin)

Note

All interest values are represented as 5-digit precision decimals in strings.

Friends

GET /api/v1/friends/

Friends and their data list

Response JSON Array of Objects:
 
  • id (integer) – user ID
  • name (string) – user display name
  • investment (object) – investment information
  • investment.available (integer) – all available loan
  • investment.used (integer) – current used amount
  • investment.limit (integer) – limit set by user
  • investment.interest (string) – interest rate
  • loan (object) – loan information (same as investment)
Status Codes:
PUT /api/v1/friends/(int: friend_id)/

Updates investment values or adds new friend

Query Parameters:
 
  • limit – investment limit
  • interest – interest rate
  • otp – one-time password (when enabled)
Status Codes:
DELETE /api/v1/friends/(int: friend_id)/

Removes selected friend

Status Codes:
GET /api/v1/friends/(int: friend_id)/

Information about specified friend

Response JSON Object:
 
  • id (integer) – user ID
  • name (string) – user display name
  • investment (object) – investment information (look above)
  • loan (object) – loan information (look above)
Status Codes:

Example request:

GET /api/v1/friends/ HTTP/1.1
Accept: application/json, text/javascript
Authorization: Basic dXNlcjp0ZXN0
Host: getline.in

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

[
    {
        "id": 3,
        "investment": {
            "available": 4962777,
            "limit": 5000000,
            "used": 4962777
        },
        "loan": {
            "limit": 0,
            "used": 0
        },
        "name": "John"
    },
    {
        "id": 1,
        "investment": { "[ ... ]" },
        "loan": { "[ ... ]" },
        "name": "Mike"
    }
]

Wallet

GET /api/v1/wallet/

Information about current user wallet

Response JSON Object:
 
  • balance (integer) – user wallet balance
  • address (string) – Bitcoin input address
  • last_transactions (array) – last 10 transactions
GET /api/v1/wallet/transactions/

User transactions list

Response JSON Array of Objects:
 
  • id (integer) – unique transaction ID
  • type (string) – transaction type
  • amount (integer) – transaction amount
  • date (datetime) – transaction date

Example client

httpie can be used to test the API:

$ http PUT https://username:password@getline.in/api/v1/friends/3/ limit=1000 interest=0.001

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 38
Content-Type: application/json
Date: Fri, 06 Jan 2017 10:55:16 GMT

{
    "message": "Success",
    "status": 200
}