Back to swap

API

Developer API

Public swap endpoints for wallets and apps: list markets, quote float rates, create orders, and poll status — the same contract the Anonymous Swap site uses.

Base URLhttps://anonymousswap.io

Send JSON with Content-Type: application/json. Errors return { "error": "…" } with a safe message. Do not rely on provider names in responses.

Authentication

Public callers may use /api/price, /api/create, and /api/order without a key. Partners who create an HMAC key in the dashboard should sign those same routes so creates attribute to their referral code. Rate limits and deposit pauses may still apply.

Partner HMAC

Create a key under Partners → Business. The secret is shown once. Sign every request with your secret; clock skew tolerance is ±5 minutes.

Headers: X-AS-Key (key id), X-AS-Timestamp (unix seconds), X-AS-Signature (hex).

Canonical string: timestamp.METHOD.pathname.sha256hex(rawBody). Signature = hex(HMAC-SHA256(secret, canonical)). Example pathname: /api/create

GET/api/currencies

List currencies

Returns the live currency catalog used by the swap UI and wallet. Each item includes codes, networks, deposit/receive flags, and limits when available.

Response

[
  {
    "code": "btc",
    "coin": "BTC",
    "network": "Bitcoin",
    "name": "Bitcoin",
    "recv": true,
    "send": true,
    "tag": null,
    "precision": 8,
    "minAmount": "0.0001",
    "maxAmount": null,
    "image": "https://…",
    "ticker": "btc",
    "networkId": "btc"
  }
]
GET/api/pairs

List pairs

Returns supported float swap directions. Use with currencies to validate from/to before quoting.

Response

[
  {
    "from": "btc",
    "to": "xmr",
    "fromNetwork": "btc",
    "toNetwork": "xmr",
    "rateTypes": ["float"]
  }
]
POST/api/price

Get float quote

Quotes a float receive amount for a send size. The response already includes fees at quote time. Provider identity is never exposed.

Headers

NameTypeRequiredDescription
Content-Typeapplication/jsonyesapplication/json
X-AS-KeystringnoPartner key id from the Business panel. When set, also send Timestamp and Signature.
X-AS-TimestampstringnoUnix seconds. Must be within ±5 minutes of server time.
X-AS-SignaturestringnoHex HMAC-SHA256 of timestamp.METHOD.pathname.sha256hex(rawBody) using your secret.

Body

NameTypeRequiredDescription
type"float"yesOnly float quotes are supported.
fromCcystringyesSend currency code (e.g. btc, usdttrc20).
toCcystringyesReceive currency code.
direction"from" | "to"yesUse "from" when amount is the send size.
amountstringyesAmount in the from currency (decimal string).
probebooleannoWhen true, skips minimum enforcement so you can discover floors.
  • Without probe, amounts below the pair minimum return HTTP 400 with a safe error message.
  • partnerSigned is true when a live liquidity path returned the quote; it does not name the path.
  • Optional partner HMAC attributes the session; creates use the same key for referral credit.

Request

{
  "type": "float",
  "fromCcy": "btc",
  "toCcy": "xmr",
  "direction": "from",
  "amount": "0.05"
}

Response

{
  "from": {
    "code": "btc",
    "coin": "BTC",
    "network": "Bitcoin",
    "amount": "0.05",
    "rate": "…",
    "precision": 8,
    "min": "0.0005",
    "max": ""
  },
  "to": {
    "code": "xmr",
    "coin": "XMR",
    "network": "Monero",
    "amount": "12.34",
    "rate": "…",
    "precision": 12,
    "min": "0",
    "max": ""
  },
  "errors": [],
  "partnerSigned": true
}
POST/api/create

Create order

Creates a float swap order and returns the deposit address. Poll /api/order with the returned id.

Headers

NameTypeRequiredDescription
Idempotency-KeystringnoOptional. Reuse the same key to avoid duplicate creates on retries.
X-AS-KeystringnoPartner key id from the Business panel. When set, also send Timestamp and Signature.
X-AS-TimestampstringnoUnix seconds. Must be within ±5 minutes of server time.
X-AS-SignaturestringnoHex HMAC-SHA256 of timestamp.METHOD.pathname.sha256hex(rawBody) using your secret.
Content-Typeapplication/jsonyesJSON body.

Body

NameTypeRequiredDescription
type"float"yesOnly float orders are supported.
fromCcystringyesSend currency code.
toCcystringyesReceive currency code.
direction"from" | "to"yesUse "from" when amount is the send size.
amountstringyesSend amount (decimal string).
toAddressstringyesPayout address you control.
refundAddressstringnoOptional refund address when required by the pair.
referralCodestringnoOptional affiliate code (embed/widgets). Cookie referral is used as fallback.
  • Returns HTTP 503 when new deposits are paused.
  • Amounts below minimum return HTTP 400.
  • Some pairs may require a refund/sender address (HTTP 400 with SENDER_ADDRESS_REQUIRED or REFUND_REQUIRED).
  • Store order.id (and token when present) to poll status. Do not show internal provider fields in your UI.

Request

{
  "type": "float",
  "fromCcy": "btc",
  "toCcy": "xmr",
  "direction": "from",
  "amount": "0.05",
  "toAddress": "4…"
}

Response

{
  "id": "…",
  "token": "…",
  "type": "float",
  "status": "WAIT",
  "time": {
    "reg": 1710000000,
    "expiration": 1710086400,
    "left": 86400,
    "update": 1710000000,
    "finish": null
  },
  "from": {
    "code": "btc",
    "coin": "BTC",
    "network": "Bitcoin",
    "amount": "0.05",
    "address": "bc1…"
  },
  "to": {
    "code": "xmr",
    "coin": "XMR",
    "network": "Monero",
    "amount": "12.34",
    "address": "4…"
  }
}
POST/api/order

Get order status

Fetches the latest status for an order id returned by create. Used by the public status page and in-app polling.

Headers

NameTypeRequiredDescription
Content-Typeapplication/jsonyesapplication/json
X-AS-KeystringnoPartner key id from the Business panel. When set, also send Timestamp and Signature.
X-AS-TimestampstringnoUnix seconds. Must be within ±5 minutes of server time.
X-AS-SignaturestringnoHex HMAC-SHA256 of timestamp.METHOD.pathname.sha256hex(rawBody) using your secret.

Body

NameTypeRequiredDescription
idstringyesOrder id from /api/create.
tokenstringnoSession token from create when your client stored one.
providerstringnoInternal routing hint only. Omit unless you persisted it from create; never show it to end users.
  • Typical status values: WAIT, CONFIRMING, EXCHANGE, SENDING, DONE, EXPIRED, EMERGENCY.
  • Public status lookup works with id alone; include token when available for session restores.

Request

{
  "id": "…"
}

Response

{
  "id": "…",
  "type": "float",
  "status": "CONFIRMING",
  "time": { "reg": 1710000000, "expiration": 1710086400, "left": 85000, "update": 1710000600, "finish": null },
  "from": { "code": "btc", "network": "Bitcoin", "amount": "0.05", "address": "bc1…", "tx": { "id": "…", "amount": "0.05" } },
  "to": { "code": "xmr", "network": "Monero", "amount": "12.34", "address": "4…", "tx": { "id": null, "amount": null } }
}

Business API

See /business for white-label setup packages. Affiliate partners can also use HMAC keys in the partners dashboard for signed price/create/order calls. A dedicated API host remains a later cutover.