Luno API (1.0.0)

Download OpenAPI specification:Download

The Luno API provides developers with a wealth of financial information and trading capacity in the cryptocurrency market. Through this secure system, developers can work with the cryptocurrencies Bitcoin and Ethereum to perform tasks such as:

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

The Luno API brings the world of Bitcoin and Ethereum to everyone.

security

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.

Verify that your client validates the server's SSL certificate. Many libraries (e.g. urllib2 in Python2) do not 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". Strings are used rather than 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, with a burst of 5 calls. All other API calls are rate limited to 5 calls per second per customer, with a burst of 25 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 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.

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 a key id and a key 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

The following 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.

When API keys are created, users can select permission sets that automatically include various permissions for their key. These are listed below.

Permission Set Included Permissions
Read-only access View Balance
View transactions
Send to any address
View orders
View withdrawals
View Beneficiaries
Trading access View Balance
View transactions
Send to any address
View orders
View withdrawals
View Beneficiaries
Create Orders

currency

The following currencies are supported through the Luno market platform. For complete details, please see Fees & features:

  • XBT: Bitcoin
  • BCH: Bitcoin Cash
  • ETH: Ethereum
  • EUR: Euro
  • MYR: Malaysian Ringgit
  • NGN: Nigerian Naira
  • UGX: Ugandan Shilling
  • ZAR: South African Rand
  • ZMW: Zambian Kwacha

The following are examples of currency pairs that are supported through the Luno market platform. For complete details, please see Fees & Features:

  • XBTEUR
  • XBTZAR
  • XBTUGX
  • XBTZMW
  • ETHXBT
  • BCHXBT

The following methods are available for Funds Withdrawal based on the type of currency or currency pair being withdrawn.

Currency:

  • BTC: Bitcoin
  • BCH: Bitcoin Cash
  • ETH: Ethereum
  • BTC_LN: Lightning

Currency Pair:

  • ZAR_EFT: EFT
  • NAD_EFT: EFT
  • KES_EFT: EFT
  • KES_MPESA: M-Pesa
  • MYR_IBG: Interbank GIRO / IBFT
  • IDR_LLG: Bank transfer, Lalu Lintas Giro
  • NGN_EFT: Bank transfer
  • ZMW_EFT: Bank transfer
  • SGD_GIRO: GIRO / FAST
  • SGD_WIRE: International Wire
  • EUR_SEPA: SEPA transfer
  • UGX_EFT: Bank transfer

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 (see below) 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 that happened in the last 24h. 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":
    [
    ]
}

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 an 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

This request creates an Account for the specified currency. Please note that the balances for the Account will be displayed based on the asset value, which is the currency the Account is based on.

Permissions required: Perm_W_Addresses

query Parameters
currency
required
string
Example: currency=XBT

The currency code for the Account you want to create. Please see the Currency section for a detailed list of currencies supported by the Luno platform.

Users must be verified to trade currency in order to be able to create an Account. For more information on the verification process, please see How do I verify my identity?.

Users have 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
{
  • "currency": "string",
  • "id": "string",
  • "name": "string",
  • "pending":
    [
    ],
  • "transactions":
    [
    ]
}

List pending transactions

Return a list of all transactions that have not completed for the Account.

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
{
  • "currency": "string",
  • "id": "string",
  • "name": "string",
  • "pending":
    [
    ],
  • "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 - the unique identifier for the specific Account.

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
{
  • "currency": "string",
  • "id": "string",
  • "name": "string",
  • "pending":
    [
    ],
  • "transactions":
    [
    ]
}

List balances

The list of all Accounts and their respective balances for the requesting user.

Permissions required: Perm_R_Balance

query Parameters
assets
Array of strings
Example: assets=XBT%2CETH

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 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 the fees and 30 day trading volume (as of midnight) for a given currency pair. For complete details, please see Fees & Features.

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":
    [