{"openapi":"3.1.0","info":{"title":"HALFKEY public API","version":"1.0.0","summary":"Read-only gateway for HALFKEY, the atomic swap between Solana and Monero.","description":"Every number comes from chain (the program config, the maker registry, escrow accounts) or from a maker's own /v1/info.\n\nQuotes are indicative (`firm: false`): firm, signed quotes come from the maker at lock time through the widget or the SDK.\n\nNo authentication for reads. Order endpoints (deposit-address mode) are designed and validated but answer 501 until deposit mode is in the program on this network; integrator keys come with them.\n\nRate limits per IP: reads 60/min, quotes 10/min.","license":{"name":"BSL 1.1 (source published after launch)"}},"servers":[{"url":"https://halfkey.xyz/api/v1","description":"mainnet-beta / Monero mainnet"}],"externalDocs":{"url":"https://halfkey.xyz/docs/api","description":"API reference"},"tags":[{"name":"read"},{"name":"orders","description":"Deposit-address mode (next; 501 on this network)"}],"paths":{"/currencies":{"get":{"tags":["read"],"operationId":"currencies","summary":"Currencies and pairs","responses":{"200":{"description":"OK","headers":{"X-RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"X-RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests left in the current window."},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Currencies"}}}},"429":{"description":"Rate limited (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/limits":{"get":{"tags":["read"],"operationId":"limits","summary":"Min and max for a pair","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","enum":["SOL","XMR"]},"description":"Currency you send."},{"name":"to","in":"query","required":true,"schema":{"type":"string","enum":["SOL","XMR"]},"description":"Currency you receive."}],"responses":{"200":{"description":"OK","headers":{"X-RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"X-RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests left in the current window."},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Limits"}}}},"400":{"description":"Bad parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Solana RPC unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"no_liquidity or not_deployed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quote":{"get":{"tags":["read"],"operationId":"quote","summary":"Indicative quote from the best online maker","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","enum":["SOL","XMR"]},"description":"Currency you send."},{"name":"to","in":"query","required":true,"schema":{"type":"string","enum":["SOL","XMR"]},"description":"Currency you receive."},{"name":"amount_from","in":"query","schema":{"type":"string"},"description":"Amount you send (decimal). Pass this or amount_to."},{"name":"amount_to","in":"query","schema":{"type":"string"},"description":"Amount you want to receive (decimal). Pass this or amount_from."}],"responses":{"200":{"description":"OK","headers":{"X-RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"X-RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests left in the current window."},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"400":{"description":"Bad parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"amount_out_of_range","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Solana RPC unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"no_liquidity, paused or not_deployed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/status/{id}":{"get":{"tags":["read"],"operationId":"status","summary":"Status of one swap by escrow address","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Escrow (or HTLC escrow) account address, base58."}],"responses":{"200":{"description":"OK","headers":{"X-RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"X-RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests left in the current window."},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}}},"400":{"description":"Bad parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Solana RPC unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/makers":{"get":{"tags":["read"],"operationId":"makers","summary":"The on-chain maker registry with online probes","responses":{"200":{"description":"OK","headers":{"X-RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"X-RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests left in the current window."},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Makers"}}}},"429":{"description":"Rate limited (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Solana RPC unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stats":{"get":{"tags":["read"],"operationId":"stats","summary":"Protocol totals","responses":{"200":{"description":"OK","headers":{"X-RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"X-RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests left in the current window."},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Stats"}}}},"429":{"description":"Rate limited (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Solana RPC unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/order":{"post":{"tags":["orders"],"operationId":"createOrder","summary":"Create a deposit-address order (next)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderRequest"}}}},"responses":{"200":{"description":"OK","headers":{"X-RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"X-RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests left in the current window."},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"400":{"description":"invalid_order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"order_api_not_enabled: deposit-address orders are not enabled on this network","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/order/{id}":{"get":{"tags":["orders"],"operationId":"getOrder","summary":"Read an order (next)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"X-RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests left in the current window."},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"404":{"description":"order_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"order_api_not_enabled: deposit-address orders are not enabled on this network","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/order/{id}/deposit":{"post":{"tags":["orders"],"operationId":"orderDeposit","summary":"Speed-up hint: the deposit transaction (next)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["tx_hash"],"properties":{"tx_hash":{"type":"string","description":"Solana transaction signature of the deposit."}}}}}},"responses":{"200":{"description":"OK","headers":{"X-RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"X-RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests left in the current window."},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"404":{"description":"order_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"501":{"description":"order_api_not_enabled: deposit-address orders are not enabled on this network","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Error":{"type":"object","required":["error","message"],"properties":{"error":{"type":"string","description":"Machine-readable code (see /docs/api#errors)."},"message":{"type":"string","description":"What happened and what to do."}},"additionalProperties":true},"Network":{"type":"object","properties":{"cluster":{"type":"string","description":"Solana cluster"},"program_id":{"type":"string","description":"HALFKEY program id"},"monero_network":{"type":"string","description":"mainnet, stagenet or testnet"},"zec_network":{"anyOf":[{"type":"string","description":"ZEC network"},{"type":"null"}]}}},"Currencies":{"type":"object","properties":{"network":{"$ref":"#/components/schemas/Network"},"currencies":{"type":"array","items":{"type":"object","properties":{"ticker":{"type":"string","description":""},"name":{"type":"string","description":""},"network":{"type":"string","description":""},"decimals":{"type":"integer","description":""},"address":{"type":"string","description":"Address format"},"status":{"type":"string","description":"Present when not live on this network"}}}},"pairs":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":""},"to":{"type":"string","description":""},"gateway_quote":{"type":"boolean","description":"This gateway quotes the pair"},"status":{"type":"string","description":"live, test networks or next"},"quoted_by":{"type":"string","description":""}}}},"spl_input":{"type":"object","description":"Any Solana coin as input: routed through Jupiter client-side in the widget and SDK; the gateway quotes the SOL leg.","properties":{"supported":{"type":"boolean"},"route":{"type":"string","description":""},"where":{"type":"string","description":""},"note":{"type":"string","description":""}}}}},"MakerBrief":{"type":"object","properties":{"authority":{"type":"string","description":"Maker authority (base58)"},"endpoint_host":{"anyOf":[{"type":"string","description":""},{"type":"null"}]},"spread_percent":{"type":"number","description":""},"completed":{"type":"integer","description":""},"completion_rate":{"anyOf":[{"type":"number","description":"0..1, completed / (completed + aborted + declined + expired)"},{"type":"null"}]}}},"Limits":{"type":"object","properties":{"from":{"type":"string","description":""},"to":{"type":"string","description":""},"currency":{"type":"string","description":"Unit of min and max (the from currency)"},"min":{"type":"string","description":"Smallest amount you can send. Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"max":{"type":"string","description":"Largest amount you can send now. Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"available":{"type":"boolean"},"sol_leg":{"type":"object","properties":{"min_sol":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"max_sol":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"}}},"protocol":{"type":"object","properties":{"max_swap_sol":{"type":"string","description":"Per-swap cap Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"open_value_cap_sol":{"type":"string","description":"Cap on SOL open across all swaps Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"open_value_sol":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"headroom_sol":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"paused":{"type":"boolean"}}},"maker":{"$ref":"#/components/schemas/MakerBrief"},"makers_online":{"type":"integer","description":""},"updated_at":{"type":"integer","description":"Unix seconds"}}},"Quote":{"type":"object","properties":{"firm":{"const":false,"description":"Always false: firm, signed quotes come from the maker at lock time via the widget or SDK."},"quote_id":{"anyOf":[{"type":"string","description":"Set once the order API is enabled; null until then."},{"type":"null"}]},"from":{"type":"string","description":""},"to":{"type":"string","description":""},"amount_from":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"amount_to":{"type":"string","description":"After the spread and the protocol fee. Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"rate":{"type":"number","description":"amount_to / amount_from, all-in"},"maker_mid_rate_xmr_per_sol":{"type":"number","description":"The maker's indicative mid"},"fees":{"type":"object","properties":{"protocol_fee_percent":{"type":"number","description":""},"spread_percent":{"type":"number","description":""},"total_percent":{"type":"number","description":""},"protocol_fee":{"type":"object","properties":{"amount":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"currency":{"type":"string","description":""}}},"network":{"type":"string","description":""}}},"sol_leg_sol":{"type":"string","description":"SOL locked in the escrow Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"eta_secs":{"type":"integer","description":"Typical seconds until the asset is on its way"},"spendable_secs":{"type":"integer","description":"Typical seconds until it is spendable"},"quote_expires_at":{"type":"integer","description":"Unix seconds"},"maker":{"$ref":"#/components/schemas/MakerBrief"},"note":{"type":"string","description":""}}},"Status":{"type":"object","properties":{"id":{"type":"string","description":"Escrow address"},"kind":{"type":"string","enum":["escrow","htlc"]},"from":{"type":"string","description":""},"to":{"type":"string","description":""},"state":{"type":"string","enum":["locked","ready","aborted","claimed","refunded"],"description":"Raw on-chain state"},"status":{"type":"string","enum":["AWAITING_DEPOSIT","DEPOSIT_DETECTED","LOCKED","SENDING","COMPLETE","REFUNDING","REFUNDED","EXPIRED","UNDERPAID","OVERPAID"],"description":"Mapped status (see /docs/api#statuses)"},"status_detail":{"type":"string","description":""},"amounts":{"type":"object","additionalProperties":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"}},"protocol_fee_percent":{"type":"number","description":""},"maker":{"type":"string","description":""},"locker":{"type":"string","description":"Wallet that locked the SOL"},"claimer":{"type":"string","description":"Wallet that can claim the SOL"},"flags":{"type":"array","items":{"type":"string","description":"pay, otc, vault, proof"}},"times":{"type":"object","properties":{"created_at":{"anyOf":[{"type":"integer","description":""},{"type":"null"}]},"t0":{"anyOf":[{"type":"integer","description":"Claim window opens (XMR kind)"},{"type":"null"}]},"t1":{"anyOf":[{"type":"integer","description":"Refund opens"},{"type":"null"}]},"settled_at":{"anyOf":[{"type":"integer","description":""},{"type":"null"}]},"chain_now":{"type":"integer","description":""}}},"secret_published":{"type":"boolean"},"proof":{"anyOf":[{"type":"object","description":"v1.5 Monero payment proof verified on Solana","properties":{"address":{"type":"string","description":""},"amount_xmr":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"output_index":{"type":"integer","description":""},"monero_height":{"type":"integer","description":""},"monero_txid":{"type":"string","description":""},"proven_at":{"anyOf":[{"type":"integer","description":""},{"type":"null"}]},"explorer":{"type":"object"}}},{"type":"null"}]},"explorer":{"type":"object","properties":{"account":{"anyOf":[{"type":"string","description":""},{"type":"null"}]}}}}},"Makers":{"type":"object","properties":{"network":{"$ref":"#/components/schemas/Network"},"registered":{"type":"integer","description":""},"active":{"type":"integer","description":""},"online":{"type":"integer","description":""},"updated_at":{"type":"integer","description":""},"makers":{"type":"array","items":{"type":"object","properties":{"authority":{"type":"string","description":""},"address":{"type":"string","description":"Registry account"},"active":{"type":"boolean"},"online":{"type":"boolean","description":"Answered /v1/info for this program and identity"},"directions":{"type":"array","items":{"type":"string","description":""}},"spread_percent":{"type":"number","description":""},"min_sol":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"max_sol":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"bond_sol":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"staked_halfkey":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"completed":{"type":"integer","description":""},"aborted":{"type":"integer","description":""},"declined":{"type":"integer","description":""},"expired":{"type":"integer","description":""},"cancelled":{"type":"integer","description":""},"volume_sol":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"completion_rate":{"anyOf":[{"type":"number","description":""},{"type":"null"}]},"open_swaps":{"type":"integer","description":""},"endpoint_host":{"anyOf":[{"type":"string","description":""},{"type":"null"}]},"rate_xmr_per_sol":{"anyOf":[{"type":"number","description":"Live indicative mid"},{"type":"null"}]},"posted_rate":{"anyOf":[{"type":"object"},{"type":"null"}]},"registered_at":{"anyOf":[{"type":"integer","description":""},{"type":"null"}]}}}}}},"Stats":{"type":"object","properties":{"network":{"$ref":"#/components/schemas/Network"},"program":{"type":"object","properties":{"deployed":{"type":"boolean"},"initialized":{"type":"boolean"},"paused":{"type":"boolean"}}},"swaps":{"type":"object","properties":{"total":{"type":"integer","description":""},"volume_sol":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"fees_sol":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"}}},"open_value_sol":{"type":"string","description":" Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"caps":{"type":"object"},"fees":{"type":"object"},"fee_vault":{"anyOf":[{"type":"object"},{"type":"null"}]},"staking":{"anyOf":[{"type":"object"},{"type":"null"}]},"makers":{"anyOf":[{"type":"object"},{"type":"null"}]},"committee":{"anyOf":[{"type":"object","description":"v1.5 attesters: members, threshold, newest signed Monero header"},{"type":"null"}]},"updated_at":{"type":"integer","description":""}}},"OrderRequest":{"type":"object","required":["quote_id","payout_address","refund_address"],"properties":{"quote_id":{"type":"string","description":"From GET /quote"},"payout_address":{"type":"string","description":"Where the swap pays you (Monero address for SOL->XMR, Solana address for XMR->SOL)"},"refund_address":{"type":"string","description":"Where a failed swap returns your coins; fixed at quote time"},"integrator":{"type":"object","properties":{"pubkey":{"type":"string","description":"Integrator Solana address"},"fee_percent":{"type":"number","description":"0 to 2, paid on chain at settlement"}}},"partner_ref":{"type":"string","description":"Your reference, at most 64 characters"}}},"Order":{"type":"object","properties":{"order_id":{"type":"string","description":""},"status":{"type":"string","enum":["AWAITING_DEPOSIT","DEPOSIT_DETECTED","LOCKED","SENDING","COMPLETE","REFUNDING","REFUNDED","EXPIRED","UNDERPAID","OVERPAID"]},"deposit_address":{"type":"string","description":"Program-controlled address (SOL->XMR) or the 2-of-2 Monero address (XMR->SOL)"},"deposit_amount":{"type":"string","description":"Fixed mode Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"deposit_min":{"type":"string","description":"Float mode Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"deposit_max":{"type":"string","description":"Float mode Decimal string in whole coins (exact).","pattern":"^-?\\d+(\\.\\d+)?$"},"deposit_deadline":{"type":"integer","description":"Unix seconds"},"confirmations":{"type":"string","description":"\"n/10\" while SENDING"},"deposit_tx":{"anyOf":[{"type":"string","description":""},{"type":"null"}]},"lock_tx":{"anyOf":[{"type":"string","description":""},{"type":"null"}]},"xmr_txid":{"anyOf":[{"type":"string","description":""},{"type":"null"}]},"claim_tx":{"anyOf":[{"type":"string","description":""},{"type":"null"}]},"refund_tx":{"anyOf":[{"type":"string","description":""},{"type":"null"}]},"amounts":{"type":"object"},"status_url":{"type":"string","description":""},"updated_at":{"type":"integer","description":""}}}}}}