Luno API (1.0.0)

Download OpenAPI specification:Download

The Luno API gives you the ability to:

  • Access current and historic Bitcoin and Ethereum market data
  • Submit trade orders and view order status
  • Buy and sell Bitcoin and Ethereum
  • Send and receive Bitcoin and Ethereum
  • Generate Bitcoin and Ethereum wallet addresses

The Luno API makes Bitcoin and Ethereum available to anyone.

security

Make sure to always use HTTPS when calling the API. Non-TLS HTTP requests cause error 403 to be returned. Using non-TLS requests can leak your authentication credentials.

Make sure that your client validates the server's SSL certificate. Many libraries (e.g. urllib2 in Python2) don't validate server certificates by default. Failing to verify the server certificate makes your application vulnerable to man-in-the-middle attack.

conventions

Timestamps are always represented as an integer number of milliseconds since the UTC Epoch (a Unix timestamp).

Prices and volumes are always represented as a decimal strings e.g. "123.3432". We use strings instead of floats to preserve the precision.

Parameters for POST calls are sent as URL-encoded forms (application/x-www-form-urlencoded).

rate limiting

Calls to the Market Data APIs are rate limited to 1 call per second per IP address. All other API calls are rate limited to 1 call per second per customer. API call rate limits allow bursts of up to five consecutive calls. Exceeding the limit causes HTTP error code 429 to be returned.

libraries

The Go library is the recommended way to access the API.

The following libraries were implemented by third parties or are no longer under active development and are listed here for convenience. No support for them is provided by Luno and they may be out of date. A thorough review of the code is recommended before including them in any project.

market

Market data API calls can be accessed by anyone without authentication. The data returned may be cached for up to 1 second. The Streaming API can be used if lower latency market data is needed.

Get the full order book

Returns a list of all bids and asks in the order book. Ask orders are sorted by price ascending. Bid orders are sorted by price descending. Multiple orders at the same price are not aggregated.

Warning: This may return a large amount of data. Generally you should rather use GetOrderBook or the Streaming API.

query Parameters
pair
required
string <pair>
Example: pair=XBTZAR

Currency pair

Responses

200

OK

get /api/1/orderbook
https://api.mybitx.com/api/1/orderbook

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "asks":
    [
    ],
  • "bids":
    [
    ],
  • "timestamp": 0
}

Get order book

Returns a list of the top 100 bids and asks in the order book. Ask orders are sorted by price ascending. Bid orders are sorted by price descending. Orders of the same price are aggregated.

query Parameters
pair
required
string <pair>
Example: pair=XBTZAR

Currency pair

Responses

200

OK

get /api/1/orderbook_top
https://api.mybitx.com/api/1/orderbook_top

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "asks":
    [
    ],
  • "bids":
    [
    ],
  • "timestamp": 0
}

Get ticker

Returns the latest ticker indicators.

query Parameters
pair
required
string <pair>
Example: pair=XBTZAR

Currency pair

Responses

200

OK

get /api/1/ticker
https://api.mybitx.com/api/1/ticker

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "ask": "string",
  • "bid": "string",
  • "last_trade": "string",
  • "pair": "string",
  • "rolling_24_hour_volume": "string",
  • "status": "ACTIVE",
  • "timestamp": "string"
}

List tickers

Returns the latest ticker indicators from all active Luno exchanges.

Responses

200

OK

get /api/1/tickers
https://api.mybitx.com/api/1/tickers

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "tickers":
    [
    ]
}

List trades

Returns a list of the most recent trades. At most 100 results are returned per call.

query Parameters
pair
required
string <pair>
Example: pair=XBTZAR

Currency pair

since
string <timestamp>
Example: since=1520438111000

Fetch trades executed after this time, specified as a Unix timestamp in milliseconds.

Responses

200

OK

get /api/1/trades
https://api.mybitx.com/api/1/trades

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "trades":
    [
    ]
}

authentication

Some API calls require your application to authenticate itself. This is done using an API key associated with your account. You can create an API key by visiting the API Keys section on the settings page.

An API key consists of an id and a secret. For example, cnz2yjswbv3jd (key id) and 0hydMZDb9HRR3Qq-iqALwZtXLkbLR4fWxtDZvkB9h4I (key secret).

API requests are authenticated using HTTP basic authentication with the key id as the username and the key secret as the password. A missing, incorrect or revoked key causes error 401 to be returned.

Each API key is granted a set of permissions when it is created. The key can only be used to call the permitted API functions.

Permissions

Here is a list of the possible permissions:

  • Perm_R_Balance = 1 (View balance)
  • Perm_R_Transactions = 2 (View transactions)
  • Perm_W_Send = 4 (Send to any address)
  • Perm_R_Addresses = 8 (View addresses)
  • Perm_W_Addresses = 16 (Create addresses)
  • Perm_R_Orders = 32 (View orders)
  • Perm_W_Orders = 64 (Create orders)
  • Perm_R_Withdrawals = 128 (View withdrawals)
  • Perm_W_Withdrawals = 256 (Create withdrawals)
  • Perm_R_Merchant = 512 (View merchant invoices)
  • Perm_W_Merchant = 1024 (Create merchant invoices)
  • Perm_W_ClientDebit = 8192 (Debit accounts)
  • Perm_W_ClientCredit = 16384 (Credit accounts)
  • Perm_R_Beneficiaries = 32768 (View beneficiaries)
  • Perm_W_Beneficiaries = 65536 (Create and delete beneficiaries)

A set of permissions is represented as the bitwise OR of each permission in the set. For example the set of permissions required to view balances and orders is Perm_R_Balance | Perm_R_Orders = 33.

accounts

All transactions on the Luno platform operate on accounts. Each account is denominated in a single currency and contains an ordered list of entries that track its running balance.

Each account has a separate balance and available balance. The available balance may be lower than the balance if some funds have been reserved (e.g. for a open limit order). Account entries affect the balance and available balance independently.

Account entries are numbered sequentially. It is guaranteed that entries are never reordered or deleted. It is also guaranteed that the core attributes of the entry (the running balances and index) are never modified. Therefore, an account acts as an append-only log of transactions.

Create account

Create an additional account for the specified currency.

Permissions required: Perm_W_Addresses

query Parameters
currency
required
string
Example: currency=XBT

The currency code for the account you want to create

You must be verified to trade currency in order to be able to create an account. A user has a limit of 4 accounts per currency.

name
required
string
Example: name=Trading%20ACC

The label to use for this account

Responses

200

OK

post /api/1/accounts
https://api.mybitx.com/api/1/accounts

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "balance":
    {
    },
  • "capabilities":
    {
    },
  • "currency": "string",
  • "icon": "string",
  • "id": "string",
  • "is_default": true,
  • "name": "string",
  • "pending":
    [
    ],
  • "receive_addresses":
    [
    ],
  • "transactions":
    [
    ]
}

List pending transactions

Return a list of all pending transactions related to the account.

Unlike account entries, pending transactions are not numbered, and may be reordered, deleted or updated at any time.

Permissions required: Perm_R_Transactions

path Parameters
id
required
integer <int64>
Example: 12345

Account ID

Responses

200

OK

get /api/1/accounts/{id}/pending
https://api.mybitx.com/api/1/accounts/{id}/pending

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "balance":
    {
    },
  • "capabilities":
    {
    },
  • "currency": "string",
  • "icon": "string",
  • "id": "string",
  • "is_default": true,
  • "name": "string",
  • "pending":
    [
    ],
  • "receive_addresses":
    [
    ],
  • "transactions":
    [
    ]
}

List transactions

Return a list of transaction entries from an account.

Transaction entry rows are numbered sequentially starting from 1, where 1 is the oldest entry. The range of rows to return are specified with the min_row (inclusive) and max_row (exclusive) parameters. At most 1000 rows can be requested per call.

If min_row or max_row is non-positive, the range wraps around the most recent row. For example, to fetch the 100 most recent rows, use min_row=-100 and max_row=0.

Permissions required: Perm_R_Transactions

path Parameters
id
required
integer <int64>
Example: 12345

Account ID

query Parameters
min_row
required
integer <int64>
Example: min_row=1

Minimum of the row range to return (inclusive)

max_row
required
integer <int64>
Example: max_row=1000

Maximum of the row range to return (exclusive)

Responses

200

OK

get /api/1/accounts/{id}/transactions
https://api.mybitx.com/api/1/accounts/{id}/transactions

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "balance":
    {
    },
  • "capabilities":
    {
    },
  • "currency": "string",
  • "icon": "string",
  • "id": "string",
  • "is_default": true,
  • "name": "string",
  • "pending":
    [
    ],
  • "receive_addresses":
    [
    ],
  • "transactions":
    [
    ]
}

List balances

Return the list of all accounts and their respective balances.

Permissions required: Perm_R_Balance

query Parameters
assets
Array of strings
Example: assets=XBTZAR%2CETHXBT

Only return balances for wallets with these currencies (if not provided, all balances will be returned)

Responses

200

OK

get /api/1/balance
https://api.mybitx.com/api/1/balance

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "balance":
    [
    ]
}

orders

Trading on the market is done by submitting trade orders. After a new order has been created, it is submitted for processing by the order matching engine. The order then either matches against an existing order in the order book and is filled or it rests in the order book until it is stopped.

Click here to read more about how order matching works.

Get fee information

Returns your fees and 30 day trading volume (as of midnight) for a given pair.

Permissions required: Perm_R_Orders

query Parameters
pair
required
string <pair>
Example: pair=XBTZAR

Get fee information about this pair.

Responses

200

OK

get /api/1/fee_info
https://api.mybitx.com/api/1/fee_info

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "maker_fee": "string",
  • "taker_fee": "string",
  • "thirty_day_volume": "string"
}

List orders

Returns a list of the most recently placed orders. You can specify an optional state=PENDING parameter to restrict the results to only open orders. You can also specify the market by using the optional pair parameter. The list is truncated after 100 items.

Permissions required: Perm_R_Orders

query Parameters
state
string
Enum: "PENDING" "COMPLETE"
Example: state=PENDING

Filter to only orders of this state

pair
string <pair>
Example: pair=XBTZAR

Filter to only orders of this currency pair

created_before
integer <int64>
Example: created_before=1530865703508

Filter to orders created before this timestamp (Unix milliseconds)

limit
integer <int64>
Example: limit=100

Limit to this many orders

Responses

200

OK

get /api/1/listorders
https://api.mybitx.com/api/1/listorders

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "orders":
    [
    ]
}

List trades

Returns a list of your recent trades for a given pair, sorted by oldest first. If before is specified, then the trades are returned sorted by most-recent first.

type in the response indicates the type of order that you placed in order to participate in the trade. Possible types: BID, ASK.

If is_buy in the response is true, then the order which completed the trade (market taker) was a bid order.

Results of this query may lag behind the latest data.

Permissions required: Perm_R_Orders

query Parameters
pair
required
string <pair>
Example: pair=XBTZAR

Filter to trades of this currency pair.

since
string <timestamp>
Example: since=1470810728478

Filter to trades on or after this timestamp.

before
string <timestamp>
Example: before=1470810728478

Filter to trades before this timestamp.

after_seq
integer <int64>
Example: after_seq=10

Filter to trades from (including) this sequence number. Default behaviour is not to include this filter.

before_seq
integer <int64>
Example: before_seq=1

Filter to trades before (excluding) this sequence number. Default behaviour is not to include this filter.

sort_desc
boolean
Example: sort_desc=true

If set to true, sorts trades in descending order, otherwise ascending order will be assumed.

limit
integer <int64> [ 1 .. 100 ]
Example: limit=100

Limit to this number of trades (default 100).

Responses

200

OK

get /api/1/listtrades
https://api.mybitx.com/api/1/listtrades

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "trades":
    [