{"openapi":"3.1.0","info":{"title":"Hashlock Markets API","version":"1.0.0","description":"Guides, concepts and a quickstart: https://docs.hashlock.markets\n\nNon-custodial cross-chain atomic swaps (BTC ↔ EVM / TRON / Solana) via sealed RFQ + HTLC. Makers and takers share these endpoints. Authenticate with an API key: `Authorization: Bearer hk_...`.\n\n**Wallets first.** An order that GIVES an asset requires a proven wallet on that asset's chain, and your key starts with only the address its account signed in with. `GET /v1/me` lists both what each chain's `login` address is and what you have `proven`; `POST /v1/wallets/{evm|tron|solana|bitcoin}` proves another by signature — Bitcoin included, on a BIP-322 one. A proof adds trading reach and nothing else: it never becomes the account's payout identity, which only a wallet session can change — so a key alone cannot redirect anyone's money. The message you sign for it must say `link this wallet` and carry a nonce from `GET /v1/wallets/nonce`; that nonce is not a login nonce, so the signature you collect is not a session for that wallet's account.\n\n**Rate limits.** Every response carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds). Over the limit returns `429` with `Retry-After`.\n\n**Idempotency.** Send an `Idempotency-Key` header on any POST to make retries safe: the operation runs once and the same response is replayed (with `Idempotency-Replayed: true`). Reusing a key with a different body returns `422`. Keys are remembered for 24h — except a `504`, which is a read of ours running out of time: on the builders nothing happened, and on `/tx/broadcast` we cannot tell — so either way a retry with the same key really retries. The fund, claim and refund builders change nothing on the server, so they run on every call and nothing of theirs is remembered — retry them freely.\n\n**Custody-agnostic settlement.** The fund/claim/refund endpoints return UNSIGNED transactions; you sign with your own key/HSM and submit via `/v1/tx/broadcast`. The server never holds your keys.\n\n---\n\n## Maker feed (WebSocket)\n\nPolling `GET /v1/rfqs` will not win you flow. `wss://<host>/v1/ws` — the host you selected above — streams every request-for-quote you are eligible for, and takes your quotes back over the same socket.\n\n**Handshake.** Connect, then send your key as the first frame. Nothing else is accepted until you do:\n\n```json\n{ \"apiKey\": \"hk_live_...\" }\n```\n\nThe key needs the `maker` scope (`GET /v1/me` shows what yours has). You get a snapshot, then a readiness marker:\n\n```json\n{ \"type\": \"snapshot\", \"rfqs\": [ ... ] }\n{ \"type\": \"ready\" }\n```\n\nThe snapshot is the **public** book only, and at most **100** entries, newest first. If you need more than that, page `GET /v1/rfqs?cursor=…` after connecting. An RFQ created while the snapshot was being built may appear both in it and in the stream that follows — frames carry the rfq id, so key on it and the duplicate is a no-op.\n\n**The stream.** Two kinds, and only two:\n\n```json\n{ \"type\": \"rfq\", \"kind\": \"created\",   \"rfq\": { ... } }\n{ \"type\": \"rfq\", \"kind\": \"cancelled\", \"rfq\": { ... } }\n```\n\n`cancelled` means the order left the book, not always that its owner cancelled it: when a listed token **closes** (it no longer passes the listing checks), every public order on it is sent as `cancelled` while its status is unchanged (`open` or `negotiating`); if the token **reopens**, the same orders come back as `created` with their original id and `createdAt`. Treat both as upserts keyed on the id.\n\nAn RFQ also leaves the book when it **expires** or is **agreed** with another maker, and neither emits a frame. A book you maintain purely from the stream therefore drifts: it keeps orders nobody can take any more, and quoting into one is rejected. Reconcile with a fresh `snapshot` (reconnect) or check `GET /v1/rfqs/{id}` before committing to a price.\n\n**What reaches you.** Public RFQs, plus private ones addressed to an address on your account. Matching follows each encoding: EVM hex and bech32 (`bc1…`/`tb1…`) compare case-insensitively, base58check (TRON, legacy Bitcoin) does not — there the case of a character is part of the address. Never your own orders — neither in the snapshot nor in the stream. Note the asymmetry: **private orders arrive only on the live stream.** They are link-only by design, so they are absent from the snapshot and from `GET /v1/rfqs`, and there is no endpoint that lists the ones addressed to you. A private order sent while your socket was down is not recoverable — if you trade private flow, stay connected.\n\n**Quoting.** Send the quote down the same socket; no HTTP round-trip, no second authentication. `quoteAmount` is in base units, as everywhere else in this API, with at most 8 decimals of its asset (fewer when the asset has fewer) — round a computed price down, or it is refused with \"a price has at most N decimals\":\n\n```json\n{ \"quote\": { \"rfqId\": \"…\", \"quoteAmount\": \"1500000000\" } }\n→ { \"type\": \"quoted\", \"rfqId\": \"…\", \"threadId\": \"…\" }\n```\n\nThe `threadId` is a negotiation thread: `GET /v1/threads/{id}` and the propose/accept endpoints take it from there. `POST /v1/rfqs/{id}/quotes` does the same thing over REST if you prefer.\n\n**Errors** arrive as `{ \"type\": \"error\", \"error\": \"…\" }` and do not close the socket.\n\n**Operating it.** There is no heartbeat and no resume: detect a dead socket yourself and reconnect. The fresh `snapshot` is your recovery for the public book, with the two limits above — 100 entries, and no private orders. Nothing is replayed, so this socket is not a settlement log. For that register a webhook (`POST /v1/webhooks`): the feed tells you what to quote, webhooks tell you what happened to your swaps.\n\n**Webhook signature.** `x-hashlock-signature: sha256=<hex>` is HMAC-SHA256 over `<timestamp>.<body>` with your webhook secret; the timestamp is in `x-hashlock-timestamp`. Verify before trusting a delivery, and reply 2xx.\n\n**Webhook events.** `quote.created`, `swap.agreed`, `swap.funded`, `secret.revealed`, `swap.settled`, `swap.refunded`, `swap.half_settled` (one leg claimed, the other refunded at its timelock) — subscribe to none and you get all of them. `POST /v1/webhooks/{id}/ping` also delivers a `ping` event, so handle an unknown `type` by returning 2xx rather than erroring.\n\n**Webhook delivery is best-effort, not durable.** A non-2xx or a timeout is retried after 15s, 30s, 60s, 120s and 240s — **6 attempts over 7m45s** — and is then dropped; there is no redelivery endpoint and no delivery log beyond `lastStatus` on `GET /v1/webhooks`. If your receiver is down longer than that you will lose events, so reconcile against `GET /v1/swaps/{id}` — that is the authoritative state — rather than treating the webhook as the record."},"servers":[{"url":"https://api.hashlock.markets","description":"production"}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"http","scheme":"bearer","description":"An API key (hk_live_… / hk_test_…) with read/taker/maker scopes. `read` is read-only: every write except webhooks needs `taker` or `maker` (403 otherwise), and either of those can read too. Creating RFQs and listing tokens need `taker`; quoting needs `maker`."}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Client-chosen unique key; retries with the same key replay the first response (24h)."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]},"Asset":{"type":"object","properties":{"id":{"type":"string"},"chain":{"type":"string"},"symbol":{"type":"string"},"name":{"type":["string","null"],"description":"full name, e.g. 'USD Coin' — display only; null for listed (unverified) tokens"},"address":{"type":["string","null"],"description":"token contract (null = native)"},"decimals":{"type":"integer"},"enabled":{"type":"boolean"},"verified":{"type":"boolean","description":"curated by Hashlock; false = listed automatically after checks — trade it by contract address, not by symbol"},"source":{"type":"string","description":"'curated', 'launchpad:<bankr|virtuals|clanker>' or 'api'"},"logoAt":{"type":["string","null"],"format":"date-time","description":"when Hashlock fetched the token's logo, found by its contract address (null = none); the image is served at /api/assets/{id}/logo?v=<this value as epoch milliseconds>, cacheable for good at that URL"},"logoAnimated":{"type":"boolean","description":"the logo is an animated image"}}},"Rfq":{"type":"object","properties":{"id":{"type":"string"},"direction":{"type":"string","enum":["sell_base","buy_base"]},"baseAssetId":{"type":"string","description":"asset uuid — list them with GET /v1/assets"},"baseAmount":{"type":"string","description":"base units"},"quoteAssetId":{"type":"string","description":"asset uuid — list them with GET /v1/assets"},"status":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"}}},"CreateRfq":{"type":"object","required":["direction","baseAssetId","baseAmount","quoteAssetId","ttlSeconds"],"properties":{"direction":{"type":"string","enum":["sell_base","buy_base"]},"baseAssetId":{"type":"string","description":"asset uuid — list them with GET /v1/assets"},"baseAmount":{"type":"string","description":"base units (integer string)"},"quoteAssetId":{"type":"string","description":"asset uuid — list them with GET /v1/assets"},"ttlSeconds":{"type":"integer"},"visibility":{"type":"string","enum":["public","private"]},"askAmount":{"type":"string","description":"a private order's price, base units, at most 8 decimals (fewer when the asset has fewer)"},"targetAddress":{"type":"string"}}},"FundOutpoint":{"type":"object","properties":{"txid":{"type":"string"},"vout":{"type":"integer"},"value":{"type":"integer","description":"sats"}}},"Swap":{"type":"object","description":"leg a = what the maker gives, leg b = what the maker wants","required":["id","threadId","status","makerId","takerId","initiatorUserId","hashlock","aAssetId","aChain","aAmount","aTimelock","bAssetId","bChain","bAmount","bTimelock"],"properties":{"id":{"type":"string"},"rfqId":{"type":["string","null"]},"threadId":{"type":"string"},"status":{"type":"string"},"makerId":{"type":"string"},"takerId":{"type":"string"},"initiatorUserId":{"type":"string","description":"funds the long leg first and holds the secret"},"hashlock":{"type":"string","description":"sha256(secret), hex"},"secretCiphertext":{"type":["string","null"],"description":"the secret once revealed on chain; null before"},"meta":{"type":["object","null"],"additionalProperties":true,"description":"server bookkeeping; `meta.fundIntent[leg].at` is a funding in flight (see fund-intent)"},"feeBps":{"type":"integer"},"feeAmount":{"type":"string","description":"base units of feeAssetId, paid by the taker"},"feeAssetId":{"type":["string","null"]},"aAssetId":{"type":"string"},"aChain":{"type":"string"},"aAmount":{"type":"string","description":"base units"},"aTimelock":{"type":"string","format":"date-time"},"aPayoutAddress":{"type":["string","null"]},"aClaimTo":{"type":["string","null"],"description":"Bitcoin: where this leg's claim pays (its receiver's wallet unless they named another address)"},"aRefundAddress":{"type":["string","null"]},"aHtlcAddress":{"type":["string","null"]},"aFundTx":{"type":["string","null"]},"aFundOutpoints":{"type":["array","null"],"items":{"$ref":"#/components/schemas/FundOutpoint"},"description":"Bitcoin: the funding outputs a claim or refund spends"},"aClaimTx":{"type":["string","null"]},"aRefundTx":{"type":["string","null"]},"bAssetId":{"type":"string"},"bChain":{"type":"string"},"bAmount":{"type":"string","description":"base units"},"bTimelock":{"type":"string","format":"date-time"},"bPayoutAddress":{"type":["string","null"]},"bClaimTo":{"type":["string","null"],"description":"Bitcoin: where this leg's claim pays (its receiver's wallet unless they named another address)"},"bRefundAddress":{"type":["string","null"]},"bHtlcAddress":{"type":["string","null"]},"bFundTx":{"type":["string","null"]},"bFundOutpoints":{"type":["array","null"],"items":{"$ref":"#/components/schemas/FundOutpoint"},"description":"Bitcoin: the funding outputs a claim or refund spends"},"bClaimTx":{"type":["string","null"]},"bRefundTx":{"type":["string","null"]},"timeline":{"type":["object","null"],"description":"each party's turns as the settlement engine decided them — fundA (the maker's funding), fundB (the taker's), payoutA / payoutB (naming where leg a / leg b pays: the taker's / the maker's), reveal (the initiator's) — with ISO times, the first of each kept: what a Thread's counterpartyStats is counted from. Null on swaps from before it was recorded; any turn or time may be absent","properties":{"fundA":{"type":"object","properties":{"openedAt":{"type":"string","format":"date-time"},"deadline":{"type":"string","format":"date-time"},"doneAt":{"type":"string","format":"date-time"},"sentAt":{"type":"string","format":"date-time"},"heldAt":{"type":"string","format":"date-time"},"shortAt":{"type":"string","format":"date-time"},"unverifiedAt":{"type":"string","format":"date-time"}}},"fundB":{"type":"object","properties":{"openedAt":{"type":"string","format":"date-time"},"deadline":{"type":"string","format":"date-time"},"doneAt":{"type":"string","format":"date-time"},"sentAt":{"type":"string","format":"date-time"},"heldAt":{"type":"string","format":"date-time"},"shortAt":{"type":"string","format":"date-time"},"unverifiedAt":{"type":"string","format":"date-time"}}},"reveal":{"type":"object","properties":{"openedAt":{"type":"string","format":"date-time"},"deadline":{"type":"string","format":"date-time"},"doneAt":{"type":"string","format":"date-time"},"sentAt":{"type":"string","format":"date-time"},"heldAt":{"type":"string","format":"date-time"},"shortAt":{"type":"string","format":"date-time"},"unverifiedAt":{"type":"string","format":"date-time"}}},"payoutA":{"type":"object","properties":{"openedAt":{"type":"string","format":"date-time"},"deadline":{"type":"string","format":"date-time"},"doneAt":{"type":"string","format":"date-time"},"sentAt":{"type":"string","format":"date-time"},"heldAt":{"type":"string","format":"date-time"},"shortAt":{"type":"string","format":"date-time"},"unverifiedAt":{"type":"string","format":"date-time"}}},"payoutB":{"type":"object","properties":{"openedAt":{"type":"string","format":"date-time"},"deadline":{"type":"string","format":"date-time"},"doneAt":{"type":"string","format":"date-time"},"sentAt":{"type":"string","format":"date-time"},"heldAt":{"type":"string","format":"date-time"},"shortAt":{"type":"string","format":"date-time"},"unverifiedAt":{"type":"string","format":"date-time"}}}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"AcceptResult":{"type":"object","required":["thread"],"properties":{"thread":{"$ref":"#/components/schemas/Thread"},"swap":{"$ref":"#/components/schemas/Swap","description":"present once both sides have accepted — the swap the agreement created"}}},"Quote":{"type":"object","required":["id","rfqId","makerId","quoteAmount","status","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"rfqId":{"type":"string"},"makerId":{"type":"string"},"quoteAmount":{"type":"string","description":"base units"},"status":{"type":"string","enum":["active","accepted","rejected","withdrawn","superseded"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"Thread":{"type":"object","required":["id","rfqId","takerId","makerId","status","takerAccepted","makerAccepted","createdAt","updatedAt"],"description":"one maker's negotiation on an RFQ","properties":{"id":{"type":"string"},"rfqId":{"type":"string"},"takerId":{"type":"string"},"makerId":{"type":"string"},"status":{"type":"string","enum":["open","agreed","closed"]},"currentQuoteAmount":{"type":["string","null"],"description":"the price on the table, base units"},"pendingAmount":{"type":["string","null"],"description":"a counter-proposal waiting for the other side, base units"},"pendingBy":{"type":["string","null"],"description":"who proposed pendingAmount"},"takerAccepted":{"type":"boolean"},"makerAccepted":{"type":"boolean"},"hashlock":{"type":["string","null"],"description":"sha256(secret), hex — the initiator's, once it has accepted"},"counterpartyName":{"type":["string","null"],"description":"the other party's account name, when they show it; null otherwise"},"counterpartyPicture":{"type":["object","null"],"description":"the picture the other party chose, shown whether or not they show a name: { style, seed } — a DiceBear 9 style (glass, thumbs, notionists-neutral, bottts-neutral) drawn from the seed — or { photo } — an id, the image at /api/photos/{photo}. Null when they chose none: the web app then draws glass from their user id for a public account (counterpartyName set) and a plain mark for an anonymous one"},"counterpartyStats":{"type":["object","null"],"description":"the other party's record across all their swaps, as maker or taker — null unless they show a public name (counterpartyName), or when it could not be read. Only what depends on them counts: turns and moves are recorded by the server as they happen, so swaps from before the record existed count toward deals only","required":["swaps","deals","walkedAway","fundSeconds","revealSeconds","fundSamples","revealSamples","since"],"properties":{"swaps":{"type":"integer","description":"every swap they were in; 0 = new"},"deals":{"type":"integer","description":"swaps that settled (both legs paid out)"},"walkedAway":{"type":"integer","description":"swaps where a move of theirs was never made in the time they had: naming where they are paid, funding their leg, or as the initiator revealing the secret once both legs were funded. One per swap; a turn with under an hour left is not counted"},"fundSeconds":{"type":["integer","null"],"description":"median seconds from their turn to their funding reaching the chain (block time; Bitcoin: first seen in the mempool), over at least 3; null otherwise"},"revealSeconds":{"type":["integer","null"],"description":"as the initiator: median seconds from both legs being funded to their claim reaching the chain, over at least 3; null otherwise"},"fundSamples":{"type":"integer","description":"how many timed fundings fundSeconds is the median of"},"revealSamples":{"type":"integer","description":"how many timed reveals revealSeconds is the median of"},"since":{"type":["string","null"],"format":"date-time","description":"the month their account was made (its first day, UTC)"}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"Message":{"type":"object","required":["id","threadId","senderId","kind","createdAt"],"properties":{"id":{"type":"string"},"threadId":{"type":"string"},"senderId":{"type":"string"},"kind":{"type":"string","enum":["text","quote","accept"]},"body":{"type":["string","null"]},"quoteAmount":{"type":["string","null"],"description":"base units, on a quote message"},"createdAt":{"type":"string","format":"date-time"}}},"Webhook":{"type":"object","required":["id","url","events","enabled"],"properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"},"description":"empty = every event"},"enabled":{"type":"boolean"},"lastDeliveryAt":{"type":["string","null"],"format":"date-time"},"lastStatus":{"type":["integer","null"],"description":"HTTP status of the last delivery attempt; null = never delivered"},"createdAt":{"type":"string","format":"date-time"}}},"SigningMaterial":{"type":"object","description":"What to sign, per chain family; `sign` says which shape it is. `evm-tx`: sign and send each of `txs` in order, from `from` when given. `btc-payment` (fund): pay `amountSats` to `payTo` (and `feeAmountSats` to `feePayTo` when present). `btc-sighash` (claim/refund): sign each of `sighashHexes`, then broadcast `{ psbtBase64, signaturesHex, preimageHex? }`. `solana-tx`: sign `transactionBase64` and broadcast it. `tron-txid`: sign each `transactions[].txID` and broadcast each signed `transaction`.","required":["chain","family","sign"],"properties":{"chain":{"type":"string"},"family":{"type":"string","enum":["evm","bitcoin","svm","tvm"]},"sign":{"type":"string","enum":["evm-tx","btc-payment","btc-sighash","solana-tx","tron-txid"]},"note":{"type":"string","description":"what to do with it, in words"},"chainId":{"type":"integer","description":"evm-tx"},"from":{"type":"string","description":"evm-tx (fund) and tron-txid: the address that must sign"},"txs":{"type":"array","description":"evm-tx: unsigned transactions (an ERC-20 fund is approve, then createSwap)","items":{"type":"object","properties":{"to":{"type":"string"},"data":{"type":"string"},"value":{"type":"string","description":"hex wei"}}}},"payTo":{"type":"string","description":"btc-payment: the escrow (P2WSH) address"},"amountSats":{"type":["string","integer"],"description":"btc-payment: sats still due to the escrow (string); btc-sighash: what the spend pays out after the network fee (integer)"},"topUp":{"type":"boolean","description":"btc-payment: the escrow already holds part of the amount"},"feePayTo":{"type":"string","description":"btc-payment: the protocol fee treasury, when this leg carries the fee"},"feeAmountSats":{"type":"string","description":"btc-payment: the protocol fee in sats"},"toAddress":{"type":"string","description":"btc-sighash: where the spend pays"},"psbtBase64":{"type":"string","description":"btc-sighash"},"sighashHex":{"type":"string","description":"btc-sighash: equals sighashHexes[0]"},"sighashHexes":{"type":"array","items":{"type":"string"},"description":"btc-sighash: one per input, same key"},"feeSats":{"type":"integer","description":"btc-sighash: the network fee"},"preimageHex":{"type":"string","description":"btc-sighash, claim: the secret you sent, to pass back on broadcast"},"timelockUnix":{"type":"integer","description":"refund (btc-sighash, solana-tx): the leg timelock"},"escrow":{"type":"string","description":"solana-tx: the escrow account"},"transactionBase64":{"type":"string","description":"solana-tx: the unsigned transaction"},"blockhash":{"type":"string","description":"solana-tx"},"lastValidBlockHeight":{"type":"integer","description":"solana-tx: rebuild once the chain passes it"},"transactions":{"type":"array","description":"tron-txid: unsigned transactions (a TRC-20 fund is approve, then fund)","items":{"type":"object","properties":{"transaction":{"type":"object"},"txID":{"type":"string"}}}}}}}},"paths":{"/v1/me":{"get":{"summary":"Verify the key, list its scopes and the wallets attached to its account","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"handle":{"type":["string","null"],"description":"the account name — PATCH /v1/me/profile, or Account › Profile in the app"},"handlePublic":{"type":"boolean","description":"whether the other side of a deal sees the name, and the account's record beside it"},"wallets":{"type":"object","description":"per chain family: the login address, and the addresses proven by signature","properties":{"evm":{"type":"object","properties":{"login":{"type":["string","null"],"description":"the address this account signed in with, and where it is paid"},"proven":{"type":"array","items":{"type":"string"},"description":"addresses proven by signature — tradeable, never a payout identity"}}},"tron":{"type":"object","properties":{"login":{"type":["string","null"],"description":"the address this account signed in with, and where it is paid"},"proven":{"type":"array","items":{"type":"string"},"description":"addresses proven by signature — tradeable, never a payout identity"}}},"bitcoin":{"type":"object","properties":{"login":{"type":["string","null"],"description":"the address this account signed in with, and where it is paid"},"proven":{"type":"array","items":{"type":"string"},"description":"addresses proven by signature — tradeable, never a payout identity"}}},"solana":{"type":"object","properties":{"login":{"type":["string","null"],"description":"the address this account signed in with, and where it is paid"},"proven":{"type":"array","items":{"type":"string"},"description":"addresses proven by signature — tradeable, never a payout identity"}}}}}}}}}},"401":{"description":"invalid key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getMe"}},"/v1/me/profile":{"patch":{"summary":"Set the account name and whether the other side of a deal sees it","description":"The change the app makes in Account › Profile (\"How you trade\"), for an account that trades through its key alone. Send either field or both. An account is anonymous until `handlePublic` is true. From then on the accounts it negotiates with see its name and, beside the name, its record over all its swaps — those made while it was anonymous included (`counterpartyName` and `counterpartyStats` on a Thread); back to false hides both. A name may be set ten times an hour per account, counted together with changes made in the app; clearing it, re-sending the name the account already has and `handlePublic` are not counted. Needs a key with the `taker` or `maker` scope.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"handle":{"type":["string","null"],"description":"3 to 24 characters: letters, digits and _ — stored in lowercase, unique across accounts. `null` clears the name, and stops showing it."},"handlePublic":{"type":"boolean","description":"whether the other side of a deal sees the name and the record; `true` needs a name — the account's, or `handle` in the same request"}}},"example":{"handle":"<3 to 24 characters: letters, digits, _>","handlePublic":true}}}},"responses":{"200":{"description":"ok — the two fields as they now stand","content":{"application/json":{"schema":{"type":"object","properties":{"handle":{"type":["string","null"]},"handlePublic":{"type":"boolean"}}}}}},"400":{"description":"not a valid name, a reserved one, `handlePublic: true` on an account with no name, or nothing to change","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"the key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"the name belongs to another account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"too many name changes this hour","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"patchMeProfile"}},"/v1/wallets/nonce":{"get":{"summary":"A single-use nonce to put in the message you are about to sign","description":"Expires shortly and is consumed by the first proof that presents it. It is a LINK nonce: it cannot be spent at a login endpoint, so the signature you collect is not a session. `?purpose=authorize` issues the nonce for the login wallet's authorisation instead — a separate pool.","parameters":[{"name":"purpose","in":"query","required":false,"schema":{"type":"string","enum":["link","authorize"]}}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"nonce":{"type":"string"}}}}}}},"operationId":"getWalletsNonce"}},"/v1/keys/nonce":{"get":{"summary":"Start minting an API key: a single-use nonce (5 minutes). No key needed.","security":[],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"nonce":{"type":"string"}}}}}}},"operationId":"getKeysNonce"}},"/v1/keys":{"post":{"summary":"Mint an API key with a wallet signature — no browser, no key needed (agents start here)","description":"Sign, with the wallet, a message that says `create an API key`, names the address and carries a nonce from `GET /v1/keys/nonce`. Optional lines `Key name: <name>` and `Scopes: read, taker` (default all three) decide the key — they are read from the signed text only. The key belongs to the account that wallet SIGNS IN to (created on first use); a wallet proved onto another account does not reach it. An account with only a wallet holds ONE live key: a new signed mint replaces the previous one (also the way to recover a lost or leaked key). An account signed up at /developers with email, Google or Telegram holds up to 10. All keys of an account share one rate budget. It expires after 90 days (`expiresAt`; mint a new one to renew), an account holds at most 10 live keys, the owner is told (in Telegram, when linked) of every new one in Telegram, and the plaintext key is returned once. Signing rules per rail are those of POST /v1/wallets/<chain>.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["rail","address","message","signature"],"properties":{"rail":{"type":"string","enum":["evm","tron","solana","bitcoin"]},"address":{"type":"string"},"message":{"type":"string"},"signature":{"type":"string"}}},"example":{"rail":"evm","address":"0xYourAddress","message":"Hashlock Markets — create an API key.\n\nAddress: 0xYourAddress\nKey name: my-agent\nScopes: read, taker, maker\nNonce: <GET /v1/keys/nonce>\nIssued At: 2026-09-30T12:00:00Z","signature":"0x…"}}}},"responses":{"200":{"description":"the key — shown once","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"name":{"type":["string","null"]},"expiresAt":{"type":"string","format":"date-time"}}}}}},"400":{"description":"bad signature, spent nonce, or the account already holds 10 live keys","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postKeys"}},"/v1/wallets/{address}":{"delete":{"summary":"Withdraw a proof this account made","description":"Removes the address from what this account can trade from. Reach for it after rotating a leaked key: the proofs made with that key outlive it otherwise. Proofs only — a login address is not one and is not removable here. Putting a proof back needs that wallet to sign again.","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"withdrawn","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string"},"family":{"type":"string"},"proven":{"type":"boolean","enum":[false]}}}}}},"404":{"description":"this account has no proof for that address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"deleteWalletsByAddress"}},"/v1/wallets/evm":{"post":{"summary":"Prove a EVM wallet this account holds","description":"Sign with personal_sign / EIP-191 a message carrying `Hashlock Markets`, the words `link this wallet`, the address itself and a nonce from `GET /v1/wallets/nonce`. Needed before this account can create an order that GIVES a EVM asset. The proof is recorded as a proof — it does not become the account's payout identity, which only a wallet session can set. ALONE it counts for giving on EVM only. Add `authorization` — your LOGIN wallet signing a message that carries `Hashlock Markets`, the words `authorise this wallet`, the address being linked (and, except for a Bitcoin login, the login address) and a nonce from `GET /v1/wallets/nonce?purpose=authorize` — and the wallet also counts as a payout address, a Bitcoin/Solana refund address and a TRON funding wallet, as if linked at hashlock.markets. That is how an agent with no browser trades across chains.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["address","message","signature"],"properties":{"address":{"type":"string"},"message":{"type":"string"},"signature":{"type":"string"},"authorization":{"type":"object","description":"optional: the account's login wallet vouching for this one (see above)","required":["address","message","signature"],"properties":{"address":{"type":"string"},"message":{"type":"string"},"signature":{"type":"string"}}}}},"example":{"address":"<your address on that chain>","message":"Hashlock Markets — link this wallet.\n\nAddress: <the same address>\nNonce: <GET /v1/wallets/nonce>","signature":"<that message, signed by that address>"}}}},"responses":{"200":{"description":"proven (repeating a proof you already hold is the same 200); `authorised` says whether it counts beyond EVM giving","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string"},"family":{"type":"string","enum":["evm"]},"proven":{"type":"boolean"},"authorised":{"type":"boolean"}}}}}},"400":{"description":"bad signature, a message that does not say `link this wallet` (or `authorise this wallet`), an authorisation not signed by this account's login wallet or not naming this address, or a nonce that was never issued / already used","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"that wallet belongs to another account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postWalletsEvm"}},"/v1/wallets/tron":{"post":{"summary":"Prove a TRON wallet this account holds","description":"Sign with signMessageV2 a message carrying `Hashlock Markets`, the words `link this wallet`, the address itself and a nonce from `GET /v1/wallets/nonce`. Needed before this account can create an order that GIVES a TRON asset. The proof is recorded as a proof — it does not become the account's payout identity, which only a wallet session can set. ALONE it counts for giving on EVM only. Add `authorization` — your LOGIN wallet signing a message that carries `Hashlock Markets`, the words `authorise this wallet`, the address being linked (and, except for a Bitcoin login, the login address) and a nonce from `GET /v1/wallets/nonce?purpose=authorize` — and the wallet also counts as a payout address, a Bitcoin/Solana refund address and a TRON funding wallet, as if linked at hashlock.markets. That is how an agent with no browser trades across chains.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["address","message","signature"],"properties":{"address":{"type":"string"},"message":{"type":"string"},"signature":{"type":"string"},"authorization":{"type":"object","description":"optional: the account's login wallet vouching for this one (see above)","required":["address","message","signature"],"properties":{"address":{"type":"string"},"message":{"type":"string"},"signature":{"type":"string"}}}}},"example":{"address":"<your address on that chain>","message":"Hashlock Markets — link this wallet.\n\nAddress: <the same address>\nNonce: <GET /v1/wallets/nonce>","signature":"<that message, signed by that address>"}}}},"responses":{"200":{"description":"proven (repeating a proof you already hold is the same 200); `authorised` says whether it counts beyond EVM giving","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string"},"family":{"type":"string","enum":["tvm"]},"proven":{"type":"boolean"},"authorised":{"type":"boolean"}}}}}},"400":{"description":"bad signature, a message that does not say `link this wallet` (or `authorise this wallet`), an authorisation not signed by this account's login wallet or not naming this address, or a nonce that was never issued / already used","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"that wallet belongs to another account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postWalletsTron"}},"/v1/wallets/solana":{"post":{"summary":"Prove a Solana wallet this account holds","description":"Sign with ed25519 signMessage, base58 a message carrying `Hashlock Markets`, the words `link this wallet`, the address itself and a nonce from `GET /v1/wallets/nonce`. Needed before this account can create an order that GIVES a Solana asset. The proof is recorded as a proof — it does not become the account's payout identity, which only a wallet session can set. ALONE it counts for giving on EVM only. Add `authorization` — your LOGIN wallet signing a message that carries `Hashlock Markets`, the words `authorise this wallet`, the address being linked (and, except for a Bitcoin login, the login address) and a nonce from `GET /v1/wallets/nonce?purpose=authorize` — and the wallet also counts as a payout address, a Bitcoin/Solana refund address and a TRON funding wallet, as if linked at hashlock.markets. That is how an agent with no browser trades across chains.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["address","message","signature"],"properties":{"address":{"type":"string"},"message":{"type":"string"},"signature":{"type":"string"},"authorization":{"type":"object","description":"optional: the account's login wallet vouching for this one (see above)","required":["address","message","signature"],"properties":{"address":{"type":"string"},"message":{"type":"string"},"signature":{"type":"string"}}}}},"example":{"address":"<your address on that chain>","message":"Hashlock Markets — link this wallet.\n\nAddress: <the same address>\nNonce: <GET /v1/wallets/nonce>","signature":"<that message, signed by that address>"}}}},"responses":{"200":{"description":"proven (repeating a proof you already hold is the same 200); `authorised` says whether it counts beyond EVM giving","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string"},"family":{"type":"string","enum":["svm"]},"proven":{"type":"boolean"},"authorised":{"type":"boolean"}}}}}},"400":{"description":"bad signature, a message that does not say `link this wallet` (or `authorise this wallet`), an authorisation not signed by this account's login wallet or not naming this address, or a nonce that was never issued / already used","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"that wallet belongs to another account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postWalletsSolana"}},"/v1/wallets/bitcoin":{"post":{"summary":"Prove a Bitcoin wallet this account holds","description":"Sign with BIP-322 (UniSat / OKX `signMessage(msg, 'bip322-simple')`) a message carrying `Hashlock Markets`, the words `link this wallet`, and a nonce from `GET /v1/wallets/nonce`. Needed before this account can create an order that GIVES a Bitcoin asset. The proof is recorded as a proof — it does not become the account's payout identity, which only a wallet session can set. ALONE it counts for giving on EVM only. Add `authorization` — your LOGIN wallet signing a message that carries `Hashlock Markets`, the words `authorise this wallet`, the address being linked (and, except for a Bitcoin login, the login address) and a nonce from `GET /v1/wallets/nonce?purpose=authorize` — and the wallet also counts as a payout address, a Bitcoin/Solana refund address and a TRON funding wallet, as if linked at hashlock.markets. That is how an agent with no browser trades across chains.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["address","message","signature"],"properties":{"address":{"type":"string"},"message":{"type":"string"},"signature":{"type":"string"},"authorization":{"type":"object","description":"optional: the account's login wallet vouching for this one (see above)","required":["address","message","signature"],"properties":{"address":{"type":"string"},"message":{"type":"string"},"signature":{"type":"string"}}}}},"example":{"address":"<your address on that chain>","message":"Hashlock Markets — link this wallet.\n\nAddress: <the same address>\nNonce: <GET /v1/wallets/nonce>","signature":"<that message, signed by that address>"}}}},"responses":{"200":{"description":"proven (repeating a proof you already hold is the same 200); `authorised` says whether it counts beyond EVM giving","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string"},"family":{"type":"string","enum":["bitcoin"]},"proven":{"type":"boolean"},"authorised":{"type":"boolean"}}}}}},"400":{"description":"bad signature, a message that does not say `link this wallet` (or `authorise this wallet`), an authorisation not signed by this account's login wallet or not naming this address, or a nonce that was never issued / already used","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"that wallet belongs to another account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postWalletsBitcoin"}},"/v1/assets":{"get":{"summary":"Enabled asset registry — the whole list, or a search","description":"Without `q`, `limit` or `offset`: every enabled asset. Any of those turns on search, where `chain` and `verified` also apply: an exact symbol first, then verified, then alphabetical, paged by `nextOffset`.","parameters":[{"name":"q","in":"query","description":"a symbol prefix (case-insensitive) or a full contract address","schema":{"type":"string","maxLength":100}},{"name":"chain","in":"query","schema":{"type":"string"}},{"name":"verified","in":"query","description":"`1` or `true`: verified (curated) assets only","schema":{"type":"string"}},{"name":"limit","in":"query","description":"page size, 1–200 (default 50)","schema":{"type":"integer","minimum":1,"maximum":200}},{"name":"offset","in":"query","description":"`nextOffset` from the previous page","schema":{"type":"integer","minimum":0,"maximum":9999}}],"responses":{"200":{"description":"ok — `nextOffset` appears only in search mode (null on the last page)","content":{"application/json":{"schema":{"type":"object","properties":{"assets":{"type":"array","items":{"$ref":"#/components/schemas/Asset"}},"nextOffset":{"type":["integer","null"]}}}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getAssets"},"post":{"summary":"Ask for a token to be listed","description":"Runs the same checks as the launchpad listener: an on-chain check (EVM: a simulated transfer; Solana: a classic SPL mint with no mint or freeze authority — Token-2022 is not listable), security scan (Powered by GoPlus Security) and market thresholds (market cap ≥ $1M, liquidity ≥ $100k, 24h volume ≥ $250k, ≥ 500 holders, ≥ 24h old, top 10 holders ≤ 40% excluding pools). EVM chains and Solana, where Hashlock supports them. A listed token has `verified: false`. 20 requests an hour per account.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["chain","address"],"properties":{"chain":{"type":"string"},"address":{"type":"string","description":"the token contract (EVM) or mint (Solana, base58 as is)"}}}}}},"responses":{"200":{"description":"already listed, or a closed token reopened because it passes again","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["listed"]},"asset":{"$ref":"#/components/schemas/Asset"},"security":{"type":"string"}}}}}},"201":{"description":"listed now (`verified: false`)","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["listed"]},"asset":{"$ref":"#/components/schemas/Asset"},"security":{"type":"string"}}}}}},"202":{"description":"not yet. 'pending': it stays queued and is listed automatically if it passes within a week. 'closed': a closed listed token that does not pass yet","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["pending","closed"]},"reasons":{"type":"array","items":{"type":"string"}},"security":{"type":"string"}}}}}},"400":{"description":"not a supported chain, or not a token address on it"},"422":{"description":"final. 'rejected' (with reasons): it failed a safety check. 'delisted' (with error): closed for good — by the operator, or for a safety failure after listing","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["rejected","delisted"]},"reasons":{"type":"array","items":{"type":"string"}},"error":{"type":"string"},"security":{"type":"string"}}}}}},"429":{"description":"more than 20 listing requests this hour"}},"operationId":"postAssets"}},"/v1/rfqs":{"get":{"summary":"Order book (open RFQs to quote) — cursor-paginated","parameters":[{"name":"baseAssetId","in":"query","schema":{"type":"string"}},{"name":"quoteAssetId","in":"query","schema":{"type":"string"}},{"name":"direction","in":"query","schema":{"type":"string","enum":["sell_base","buy_base"]}},{"name":"assetId","in":"query","description":"this asset on either side","schema":{"type":"string","format":"uuid"}},{"name":"chain","in":"query","description":"either leg on this chain, e.g. `bitcoin`, `base`","schema":{"type":"string"}},{"name":"verified","in":"query","description":"`1` or `true`: both tokens verified (no listed tokens). Any other value, or none, applies no filter.","schema":{"type":"string"}},{"name":"q","in":"query","description":"a symbol prefix (case-insensitive) or a full contract address, on either token","schema":{"type":"string","maxLength":100}},{"name":"sort","in":"query","description":"`new` (default): newest first. `expiring`: soonest to expire first. Keep it the same while paging (a cursor from the other sort is a 400). An order reopened while you page can move within the `expiring` order.","schema":{"type":"string","enum":["new","expiring"]}},{"name":"limit","in":"query","description":"page size, 1–100 (default 20)","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"cursor","in":"query","description":"nextCursor from the previous page, unchanged. One that does not decode is a 400 (\"invalid cursor\"), not page 1 again.","schema":{"type":"string"}}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"rfqs":{"type":"array","items":{"$ref":"#/components/schemas/Rfq"}},"nextCursor":{"type":["string","null"],"description":"pass as ?cursor for the next page; null = last page"}}}}}}},"operationId":"getRfqs"},"post":{"summary":"Create an RFQ (scope: taker)","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRfq"},"example":{"direction":"sell_base","baseAssetId":"<asset uuid — GET /v1/assets>","baseAmount":"50000000","quoteAssetId":"<asset uuid — GET /v1/assets>","ttlSeconds":900,"visibility":"public"}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"rfq":{"$ref":"#/components/schemas/Rfq"}}}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postRfqs"}},"/v1/rfqs/mine":{"get":{"summary":"Your own RFQs — private ones included, every status — cursor-paginated","description":"The order book lists only public open RFQs. This lists everything you created, newest first: how to find an order whose create call timed out, and its id to cancel it.","parameters":[{"name":"limit","in":"query","description":"page size, 1–100 (default 20)","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"cursor","in":"query","description":"nextCursor from the previous page, unchanged. One that does not decode is a 400 (\"invalid cursor\"), not page 1 again.","schema":{"type":"string"}}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"rfqs":{"type":"array","items":{"$ref":"#/components/schemas/Rfq"}},"nextCursor":{"type":["string","null"],"description":"pass as ?cursor for the next page; null = last page"}}}}}}},"operationId":"getRfqsMine"}},"/v1/rfqs/{id}/threads":{"get":{"summary":"The negotiation threads on an RFQ — every one for its creator, your own for a maker","description":"How a taker finds the quotes on its RFQ without a webhook: each thread is one maker's quote. Read one with `GET /v1/threads/{id}`. Newest activity first.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"threads":{"type":"array","items":{"$ref":"#/components/schemas/Thread"}}}}}}},"404":{"description":"no such RFQ","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getRfqsByIdThreads"}},"/v1/rfqs/{id}":{"get":{"summary":"Get an RFQ","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"rfq":{"$ref":"#/components/schemas/Rfq"}}}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getRfqsById"}},"/v1/rfqs/{id}/cancel":{"post":{"summary":"Withdraw your own RFQ (scope: taker)","description":"Only before a deal is agreed, and only your own order — the id alone does not cancel someone else's.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"cancelled","content":{"application/json":{"schema":{"type":"object","properties":{"rfq":{"$ref":"#/components/schemas/Rfq"}}}}}},"400":{"description":"not yours, already agreed, or already gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postRfqsByIdCancel"}},"/v1/rfqs/{id}/quotes":{"post":{"summary":"Quote an RFQ (scope: maker) — opens a settlement thread","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["quoteAmount"],"properties":{"quoteAmount":{"type":"string","description":"base units, at most 8 decimals (fewer when the asset has fewer)"}}},"example":{"quoteAmount":"<amount in base units, integer>"}}}},"responses":{"201":{"description":"created — your quote, and the thread it opened (or updated)","content":{"application/json":{"schema":{"type":"object","properties":{"quote":{"$ref":"#/components/schemas/Quote"},"thread":{"$ref":"#/components/schemas/Thread"}}}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postRfqsByIdQuotes"}},"/v1/swaps":{"get":{"summary":"List your swaps — cursor-paginated","parameters":[{"name":"limit","in":"query","description":"page size, 1–100 (default 20)","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"cursor","in":"query","description":"nextCursor from the previous page, unchanged. One that does not decode is a 400 (\"invalid cursor\"), not page 1 again.","schema":{"type":"string"}}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"swaps":{"type":"array","items":{"$ref":"#/components/schemas/Swap"}},"nextCursor":{"type":["string","null"]}}}}}}},"operationId":"getSwaps"}},"/v1/swaps/{id}":{"get":{"summary":"Swap lifecycle status","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"swap":{"$ref":"#/components/schemas/Swap"}}}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getSwapsById"}},"/v1/swaps/{id}/legs/{leg}/fund":{"post":{"summary":"Build UNSIGNED transaction(s) to fund a leg — sign with your own key/HSM, then broadcast","description":"EVM: sign every returned transaction from the returned `from` address — the leg refund address. The factory refuses any other sender, and the escrow refunds to it.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"leg","in":"path","required":true,"schema":{"type":"string","enum":["a","b"]}}],"responses":{"200":{"description":"chain-specific signing material (EVM txs / BTC pay-to / TRON txs / Solana transaction, base64)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SigningMaterial"}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"a state to wait out or act on, not an error: the leg is already funded, the initiator's leg must be funded first, or an address is still missing — the message says which (never stored by Idempotency-Key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"temporarily unavailable (TRON funding paused, or the already-funded check could not be read) — retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"a chain or explorer read of ours ran out of time — nothing was changed; retry (an Idempotency-Key does not remember a 504)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postSwapsByIdLegsByLegFund"}},"/v1/swaps/{id}/legs/{leg}/claim":{"post":{"summary":"Build UNSIGNED claim (reveals the secret) — body: { secret: 32-byte hex }","description":"The secret travels to the server in this request, on every chain: the EVM, TRON and Solana claim transactions carry it, and on Bitcoin it comes back as `preimageHex` for the broadcast. Until then the server has only `sha256(secret)`. Build the claim when you are about to send it: the transaction puts the secret on chain, where it is public. It is refused until both legs are funded, and a refused request has still carried the secret, so do not call it earlier.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"leg","in":"path","required":true,"schema":{"type":"string","enum":["a","b"]}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["secret"],"properties":{"secret":{"type":"string"},"to":{"type":"string","description":"bitcoin only: where the spend pays — default: the deal's receive address (claim, when one is set), else your wallet behind the script's key, else that key's P2WPKH. A claim to another address than the deal's receive address is refused (409)."}}},"example":{"secret":"<the 32-byte hex preimage of this swap hashlock>"}}}},"responses":{"200":{"description":"signing material","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SigningMaterial"}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"refused for the swap's state, not the request: both legs are not funded yet, the claim window closed, or the transaction would revert now — the message says which (never stored by Idempotency-Key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"a chain or explorer read of ours ran out of time — nothing was changed; retry (an Idempotency-Key does not remember a 504)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postSwapsByIdLegsByLegClaim"}},"/v1/swaps/{id}/legs/{leg}/refund":{"post":{"summary":"Build UNSIGNED refund (after the timelock)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"leg","in":"path","required":true,"schema":{"type":"string","enum":["a","b"]}},{"name":"escrow","in":"query","required":false,"schema":{"type":"string"},"description":"bitcoin only: refund an escrow this leg moved OFF (after a pubkey correction) instead of its current one; refused for an address that was never this leg's escrow"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"string","description":"bitcoin only: where the refund pays — default: the P2WPKH of the script's refund key"}}}}}},"responses":{"200":{"description":"signing material","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SigningMaterial"}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"refused for the swap's state, not the request: the timelock has not passed yet, you already claimed the other leg, or the transaction would revert now — the message says which (never stored by Idempotency-Key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"a chain or explorer read of ours ran out of time — nothing was changed; retry (an Idempotency-Key does not remember a 504)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postSwapsByIdLegsByLegRefund"}},"/v1/swaps/{id}/legs/{leg}/presign":{"get":{"summary":"Bitcoin leg: build its claim (receiver) or refund (funder) to PRE-SIGN, at up to three fee levels","description":"`kind=claim` (default): only the leg's receiver, once its escrow is recorded. A claim sighash does not cover the witness, so signing it needs no secret: sign every `sighashHexes` entry of each level with the script's receiver key and POST them back. When the secret is revealed the keeper inserts it and broadcasts the level the fee market needs, so the claim is paid while you are offline. `kind=refund`: only the initiator's leg, by its funder, once its escrow is recorded and while the secret is not revealed and the leg not refunded — also after the deal failed; signed with the script's sender key, valid only after the timelock. If the deal cannot complete (the secret never revealed, the other leg refunded), the keeper broadcasts it once the median time past is beyond the timelock — never after a reveal. `to` (optional) is where the spend pays; default: a claim pays the leg's `claimTo` (a Bitcoin address sent to POST /v1/swaps/{id}/address — over /v1 one of this account's proven wallets), else the receiver's own wallet behind the signing key, else that key's P2WPKH address; a refund pays the signing key's own P2WPKH address. A claim `to` other than a set `claimTo` is refused with 409.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"leg","in":"path","required":true,"schema":{"type":"string","enum":["a","b"]}},{"name":"kind","in":"query","required":false,"schema":{"type":"string","enum":["claim","refund"]}},{"name":"to","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"the spend to sign at each fee level","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["claim","refund"]},"toAddress":{"type":"string"},"signerPubkeyHex":{"type":"string","description":"the key that signs this branch"},"receiverPubkeyHex":{"type":"string","description":"kind=claim only — the same key as signerPubkeyHex"},"inputs":{"type":"array","items":{"type":"object","properties":{"txid":{"type":"string"},"vout":{"type":"integer"},"value":{"type":"integer"}}}},"levels":{"type":"array","items":{"type":"object","properties":{"feeSats":{"type":"integer"},"psbtBase64":{"type":"string"},"sighashHexes":{"type":"array","items":{"type":"string"}}}}}}}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"not a Bitcoin leg you receive (claim) or fund as the initiator (refund), the escrow is not recorded yet, (claim) the swap is over, or (refund) the secret is revealed or the leg refunded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"the Bitcoin explorer could not be read — retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getSwapsByIdLegsByLegPresign"},"post":{"summary":"Store the pre-signed Bitcoin claim or refund — body: { kind: \"claim\" | \"refund\", toAddress, levels: [{ feeSats, psbtBase64, signaturesHex }] }","description":"Each level is verified against the escrow's confirmed outputs and the script's key for that branch: one output to toAddress, one signature per input; a claim by the receiver key with locktime 0, a refund by the sender key with locktime = the leg's timelock and non-final inputs.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"leg","in":"path","required":true,"schema":{"type":"string","enum":["a","b"]}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["kind","toAddress","levels"],"properties":{"kind":{"type":"string","enum":["claim","refund"]},"toAddress":{"type":"string"},"levels":{"type":"array","minItems":1,"maxItems":3,"items":{"type":"object","properties":{"feeSats":{"type":"integer"},"psbtBase64":{"type":"string"},"signaturesHex":{"type":"array","items":{"type":"string"}}}}}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"swap":{"$ref":"#/components/schemas/Swap"}}}}}},"400":{"description":"a level failed verification — the message names the level and the check","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"not a Bitcoin leg you receive (claim) or fund as the initiator (refund), the escrow is not recorded yet, (claim) the swap is over, or (refund) the secret is revealed or the leg refunded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"the Bitcoin explorer could not be read — retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postSwapsByIdLegsByLegPresign"}},"/v1/threads/{id}":{"get":{"summary":"Get a negotiation thread (messages, current terms)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"thread":{"$ref":"#/components/schemas/Thread"},"rfq":{"$ref":"#/components/schemas/Rfq"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"swap":{"oneOf":[{"$ref":"#/components/schemas/Swap"},{"type":"null"}],"description":"the swap once both sides accepted, else null"}}}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"getThreadsById"}},"/v1/threads/{id}/propose":{"post":{"summary":"Propose a new price on a thread","description":"Proposing a price is agreeing to it: when the counterparty takes it with accept: true (POST /v1/threads/{id}/accept-proposal) the deal is agreed in that step. The initiator agrees only with its hashlock, so it passes it here; an initiator's proposal without one leaves it to accept after the take.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["quoteAmount"],"properties":{"quoteAmount":{"type":"string","description":"base units, at most 8 decimals (fewer when the asset has fewer)"},"hashlock":{"type":"string","description":"32-byte hex sha256(secret) — the initiator's; ignored from the other side"}}},"example":{"quoteAmount":"<amount in base units, integer>"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"thread":{"$ref":"#/components/schemas/Thread"}}}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postThreadsByIdPropose"}},"/v1/threads/{id}/accept-proposal":{"post":{"summary":"Accept the counterparty's pending price","description":"Name the price you are accepting: it is refused if a newer counter has replaced it since you read the thread. With `accept: true` it also accepts the deal at that price in the same transaction — COMMITS, like POST /v1/threads/{id}/accept — and, since proposing a price is agreeing to it, that agrees the deal (unless the proposer is the initiator and proposed without its hashlock — then its accept is left); the initiator taking a counter passes its hashlock here (a hashlock without accept: true is refused). Without accept, the taker's accept is left afterwards (and the proposer's too, when it is the initiator and proposed without its hashlock).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["quoteAmount"],"properties":{"quoteAmount":{"type":"string","description":"the pending price, base units — must equal the thread's pendingAmount"},"accept":{"type":"boolean","description":"also accept the deal at this price (one transaction)"},"hashlock":{"type":"string","description":"32-byte hex sha256(secret); required from the initiator with accept: true"}}},"example":{"quoteAmount":"<the pending price, base units — GET /v1/threads/{id}>","accept":true,"hashlock":"<sha256(secret) hex — the initiator only>"}}}},"responses":{"200":{"description":"ok — { thread }, or with accept: true { thread, swap? }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptResult"}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postThreadsByIdAcceptProposal"}},"/v1/threads/{id}/accept":{"post":{"summary":"Accept the current terms — COMMITS, and cannot be undone","description":"Name the price you are accepting: it is refused if the terms moved since you read the thread. The initiator (funds the long leg) also passes hashlock = sha256(secret); when BOTH sides accept, the swap is created.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["quoteAmount"],"properties":{"quoteAmount":{"type":"string","description":"the current price, base units — must equal the thread's currentQuoteAmount"},"hashlock":{"type":"string","description":"32-byte hex; required from the initiator"}}},"example":{"quoteAmount":"<the current price, base units — GET /v1/threads/{id}>","hashlock":"<sha256(secret), 32-byte hex>"}}}},"responses":{"200":{"description":"ok — returns { thread, swap? }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptResult"}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postThreadsByIdAccept"}},"/v1/swaps/{id}/address":{"post":{"summary":"Set your receive (payout) / refund address for a leg","description":"Set your receive (payout) / refund address for a leg. Bitcoin: the compressed pubkey (hex) — the P2WSH is derived once both sides are set. Required before funding. An address that RECEIVES money — the payout one, and on Bitcoin and Solana the refund one too — must be a wallet this account signed in with, one proven with the login wallet's authorisation (POST /v1/wallets/<chain> with `authorization`), or one proved from a signed-in wallet session on the web (for Bitcoin, the pubkey of such an address). A proof made with an API key alone widens what you can trade but does not count here, so a leaked key cannot redirect your money.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["chain","address"],"properties":{"chain":{"type":"string"},"address":{"type":"string"},"leg":{"type":"string","enum":["a","b"],"description":"required only when both legs of the swap are on `chain`"}}},"example":{"chain":"<a chain of this swap>","address":"<your payout address on that chain>"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"swap":{"$ref":"#/components/schemas/Swap"}}}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"a funding of this leg is on its way — its refund and receive addresses are fixed until it is recorded or fails","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"a chain or explorer read of ours ran out of time — nothing was changed; retry (an Idempotency-Key does not remember a 504)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postSwapsByIdAddress"}},"/v1/swaps/{id}/fund-intent":{"post":{"summary":"Reserve an EVM leg's funding, then report its broadcast","description":"Call it WITHOUT txHash before the first transaction of an EVM leg you fund (approve or createSwap): it reserves the leg, and is refused with 409 while another funding of it is live — from any client or wallet. Call it again WITH txHash as soon as your createSwap is broadcast. While the reservation stands, every client shows the leg as on its way, and its refund address and the counterparty's receive (payout) address on it are fixed. It is released when the escrow is recorded, or when the transaction reverts, mines without this swap's escrow, or is not seen on chain for 30 minutes; a reservation that never names a transaction lapses after 30 minutes. Pass `at` (the reservation's token) when attaching if more than one of your clients may fund. The same txHash again changes nothing.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["leg"],"properties":{"leg":{"type":"string","enum":["a","b"]},"txHash":{"type":"string","description":"0x + 64 hex — omit to reserve"},"from":{"type":"string","description":"when reserving: the wallet that will send the escrow, recorded as the leg's refund address in the same write"},"at":{"type":"string","description":"when attaching: the reservation's token — meta.fundIntent[leg].at as the reserve returned it"}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"swap":{"$ref":"#/components/schemas/Swap"}}}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"another funding of this leg is on its way","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postSwapsByIdFundIntent"}},"/v1/swaps/{id}/fund-intent/{leg}":{"delete":{"summary":"Give back a funding reservation that never broadcast","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"leg","in":"path","required":true,"schema":{"type":"string","enum":["a","b"]}},{"name":"at","in":"query","required":true,"schema":{"type":"string"},"description":"the reservation's token, as the reserve returned it"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"swap":{"$ref":"#/components/schemas/Swap"}}}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"deleteSwapsByIdFundIntentByLeg"}},"/v1/webhooks":{"get":{"summary":"List your webhooks (secret not shown)","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}}}}}}},"operationId":"getWebhooks"},"post":{"summary":"Register a webhook","description":"Register a webhook. Events: quote.created, swap.agreed, swap.funded, secret.revealed, swap.settled, swap.refunded, swap.half_settled (omit = all). Returns the signing secret ONCE; deliveries are POSTed with X-Hashlock-Signature: sha256=HMAC-SHA256(secret, `${timestamp}.${body}`).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri","description":"https only. Registration rejects an address LITERAL that is non-public, but does no DNS — a hostname resolving into a private range registers fine and then fails every delivery, visible only as lastStatus. Delivery resolves and re-checks at connect time, follows no redirects, and times out after 10s."},"events":{"type":"array","items":{"type":"string"}}}},"example":{"url":"<your https endpoint>","events":["swap.funded","swap.settled"]}}}},"responses":{"201":{"description":"created — { webhook, secret }; the secret is shown only here","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/Webhook","description":"lastDeliveryAt, lastStatus and createdAt are absent here"},"secret":{"type":"string","description":"whsec_… — verifies x-hashlock-signature"}}}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postWebhooks"}},"/v1/webhooks/{id}":{"delete":{"summary":"Delete a webhook","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}}}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"deleteWebhooksById"}},"/v1/webhooks/{id}/ping":{"post":{"summary":"Send a test delivery to a webhook","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"ok — { deliveryId }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"deliveryId":{"type":"string"}}}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postWebhooksByIdPing"}},"/v1/tx/broadcast":{"post":{"summary":"Relay a client-signed transaction","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["chain","signed"],"properties":{"chain":{"type":"string","enum":["evm","tron","bitcoin","solana"]},"signed":{"description":"evm: 0x raw transaction hex · tron: the signed transaction object · bitcoin: raw hex, or { psbtBase64, signaturesHex[], preimageHex? } · solana: the signed transaction, base64"}}},"example":{"chain":"<evm | tron | bitcoin | solana>","signed":"0x<signed raw transaction hex>"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"txid":{"type":"string"}}}}}},"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"the node did not answer in time — the transaction MAY already be broadcast; look the txid up before sending it again. Not remembered by Idempotency-Key, so a retry really retries.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"postTxBroadcast"}}}}