Skip to content
Docs
Get API Access
Browse the Documentation

Quickstart

Get a key, make your first request in cURL, JavaScript or Python, and read the response.

1. Get an API Key

  1. Choose a plan on cantoncap.cc/api, monthly or yearly, and pay by card in the Stripe checkout. Plans and limits compares them.
  2. Your key is issued to the email you gave at checkout. It is live within one business day, with the plan's limits attached, and we email you when it is ready.
  3. Sign in on cantoncap.cc with the same email and reveal the key under Account, API keys. Keys issued there begin with ccsk_.

Keep the key out of your code. Put it in an environment variable:

Shell
export CANTONCAP_API_KEY="ccsk_..."

2. Make a Request

Ask for the latest price of Canton Coin. Asset IDs are stable, so you can keep this one; any other asset's ID comes from GET /v1/assets/map (see Track an asset).

curl -s "https://api.cantoncap.cc/v1/simple/price?ids=ast_515c3eaa72bd4a8b9403297879d78ef6&convert=USD" \
  -H "X-API-Key: $CANTONCAP_API_KEY"

3. Read the Response

Every successful answer has the same two parts:

JSON
{
  "status": {
    "timestamp": "2026-10-11T14:00:00.000Z",
    "elapsed_ms": 18,
    "error_code": 0,
    "error_message": null,
    "request_id": "req_7Hk2pQ9xLm"
  },
  "data": {
    "ast_515c3eaa72bd4a8b9403297879d78ef6": {
      "USD": {
        "price": "0.1584",
        "last_updated_at": "2026-10-11T14:00:00.000Z"
      }
    }
  }
}
  • status describes the request: when it was answered, how long it took, and a request_id to quote if you write to us. error_code is 0 on success.
  • data is the answer. Its shape is different for each endpoint and is described field by field in the reference.
  • Collections that page also carry pagination.next_cursor; see Pagination.
  • price is a string on purpose. Parse it with a decimal type, never a float: Decimals and precision.
  • last_updated_at is when the price was calculated. Decide for yourself how old a value may be before you stop showing it.

The response headers tell you where you stand against your plan: X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. See Rate limits.

4. Handle a Failure

A failed request has the same status block and an error object instead of data. Without a key, for example:

JSON
{
  "status": {
    "timestamp": "2026-10-11T14:00:00.000Z",
    "elapsed_ms": 0,
    "error_code": 1001,
    "error_message": "A valid API key is required",
    "request_id": "req_7Hk2pQ9xLm"
  },
  "error": {
    "code": "unauthenticated",
    "message": "A valid API key is required",
    "retryable": false
  }
}

Branch on error.code, retry only when error.retryable is true, and see Errors for every code.

Server Side Only
Call the API from your server, not from a browser or a mobile app. A key shipped to a client can be read by anyone who has the client. See Authentication.

Next Steps

Esc
navigateopenEscclose