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 v1

Overview

PreviousAPI v1NextPool

Last updated 1 month ago

Was this helpful?

Endpoints

Learn more about the different endpoints of the Swap API:

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

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

  • - Facilitates blockchain transaction preparation and security by returning the required signature and data. Use it for efficient and secure asset swaps.

Authorization

To prevent abuse of the API, we implement rate limits on requests. If you need to bypass these limits as an aggregator, please contact our support team to get API credentials (username and password) .

These credentials are used to authorize requests made to the following endpoints: /rfq/pool , /rfq/quote and /rfq/sign

Basic Authentication

DEPRECATED: If you are using Basic Authentication, please contact us to receive an API key.

The API uses the Basic authentication method, where you must include the credentials (username:password) in the headers in Base64 format.

Example:

If your username is "clipper" and your password is "clipperdocs", the Base64 encoded string for clipper:clipperdocs is Y2xpcHBlcjpjbGlwcGVyZG9jcw==.

curl --location 'https://api.clipper.exchange/rfq/quote' \
--header 'Authorization: Basic Y2xpcHBlcjpjbGlwcGVyZG9jcw==' \
--header 'Content-Type: application/json' \
--data '{
  "input_amount": "780000000000000",
  "input_asset_symbol": "ETH",
  "output_asset_symbol": "DAI",
  "time_in_seconds": 60,
  "chain_id": 1
}
'

Api Key Authentication

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/quote' \
--header 'x-api-key: TzuiYrpRgN2' \
--header 'Content-Type: application/json' \
--data '{
  "input_amount": "780000000000000",
  "input_asset_symbol": "ETH",
  "output_asset_symbol": "DAI",
  "time_in_seconds": 60,
  "chain_id": 1
}
'

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

The API v1 currently supports both API Key and Basic Authentication. However, Basic Authentication will be deprecated in the future. Note: The Pool endpoint currently only supports Basic Authentication. To use API Key authentication, use the endpoint.

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
POST /rfq/quote
POST /rfq/sign
here
Pool V2
quote
quote
quote