REST API

This article describes some common parts for Loopring's REST API.

Base URL

https://api.loopring.io

Rate Limit

Each API has its rate limit settings. The relayer will reject all API invocations beyond this limit, with status code 429. Stop excessive API invocations to avoid your account from being suspended.

HTTP Headers

X-API-KEY

All API except querying user ApiKey need to specify the X-API-KEY HTTP header with the user's ApiKey as the value.

X-API-SIG

The following API needs to specify the X-API-SIG HTTP header to provide an EdDSA signature:

Setting HTTP Headers

To set the HTTP headers using Python, use the code below:

def init_request_session(apiKey, sig):
    session = requests.session()
    session.headers.update({
        'Accept': 'application/json',
        'X-API-KEY': apiKey,
        'X-API-SIG': sig,
    })
    return session

Response

Except for network errors, all API will return the 200 HTTP status code and a JSON object representing the actual API result. The JSON contains a resultInfo structure that has a code field for application-specific status code, and a data JSON object that represents API-specific response.

Response

Field Type Required Description Example
resultInfo ResultInfo Y Result of API invocation -

ResultInfo Struct

Field Type Required Description Example
code integer Y Status code 0
message string Y Return message. This is used for debug only. Do not show to users "SUCCESS"

Status code

Status code Description
0 Success
100000 Unknown internal error
100001 Invalid parameter
100002 Request timeout
100202 Update fail
100203 Internal persistence error
100204 Duplicate request

results matching ""

    No results matching ""