Getting Started

Welcome to the Sintra API docs. It's here that you can find information on the endpoints we offer as well as how to authenticate, how we return errors and rate limiting. Please do get in touch if you have any questions or suggestions.

The Sintra API base url is: https://api.sintra.fi/v1

Authentication

You do not need to authenticate if you're on the Starter plan. The following only applies to the Pro plan.

API keys are split into two parts separated with a . character. The first part is the id and the second part is the token. The token is used to check against the encrypted value we store in our database.

You can either send your id as the username and the token as the password or send the whole apiKey as the username.

Please keep the API key safe (especially the token part) and do not share with anyone. We will ask for the id if you need to request email support.

Your API key must be included in every API request using Basic Authentication.

Method

Procedure

Basic Authentication using username only

Use the id and token values (joined with the .) as the username and leave the password empty. Remember to include the colon after the username.

Basic Authentication using username and password

Use the id value in the username and the token as the password separated by a colon.

Errors

Sintra uses conventional HTTP response codes to indicate the success or failure of an API request. Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error due to an invalid request in some way. Codes in the 5xx range indicate an error on our end and shouldn't happen very often.

Parameter

Type

Description

status_code

number

HTTP status code for the error

message

string

Human readable string describing the problem

type

string

Type of error e.g. "UnauthorizedError" or "NotFoundError"

code

string

Some error responses may include a code property to help determine the cause of the error e.g. "API_KEY_MISSING"

Example Responsejson

Rate Limits

The Starter plan allows 10 requests per minute and the Pro plan allows 250 requests per one minute period.

Limits are based on IP address. By providing a valid API Key, you are automatically assigned the higher rate limit.

If the limit is reached on either plan then a 429 error is returned and you will need to wait before being able to make more requests.

Please inspect the response headers for details on when you can make another request.

Exchanges

An Exchange represents a crypto exchange that Sintra receives trade data from.

Endpointhttp

List Exchanges

This endpoint lists all crypto exchanges that Sintra connects to.

Example Requestcurl
Example Responsejson

Fees

Bitcoin transaction fees.

Endpointhttp

List Fees

This endpoint lists the latest Bitcoin transactions fees in vB. The response is an array of fees ranging from the lowest to the highest.

Example Requestcurl
Example Responsejson

List Fee History

This endpoint retrieves the Bitcoin fee history. History is on an hourly basis.

This endpoint requires authentication.

Query Parameters

date timestamp A timestamp without milliseconds. This value specifies the upper date range for the price history with all prices being before this value.


sort string Sort the data by date in "asc" or "desc" order (default "asc").


limit number Limit the number of results returned (default 10, max 25).

Example Requestcurl
Example Responsejson

Pairs

A Pair is a base currency (btc only) and supported quote currency.

Endpointhttp

Retrieve Pair

This endpoint retrieves a single Pair. You can use this endpoint to get price stats about the pair such as open and close price.

URL Parameters

pair string A supported Pair (e.g. btcusd).


Query Parameters

date timestamp A timestamp without milliseconds. Results will be based on a 24 hour period from this value. If omitted, then the current day will be used and the "close" value will be the latest price.

Example Requestcurl
Example Responsejson

List Pairs

This endpoint lists supported Pairs.

Example Requestcurl
Example Responsejson

Prices

A price represents the amount needed in a quote currency to purchase a single unit of the base currency (i.e. 1 BTC). We use volume-weighted data provided by multiple exchanges to return the price in any supported currency.

Endpointhttp

Retrieve Price

This endpoint retrieves the price for the specified pair.

URL Parameters

pair string A Pair (e.g. btcusd). If you provide an unsupported quote currency then we will return Coinbase's current spot price.

Example Requestcurl
Example Responsejson

List Prices

This endpoint lists prices for all supported currencies.

Always check for the existence of the currency key (usd, gbp etc) in the response object. This is because there can be a delay before the price for each currency is available.

Example Requestcurl
Example Responsejson

List Price History

This endpoint retrieves the price history for a single supported currency.

This endpoint requires authentication.

URL Parameters

pair string A supported Pair (e.g. btcusd).


Query Parameters

interval string Price interval. One of "minute", "hour" or "day" (default "minute").


date timestamp A timestamp without milliseconds. This value specifies the upper date range for the price history with all prices being before this value.


sort string Sort the data by date in "asc" or "desc" order (default "asc").


limit number Limit the number of results returned (default 10, max 25).

Example Requestcurl
Example Responsejson

Sessions

A Session is required to authenticate a connection to the websocket server.

Endpointhttp

Create Session

Create a sessionId which can be used to authenticate a websocket server connection. Sessions last for 10 minutes before expiring. You will need to create another sessionId if you need to reconnect to the websocket server. Existing connections will persist after expiry.

This endpoint requires authentication.

Example Requestcurl
Example Responsejson

Websockets

Websockets allow for a bi-directional connection between your application and Sintra. Using this connection, we can send data directly to you at regular intervals.

The websocket endpoint is: wss://api.sintra.fi/ws

Starter Plan

Pro Plan

Auth Required

No

Yes (see below)

Update Frequency

10 seconds

1 second

Websocket Authentication

If you connect to the websocket server with a valid sessionId then you will receive 1 second prices updates. If not then the updates will be every 10 seconds.

To get a valid sessionId you need to make a POST request to the /sessions endpoint (see Sessions section above).

To pass your sessionId when connecting to the websocket server, pass the value as a query parameter in your connection string: wss://api.sintra.fi/ws?sessionId=<sessionId>

Websocket Errors

Websocket errors are events sent by the Sintra websocket server but have a dedicated section here.

Parameter

Type

Description

event

string

Can be used by clients to detect errors - always "error".

data.message

string

Human readable string describing the problem

data.type

string

Type of error e.g. "ConnectionError" or "AuthenticationError"

data.code

string

Some error responses may include a code property to help determine the cause of the error.

Example Responsejson

Websocket Events

Sintra will push events to your app as and when they happen. Events are sent as stringified JSON data which your application will need to handle.

Websocket Connection Event

The connection event occurs when your application successfully connects to the Sintra websocket server.

Example Responsejson

Websocket Data Event

The data event occurs at regular intervals and depends on your chosen price plan.

Example Responsejson