Set a protocol
Cripto InterCambio Exchange API uses JSON-RPC 2.0 protocol for requests and responses.
Both request and response objects contain the id param. It is a custom ID generated at the client side. The parameter is necessary to distinguish responses. Use any suitable value.
Request object
Each API request object requires setting the following parameters:
| Name | Type | Required | Description |
|---|---|---|---|
jsonrpc | string | true | JSON-RPC version. The default value is 2.0. |
id | string | true | The custom client ID. |
method | string | true | The API method name. |
params | object / array of objects | true | The API request parameters. |
Each API method contains its own content and type in the params.
Sample request object
{
"jsonrpc": "2.0",
"id": "exampleCustomIdValue",
"method": "getStatus",
"params": {
"id": "pgj********2minj"
}
}
Response object
Each API response object requires setting the following parameters:
| Name | Type | Description |
|---|---|---|
jsonrpc | string | JSON-RPC version. The default value is 2.0. |
id | string | The custom client ID. |
result | string / array of strings object / array of objects | The API response. |
Each API method contains its own content and type in the params.
Sample response object
{
"jsonrpc": "2.0",
"id": "exampleCustomIdValue",
"result": "waiting"
}
Error response object
Each API error response object requires setting the following parameters:
| Name | Type | Description |
|---|---|---|
jsonrpc | string | JSON-RPC version. The default value is 2.0. |
id | string | The custom client ID. |
error | object | The possible API error. |
The error schema:
| Name | Type | Description |
|---|---|---|
code | integer | The error code. |
message | string | The error message. |
Sample error response object
{
"jsonrpc": "2.0",
"id": "exampleCustomIdValue",
"error": {
"code": -32600,
"message": "Error: You reached requests limit 10 rps"
}
}
Error codes
Each API method description provides a list of all possible errors.
If the API method is unavailable, it retrieves an error with the -32601 code and the Method not found message.