Aller au contenu
Tous les chapitres de la documentation
Sur cette page

Supra Core API — Public Client Documentation

Chapter 16 — Curl Examples

1. Safety Rules

Every example uses placeholders.

Before running a request:

  • replace <api-base> with the supplied HTTPS base URL;
  • load <api-key> from trusted server-side storage;
  • replace only the identifiers required by the endpoint;
  • keep the key out of URLs, command history, screenshots, and shared logs;
  • do not paste a completed secret-bearing command into support messages.

Warning: These commands are suitable for trusted terminals and backend environments, not public browser code.


2. Common Request Shape

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/<endpoint>'

Use HTTPS.

The equivalent Bearer header is Authorization: Bearer <api-key>.


3. Health

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/health'

4. Market Current

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/market/current?limit=<limit>&offset=<offset>&sort=latest_desc'

Filter by token and quote:

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/market/current?token=<token-address>&quote=<quote-token-address>'

5. Market Pair

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/market/pair?token=<token-address>&quote=<quote-token-address>'

6. Candles

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/candles?token=<token-address>&quote=<quote-token-address>&granularity=<granularity>&limit=<limit>&offset=<offset>'

Use integer Unix timestamps for documented from and to filters.

Chart-ready token history, returned oldest first with server-selected granularity:

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/chart/token?token=<token-address>&quote=<quote-token-address>&range=24h'

7. FA Swaps

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/fa/swaps?wallet=<wallet-address>&limit=<limit>&offset=<offset>'

Transaction lookup:

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/fa/swaps?tx_hash=<tx-hash>'

8. LEGACY Swaps

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/legacy/swaps?token=<token-address>&limit=<limit>&offset=<offset>'

9. FA Liquidity Events

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/fa/liquidity-events?pool=<pool-address>&limit=<limit>&offset=<offset>'

Farm activity:

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/fa/liquidity-events?farm=<farm-address>&event_family=FARM'

Events involving one token:

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/fa/liquidity-events?token=<token-address>&limit=<limit>'

10. LEGACY Liquidity Events

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/legacy/liquidity-events?tx_hash=<tx-hash>'

11. FA Burn Events

curl -sS \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/fa/burn-events?token=<token-address>&limit=<limit>&offset=<offset>'

12. Inspecting Status and JSON

To include response headers without exposing the request header in output:

curl -sS -i \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/health'

When saving output, choose a safe temporary location and confirm it contains no secrets. The response should not echo the API key.


13. Query Encoding

If a parameter can contain reserved URL characters, use curl's query encoding:

curl -sS --get \
  -H 'Accept: application/json' \
  -H 'X-API-Key: <api-key>' \
  --data-urlencode 'token=<token-address>' \
  --data-urlencode 'quote=<quote-token-address>' \
  '<api-base>/api/v1/market/pair'

14. Pagination Example

First page:

curl -sS \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/fa/swaps?limit=<limit>&offset=0'

Next page:

curl -sS \
  -H 'X-API-Key: <api-key>' \
  '<api-base>/api/v1/fa/swaps?limit=<limit>&offset=<offset>'

The API does not currently use page_token.


15. Safe Troubleshooting

Record:

  • UTC time;
  • endpoint;
  • status;
  • public error code;
  • redacted parameters;
  • <request-id> when available.

Never record or share the completed X-API-Key header.


16. Scope and Data Exposure

These examples demonstrate authenticated HTTPS requests with placeholders. Replace placeholders locally and never publish a real API key.


17. Chapter Summary

Use the examples as safe request templates from a trusted terminal or backend. Replace placeholders locally, preserve the API key as a secret, URL-encode parameters when needed, and never share completed secret-bearing commands.