Skip to content
martin-nginio edited this page Aug 17, 2019 · 15 revisions

Are there any restrictions on API calls?

Users can call any public or private APIs and below limits are enforced. For private APIs the limit is based on API key and for public APIs the limit is based on the IP address.

We may decide to change those limits or add new ones depending on usage patterns and traffic.

Default limit: 50 calls per 10 seconds

By default and if not specified, all APIs (public or private endpoints) are rate limited at 50 calls per 10 seconds.

Lower limit: 30 calls per 10 seconds

  • /order/create

Higher limits

The following APIs allow higher limit given the requirement of automated trading bots. They are rate limited at 100 calls per 10 seconds:

  • /market/{instrument}/{currency}/tick
  • /market/{instrument}/{currency}/orderbook
  • /market/{instrument}/{currency}/trades
  • /v2/market/{instrument}/{currency}/trades

In case if your application is calling above APIs with higher rate then you will receive the following error message:

Throttle limit exceeded.

If you have specific requirements please contact our support desk.

Why Do I Get a Cloudflare Message When Attempting To Access the API?

Make sure you have a valid user agent set in your code.

Why do some of my requests like order creation fail authentication while others do not?

All numbers, specifically for price and volume, must be converted to an integer for use in API requests. The conversion is 100000000, or 1E8. For strongly typed programming languages, use of integer variable types is strongly recommended, as decimals will not be accepted by the API.

Why are the numbers returned by the API so large?

The API does not use decimals, so the numbers returned are in the converted format mentioned in the question above.

Error handling

All API calls return the following 3 attributes as part of the response: success, errorCode, errorMessage

success is a boolean attribute and represents if the API call was successful or not. If it's true then errorCode and errorMessage will be null. When success is false then errorCode and errorMessage attributes should have values as per below:

List of error codes

errorCode is an integer number with the following values

  • 1: Authentication errors (see authentication for more detail)
  • 2: Authorization errors (your api key is does not have enough permission to access specific resource)
  • 3: Input validation errors (e.g. invalid amount or order type or currency input)
  • 4: Insufficient funds
  • 5: Internal server errors (error happed at BTC Markets' servers)
  • 6: Throttle error (see call limits for more detail)
  • 7: Resource not found

In above cases, the errorMessage attribute provides more information about the the underlying issue (e.g. in case of authentication issue due to the requesting sending an invalid time stamp, you will get appropriate message that can be useful for troubleshooting).

  • Note: 08/15/2019 Whilst errorMessage above provided detail in some cases, however also in some other cases it only provided generic error message (e.g. Invalid argument.) which is not so helpful when troubleshooting.

We have recently added a new attribute called errorDetail that appears part of the response and provides more detail about the underlying error. For instance when receiving response code of 3 and errorMessage: invalid argument. it was difficult to determine exactly what argument/input would have been wrong. Now errorDetail would provide more description (e.g. invalid currency).