---
updatedAt: 2025-05-22T20:27:17.000Z
agentTools:
  projectIndex: https://docs.klarda.com/llms.txt
---

# Get Token Onchain CEX Flow Data

The Get Token Onchain Swap Counts by Pair Address API allows you to easily fetch the token onchain swap counts

## Definition

This endpoint retrieves data on the flow of tokens to and from Centralized Exchanges (CEXs) over a specified duration. Users can filter and sort the data based on various criteria and manage the results through pagination.

## Query Parameters

For guidance on how to leverage this method, check out the following tutorials:

1. **duration** (string): The duration over which to retrieve the CEX flow data, such as '6H' for 6 hours.
2. **sort\_by** (string): The field by which to sort the results. Acceptable values include 'buy', 'sell', etc.
3. **sort\_order** (string): The order in which to sort the results. Acceptable values are 'asc' for ascending and 'desc' for descending. Default is 'asc'.
4. **page** (int): The page number for paginated results. Default value is 1.
5. **limit** (int): The maximum number of records to return per page. Default value is 10.

## Response

The response will include a JSON object containing data on the flow of tokens to and from centralized exchanges. This may include details such as the token's volume, timestamps, and other relevant metrics.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "klarda-token-market-api",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.klarda.com/api/v1/market"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "query",
        "name": "api_key"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/token/onchain/cex-flow": {
      "get": {
        "summary": "Get Token Onchain CEX Flow Data",
        "description": "The Get Token Onchain Swap Counts by Pair Address API allows you to easily fetch the token onchain swap counts",
        "operationId": "get-token-onchain-cex-flow",
        "parameters": [
          {
            "name": "duration",
            "in": "query",
            "description": "String - specify the duration for which you want the data to remain relevant or accessible. Can be one of the following: \"6H\" and \"24H\" (more will be added in the future). Default to \"24H\"",
            "required": true,
            "schema": {
              "type": "string",
              "default": "6H"
            }
          },
          {
            "name": "sort_by",
            "in": "query",
            "description": "String - Specify the field by which users want the results to be sorted. Can be one of the following: \"deposit\", \"withdraw\" and \"net\". Default to \"deposit\".",
            "schema": {
              "type": "string",
              "default": "buy"
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "description": "String - Whether to return results in ascending (asc) or descending (desc) order. Ascending order is from oldest to newest transactions, descending order is from newest to oldest. Defaults to desc.",
            "schema": {
              "type": "string",
              "default": "asc"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Int - Defines the page number of the results to be retrieved from a paginated dataset. Default to 1.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Int - Defines the maximum number of items to be returned per page in a paginated dataset. Default to 10.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Succeed": {
                    "value": "{\n  \"success\": true,\n  \"data\": {\n    \"total\": 5357,\n    \"result\": [\n      {\n        \"chainId\": \"ethereum\",\n        \"pairAddress\": \"0x517F9dD285e75b599234F7221227339478d0FcC8\",\n        \"baseToken\": {\n          \"address\": \"0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2\",\n          \"name\": \"Maker\",\n          \"symbol\": \"MKR\",\n          \"logo_uri\": \"https://dbqxolzl7v371.cloudfront.net/150x150.maker dao1642433930131.png\"\n        },\n        \"quoteToken\": {\n          \"address\": \"0x6B175474E89094C44Da98b954EedeAC495271d0F\",\n          \"name\": \"Dai Stablecoin\",\n          \"symbol\": \"DAI\"\n        },\n        \"priceUsd\": 2951.72,\n        \"inds\": {\n          \"m5\": {\n            \"buys\": 0,\n            \"sells\": 0,\n            \"nets\": 0\n          },\n          \"h1\": {\n            \"buys\": 38906.24,\n            \"sells\": 0,\n            \"nets\": 38906.24\n          },\n          \"h6\": {\n            \"buys\": 2357755.528735632,\n            \"sells\": 1744739.0912643678,\n            \"nets\": 613016.4374712644\n          },\n          \"h24\": {\n            \"buys\": 3793740.4780876497,\n            \"sells\": 4075919.521912351,\n            \"nets\": -282179.0438247012\n          }\n        },\n        \"volume\": {\n          \"h24\": 7869660,\n          \"h6\": 4102494.62,\n          \"h1\": 38906.24,\n          \"m5\": 0\n        },\n        \"liquidity\": {\n          \"usd\": 150674117.23,\n          \"base\": 25523,\n          \"quote\": 75337058\n        }\n      }\n      \n    ]\n  }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true,
                      "default": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "example": 5357,
                          "default": 0
                        },
                        "result": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "chainId": {
                                "type": "string",
                                "example": "ethereum"
                              },
                              "pairAddress": {
                                "type": "string",
                                "example": "0x517F9dD285e75b599234F7221227339478d0FcC8"
                              },
                              "baseToken": {
                                "type": "object",
                                "properties": {
                                  "address": {
                                    "type": "string",
                                    "example": "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2"
                                  },
                                  "name": {
                                    "type": "string",
                                    "example": "Maker"
                                  },
                                  "symbol": {
                                    "type": "string",
                                    "example": "MKR"
                                  },
                                  "logo_uri": {
                                    "type": "string",
                                    "example": "https://dbqxolzl7v371.cloudfront.net/150x150.maker dao1642433930131.png"
                                  }
                                }
                              },
                              "quoteToken": {
                                "type": "object",
                                "properties": {
                                  "address": {
                                    "type": "string",
                                    "example": "0x6B175474E89094C44Da98b954EedeAC495271d0F"
                                  },
                                  "name": {
                                    "type": "string",
                                    "example": "Dai Stablecoin"
                                  },
                                  "symbol": {
                                    "type": "string",
                                    "example": "DAI"
                                  }
                                }
                              },
                              "priceUsd": {
                                "type": "number",
                                "example": 2951.72,
                                "default": 0
                              },
                              "inds": {
                                "type": "object",
                                "properties": {
                                  "m5": {
                                    "type": "object",
                                    "properties": {
                                      "buys": {
                                        "type": "integer",
                                        "example": 0,
                                        "default": 0
                                      },
                                      "sells": {
                                        "type": "integer",
                                        "example": 0,
                                        "default": 0
                                      },
                                      "nets": {
                                        "type": "integer",
                                        "example": 0,
                                        "default": 0
                                      }
                                    }
                                  },
                                  "h1": {
                                    "type": "object",
                                    "properties": {
                                      "buys": {
                                        "type": "number",
                                        "example": 38906.24,
                                        "default": 0
                                      },
                                      "sells": {
                                        "type": "integer",
                                        "example": 0,
                                        "default": 0
                                      },
                                      "nets": {
                                        "type": "number",
                                        "example": 38906.24,
                                        "default": 0
                                      }
                                    }
                                  },
                                  "h6": {
                                    "type": "object",
                                    "properties": {
                                      "buys": {
                                        "type": "number",
                                        "example": 2357755.528735632,
                                        "default": 0
                                      },
                                      "sells": {
                                        "type": "number",
                                        "example": 1744739.0912643678,
                                        "default": 0
                                      },
                                      "nets": {
                                        "type": "number",
                                        "example": 613016.4374712644,
                                        "default": 0
                                      }
                                    }
                                  },
                                  "h24": {
                                    "type": "object",
                                    "properties": {
                                      "buys": {
                                        "type": "number",
                                        "example": 3793740.4780876497,
                                        "default": 0
                                      },
                                      "sells": {
                                        "type": "number",
                                        "example": 4075919.521912351,
                                        "default": 0
                                      },
                                      "nets": {
                                        "type": "number",
                                        "example": -282179.0438247012,
                                        "default": 0
                                      }
                                    }
                                  }
                                }
                              },
                              "volume": {
                                "type": "object",
                                "properties": {
                                  "h24": {
                                    "type": "integer",
                                    "example": 7869660,
                                    "default": 0
                                  },
                                  "h6": {
                                    "type": "number",
                                    "example": 4102494.62,
                                    "default": 0
                                  },
                                  "h1": {
                                    "type": "number",
                                    "example": 38906.24,
                                    "default": 0
                                  },
                                  "m5": {
                                    "type": "integer",
                                    "example": 0,
                                    "default": 0
                                  }
                                }
                              },
                              "liquidity": {
                                "type": "object",
                                "properties": {
                                  "usd": {
                                    "type": "number",
                                    "example": 150674117.23,
                                    "default": 0
                                  },
                                  "base": {
                                    "type": "integer",
                                    "example": 25523,
                                    "default": 0
                                  },
                                  "quote": {
                                    "type": "integer",
                                    "example": 75337058,
                                    "default": 0
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"statusCode\": 400,\n  \"message\": \"Wrong api_key, please check!\",\n  \"error\": \"Bad Request\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "statusCode": {
                      "type": "integer",
                      "example": 400,
                      "default": 0
                    },
                    "message": {
                      "type": "string",
                      "example": "Wrong api_key, please check!"
                    },
                    "error": {
                      "type": "string",
                      "example": "Bad Request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"statusCode\": 401,\n  \"message\": \"Unauthorized\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "statusCode": {
                      "type": "integer",
                      "example": 401,
                      "default": 0
                    },
                    "message": {
                      "type": "string",
                      "example": "Unauthorized"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"statusCode\": 500,\n  \"message\": \"Internal server error\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "statusCode": {
                      "type": "integer",
                      "example": 500,
                      "default": 0
                    },
                    "message": {
                      "type": "string",
                      "example": "Internal server error"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```