Skip to main content

Set a protocol


Cripto InterCambio Exchange API uses JSON-RPC 2.0 protocol for requests and responses.

info

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:

NameTypeRequiredDescription
jsonrpcstringtrueJSON-RPC version. The default value is 2.0.
idstringtrueThe custom client ID.
methodstringtrueThe API method name.
paramsobject / array of objectstrueThe API request parameters.
info

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:

NameTypeDescription
jsonrpcstringJSON-RPC version. The default value is 2.0.
idstringThe custom client ID.
resultstring / array of strings
object / array of objects
The API response.
info

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:

NameTypeDescription
jsonrpcstringJSON-RPC version. The default value is 2.0.
idstringThe custom client ID.
errorobjectThe possible API error.

The error schema:

NameTypeDescription
codeintegerThe error code.
messagestringThe 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.