The Tern API is built around one thing: the quote. You get a price, turn it into a firm quote, have the user deposit or send the swap, track its status, and for a cross-chain swap, reveal the secret that completes it.

Base URL

Every path starts with /v1. Requests and responses are JSON over HTTPS.

Endpoints

Formats

New fields, error codes, and values may be added to v1 over time. Ignore fields you don’t recognize, and handle an unfamiliar error code by its HTTP status.

Calling from a browser

The API accepts requests from any website, so a web app can call it directly. Browsers can send the x-api-key, Idempotency-Key, and x-request-id headers, and read the x-request-id and Retry-After headers in responses.

Rules for every request

Authentication and limits

API keys, rate limits, and request IDs.

Idempotency

Retry safely without creating anything twice.

Errors

What each error means and how to handle it.