LogoLogo
  • ☠️Introduction
    • What is Clipper?
    • How Clipper Makes Money for LPs
    • How LPs Earn from Arbitrage
    • Clipper's Benchmark: No Impermanent Loss
      • Clipper vs. CPMMs vs. HODLing
      • Appendix: Math
    • Why Clipper Has Better Trading Prices
    • DAO Protocol Fees
    • DAO Governance
  • ⚔️How to Use Clipper
    • Liquidity Pools
      • Depositing & Withdrawing
      • Farming Pools
    • Trading
    • Community Adventures
    • FAQs
  • 🪙Governance Token
    • Community Governance
    • ⛵SAIL Primer
      • Clipper Fundamentals
      • DEX Market Structure
      • SAIL Supply & Circulation
      • SAIL Farming
      • veSAIL
      • Token Listings
  • 🏴‍☠️Disclaimers & Technical
    • Audits
    • Smart Contracts
      • Subgraph
        • Entities
        • Queries
    • Integrating with Clipper RFQ
      • Introduction
      • Guides
        • How to use clipper RFQ API?
        • Estimate Clipper Prices
        • Interacting with the Clipper Exchange contracts
        • Integration Examples
          • Swap Native token → Shorttail
          • Swap Shorttail → Native token
          • Swap Shorttail → Shorttail
          • Complete Swap Flow
      • API Reference
        • API v2
          • Overview
          • Pool v2
          • Quote v2
        • API v1
          • Overview
          • Pool
          • Quote
          • Sign
      • Troubleshooting & FAQs
    • Terms of Service
    • Privacy Policy
  • ⛵Come Aboard
    • Discord
    • Twitter
    • Github
Powered by GitBook
On this page
  • Endpoints
  • Authorization
  • Errors

Was this helpful?

  1. Disclaimers & Technical
  2. Integrating with Clipper RFQ
  3. API Reference
  4. API v2

Overview

PreviousAPI v2NextPool v2

Last updated 2 months ago

Was this helpful?

Endpoints

Learn more about the different endpoints of Swap V2 API:

  • - Get information about a blockchain network supported by clipper.

  • - Generate potential asset swap quotes. Obtain pricing and essential details for informed decision-making

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) .

For API v2 the api key auth is required.

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
}

error_code and data are not always present

Examples

{
    "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"
        }
    ]
}

{
    "errorMessage": "input_asset_symbol: INVALIDASSET is not supported",
    "errorType": "BadData"
}
{
    "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

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

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

If we make a request to endpoint and we send invalid credentials

🏴‍☠️
GET /rfq/pool/v2/{CHAIN_ID}
GET /rfq/quote/v2/{CHAIN_ID}
here
quote
quote
quote