Overview

Endpoints

Learn more about the different endpoints of Swap V2 API:

Authorization

In order to prevent abuse on the API we implement rate limits on the requests, to overcome these limits as an aggregator get in contact with the support team to get API credentials (user and password) here.

The API uses the API KEY authentication method. You have to include the credentials in the header x-api-key.

Example: If your api key is TzuiYrpRgN2

curl --location 'https://api.clipper.exchange/rfq/v2/pool/1?fieldset=offchain-data&pool_address=0x655eDCE464CC797526600a462A8154650EEe4B77' \
--header 'x-api-key: TzuiYrpRgN2' \
--data ''

Errors

Common Error Codes

Code
Reason

400

Bad Request - Invalid data in the request

401

Unauthorized

403

Forbidden Error

500

Internal Server Error

503

External Service Error

Error Format

{
    "errorMessage": "Description of the error",
    "errorType": "Type of the error",
    "errorCode": 422,  // it is returned only when we have a clipper code for the error
    "data": []  // is is returned only when the input data is invalid
}

Examples

  1. If we make a request to quote endpoint and the body does not have the field chain_id (required param), the API response will look like similar to this:

{
    "errorMessage": "Invalid input data",
    "errorType": "BadData",
    "errorCode": 422,
    "data": [
        {
            "type": "missing",
            "loc": [
                "chain_id"
            ],
            "msg": "Field required",
            "input": {
                "input_amount": "18000",
                "input_asset_symbol": "ETH",
                "output_asset_symbol": "WBTC",
                "time_in_seconds": 60
            },
            "url": "https://errors.pydantic.dev/2.1/v/missing"
        }
    ]
}

  1. If we make a request to quote endpoint and we send an input_asset_symbol that clipper does not support, the API response will look like similar to this

{
    "errorMessage": "input_asset_symbol: INVALIDASSET is not supported",
    "errorType": "BadData"
}
  1. If we make a request to quote endpoint and we send invalid credentials

{
    "errorMessage": "Auth: Access is forbidden",
    "errorType": "Forbidden"
}

Clipper Error Codes

These codes appear in the field errorCode

Code
Reason

422

Invalid input data

409

Quote problems

Last updated

Was this helpful?