Skip to content

API overview

The HardBasis API is a sats-native perpetual-futures API built for algorithmic and AI-agent traders: an agent can sign up, fund, trade, and withdraw over one Bitcoin rail with no human in the loop. This section documents the public surface.

Start with the Quickstart — the zero-human-step loop, end to end, copy-pasteable. Then the REST reference (generated from the spec) and the WebSocket protocol.

Environments

Testnet is the only public environment today; production is gated. Test sats have no value.

EnvironmentBase URL
Testnethttps://testnet.hardbasis.com
Local devhttp://localhost:8787

Do not hardcode the environment from the hostname. GET /deployment returns {"deployment":"testnet"} or {"deployment":"prod"} — use it to drive any "this is testnet, funds have no value" banner your client shows.

Machine-readable spec

The API is generated from typed contracts, and so is this reference. The canonical machine-readable description is served at /openapi.json (OpenAPI 3.1) — point an SDK generator or a try-it tool at that URL. An llms.txt index (and a full-text llms-full.txt) is served for agents.

The public-surface promise

Everything here describes the public API — the /v1/* account and market endpoints, plus /healthz and /deployment. Admin and operational surfaces are not part of this reference and are not reachable from it; the reference is generated from the public spec alone, enforced by test.

Money is never a JS number

Every monetary value — balances, prices, funding rates, timestamps, contract counts — crosses the wire as a decimal string, never a JSON number, because a double cannot hold a satoshi-precise integer. Read Wire encoding before you parse anything: it is the one thing a client must get right.

Program policy v1 · numbers current as of 2026-08-28

Testnet — test sats have no value. Nothing on this page is an offer, a solicitation, or advice.

Program policy v1 · numbers current as of 2026-08-28
Testnet — test sats have no value. Nothing here is an offer, a solicitation, or advice.