The B2Core REST API provides methods for managing B2Core instances, such as accounts, clients, transactions, currency exchange rates, sign-up and sign-in processes.
Unless some other data format is requested, the API returns JSON-encoded responses and uses standard HTTP headers, methods, response codes and authentication procedures.
The text payload for requests and responses is encoded in UTF-8.
All HTTP endpoints are relative and resolved based on a specified hostname. The hostname is configured during the B2Core setup.
Include the following HTTP headers in your requests:
Indicates the response format which is used to process a response body.
Indicates the natural language which is used to process a response body.
Indicates the request format which is used to process a request body.
The B2Core API uses the following HTTP methods:
Creates a resource.
Reads a resource.
Updates a resource. Instead of this method, you can use a similar method that uses the HTTP verb PATCH.
Removes a resource.
The B2Core API uses standard HTTP response codes to indicate the success or failure of a request:
- 200 OK
The request succeeded.
- 201 Created
The request succeeded, and a new resource was created as a result. Typically, this response is sent after POST requests.
- 202 Accepted
The request was accepted for processing, but the processing will start later.
- 204 No Content
The request succeeded, but no response body was returned.
- 400 Bad Request
The request was invalid (for example, malformed or syntactically incorrect). This status code may indicate one of the following issues:
The API cannot convert the payload data to the underlying data type.
The data is not in the expected data format.
Required fields are not available.
A data validation error occurred.
- 401 Unauthorized
The request didn’t include an authentication token or the token has expired.
- 403 Forbidden
The client didn’t have the permissions to access the requested resource.
- 404 Not Found
The requested resource wasn’t found because the specified URI was invalid or the requested resource was unavailable (for example, a URI pointed to an empty database).
- 405 Method Not Allowed
The HTTP method in the request wasn’t supported by the resource.
- 406 Not Acceptable
The request wasn’t completed because the server doesn’t support the requested response format. For example, the request contained the
Accept: application/xmlheader, but the API can only generate a response in the
- 413 Payload Too Large
The request payload was too large to be processed by the server.
- 415 Unsupported Media Type
The request was rejected by the server because it doesn’t support the requested data format. For example, the request contained the
Content-Type: application/xmlheader, but the API only accepts requests in the
- 429 Too Many Requests
The rate limit set for the user, application or token exceeded a predefined value.
- 500 Internal Server Error
The request wasn’t completed due to an internal error on the server side.
- 503 Service Unavailable
The server is down for maintenance.
For a full list of valid response codes, refer to the IANA HTTP Status Code Registry.
You can include filter and sorting parameters as well as the parameters to facilitate pagination in your HTTP requests.
- filter array
Specifies a key-value pair in the following format:
If a method supports multiple filter parameters, you can include them in a single request.
HTTP methods support specific filter parameters, which are described in the Query parameters section for each method.
- sort_by string
Sorts the items in the response by a specified parameter.
- sort_order string
Sorts the items in the response in the ascending or descending order.
- limit integer
Specify this parameter to define the maximum number of items that may be returned in a response.
limit=10returns the first ten items.
- offset integer
Specify this parameter to exclude from a response the first N items of a resource collection.
offset=5&limit=5returns the items 6 through 10.
The B2Core API supports the RFC 3339 format for date and time representation.
Such formats as the Unix timestamp or LDAP timestamp that are frequently used on trading platforms and return unambiguous data are also supported in responses.