Back to Blog

Opening the Horizon Atomic Swap API

Opening the Horizon Atomic Swap API

TL;DR

  • The Horizon Market engine is now public — the same atomic swap API that powers horizon.market is documented and open for anyone to build on.
  • Four asset families, one surface — trade Counterparty assets, Bitcoin Ordinals, Zeld and Kontor (KOR + NFTs) through a single REST API.
  • Trustless by design — every trade is authorised by a client-side signature (a signed PSBT or a BIP322 message). Your keys never leave your machine, and the server never sees them.
  • No account required to trade — for most write operations, the signature is the authentication. Accounts are optional and only change who pays the platform fee.
  • Fully documented — interactive reference at horizon.market/openapi, machine-readable spec at horizon.market/openapi.yaml.

This is the first of three releases opening Horizon up to builders. Today it's the API. Next, we're making our reference client open source, and after that we're shipping a mobile app. But it starts here — with the primitive everything else is built on.

Why Open the API

Since launching 2.0, our focus has been on making trustless Bitcoin trading feel effortless. Atomic swaps are the reason it works: because a swap is a single, atomic Bitcoin transaction, matching and settlement happen together, with no counterparty risk — resolving the limitations of both Counterparty's DEX and dispensers.

That primitive shouldn't be locked inside one website. The same API that powers horizon.market is now public, so wallets, marketplaces, bots, analytics tools and entirely new interfaces can plug into the same trustless liquidity — without rebuilding the PSBT machinery from scratch.

What's in the API

The API covers the full lifecycle of a swap:

  • Discover — list and filter open swaps, search listed asset names, and resolve the image of any asset (GET /api/atomic-swaps, /asset-name, /asset-image).
  • Quote — compose a sell order, a buy order, or a fee payment server-side (sell-quotes, buy-quotes, fee-quotes). The server hands you an unsigned PSBT to sign locally.
  • List — open a sell order once you've signed the composed PSBT (POST /api/atomic-swaps).
  • Fill — buy one or several swaps in a single call (/buy).
  • Manage — delist your own listings through a two-step signed request flow.
  • Bitcoin helpers — list an address's UTXOs, fetch a raw transaction, and broadcast a signed one (/api/bitcoin/…), so a client can operate against the API without running its own node.

All four listing types — counterparty, ordinal, zeld and kontor — flow through the same endpoints, with per-family handling (inscription transfers for Ordinals, transfer-prep for Zeld, KOR tokens and NFTs for Kontor) abstracted behind a consistent request shape.

Every documented endpoint is CORS-open, so browser-based clients can call it cross-origin — a bearer token works from another origin too.

Trustless by Design

The most important property of the API is what it doesn't do: it never touches your private key.

Every trade-critical action is authorised by a client-side cryptographic signature — either a signed PSBT or a BIP322 message signature. The client always holds the key; the server only ever sees the signed result. Because the signature itself proves authorisation, most write endpoints don't require a session at all. There's no API key to leak, no OAuth dance to trade — you compose, you sign, you submit.

Accounts, Credits & Fees (Optional)

A session is never required to trade. It only changes who pays the platform fee charged when opening a listing.

  • Creating an account (via an email OTP or a BIP322 wallet challenge) grants 10 free credits immediately, topped back up to 10 on the 1st of every month.
  • While you hold credits or an active subscription, the platform fee on a new listing is waived — no on-chain fee payment needed.
  • Anonymous callers simply pay the fee on-chain, no account required.

You can read your balance any time from GET /api/auth/credits. That's the extent of what accounts do — they're a convenience, not a gatekeeper.

Getting Started

The full interactive reference lives at horizon.market/openapi, and the machine-readable OpenAPI 3.1 spec is served at horizon.market/openapi.yaml — point your codegen or your favourite HTTP client at it.

Listing open swaps is a single request:

curl "https://horizon.market/api/atomic-swaps?listing_type=ordinal&limit=5"

From there, the compose → sign → submit loop is the same everywhere: ask the server for a quote, sign the PSBT it returns with your own wallet, and post it back to open or fill a swap.

This Is Just the Beginning

Opening the API is the first of three steps toward a more open Horizon:

  1. The Atomic Swap API — live today.
  2. An open-source reference client — the code we use to talk to this API, so you don't start from a blank page. (Coming soon.)
  3. A Horizon mobile app — trustless Bitcoin trading in your pocket. (Coming soon.)

Each one builds on the last. We can't wait to see what you build in between.

Available Now

The Atomic Swap API is live. Start with the interactive docs, and if you build something with it — or hit a rough edge — we want to hear about it.

Follow us on X @hznmarket for updates, and join our Telegram group to share what you're building with the community.