{
  "openapi": "3.0.3",
  "info": {
    "title": "kryptr.io API",
    "version": "2.10.0",
    "description": "kryptr.io API: multi-currency crypto wallets managed over an API, with webhooks and callbacks.\n\nNo full node is run: balances and transactions are read from public chain APIs (JSON-RPC for the EVM networks, TronGrid, mempool.space, litecoinspace.org, toncenter).\n\nSurfaces:\n\n1. **Public**: health, the wallet asset list, auth (no auth).\n2. **Dashboard** (`/v1/dashboard/*`): JWT bearer bound to a key of the client that signed in (see *Dashboard sessions*), used by the web app.\n3. **Merchant API** (`/api/v1/*`): HMAC-signed, for your servers.\n\n## Wallets\n\nEvery registered user can create any number of wallets. A wallet is one 24-word BIP-39 seed phrase (no passphrase) with an address on each network:\n\n| Network | Assets | Derivation path |\n|---|---|---|\n| `ethereum` | ETH, USDT, USDC | `m/44'/60'/0'/0/0` |\n| `bsc` | BNB, USDT, USDC | `m/44'/60'/0'/0/0` (same address as Ethereum) |\n| `polygon` | POL, USDT, USDC | `m/44'/60'/0'/0/0` (same address as Ethereum) |\n| `arbitrum` | ETH, USDT (USDT0), USDC | `m/44'/60'/0'/0/0` (same address as Ethereum) |\n| `optimism` | ETH, USDT (USDT0), USDC | `m/44'/60'/0'/0/0` (same address as Ethereum) |\n| `base` | ETH, USDC | `m/44'/60'/0'/0/0` (same address as Ethereum) |\n| `avalanche` | AVAX, USDT, USDC (C-Chain) | `m/44'/60'/0'/0/0` (same address as Ethereum) |\n| `tron` | TRX, USDT | `m/44'/195'/0'/0/0` |\n| `bitcoin` | BTC (native SegWit `bc1…`) | `m/84'/0'/0'/0/0` |\n| `litecoin` | LTC (native SegWit `ltc1…`) | `m/84'/2'/0'/0/0` |\n| `ton` | TON (Gram) | `m/44'/607'/0'` (SLIP-10 ed25519), wallet v4r2, non-bounceable `UQ…` address |\n\nThese are the paths Trust Wallet and wallet-core use, so the exported phrase opens the same addresses there.\n\n* Funds stay on the wallet's own addresses: nothing is swept, and they leave only by your transfer, your swap or a wallet rule you made. Network fees of a transfer are paid by the wallet itself in the network's coin (ETH, BNB, POL, TRX, LTC, TON): keep some on the address before sending tokens, or send the token with `fee_in_asset` (see *Network fee in the token*). A TRON token transfer (a send or a swap deposit) is dry-run and priced before it is queued and again right before it is sent: its energy, the contract's dynamic penalty included, with a 20 % margin over the address's staked energy, plus its bandwidth when the free and staked bandwidth do not cover it. Without that TRX on the address the request gets `422 insufficient_funds` with the amount needed, and a failing dry run gets `422 transfer_would_fail`, so no fee is burned on a transfer that cannot complete.\n* `DELETE` is a soft delete: the wallet is kept with `deleted_at`, is no longer watched for deposits and cannot send, but stays readable and its seed phrase stays exportable, so funds left on it are never lost.\n* The seed phrase is stored encrypted (AES-256-GCM). It is returned only by the export endpoints: over the API with a key that has the `wallets:mnemonic` scope, in the dashboard after the password (and the 2FA code when 2FA is on). Every export is rate limited (10 an hour), written to the audit log and announced with a `wallet.mnemonic_exported` event.\n* Transfers are queued and broadcast by a worker; one transfer per address is in flight at a time (EVM nonces, TON seqno, UTXO change).\n\n## Swaps\n\nA wallet can exchange one of its assets for another; the payout lands on the same wallet's address on the target network, with no exchange account and no KYC on our side.\n\n1. `POST .../swaps/quote` with `from_asset`, `to_asset`, `amount`. THORChain (from the native coins of Ethereum, BSC, Avalanche, Base, TRON, Bitcoin and Litecoin) and LI.FI (between EVM networks) are asked at once; SideShift is asked only when neither returns a quote. Quotes come best first and live at most two minutes; `errors` lists the providers that refused (often an amount under their minimum).\n2. `POST .../swaps` with the `quote_id` and an `Idempotency-Key` (from the dashboard also a 2FA code). The balance is checked on chain, the provider's deposit is opened and the wallet's transactions are queued as its transfers with `swap_id`: a LI.FI token swap first approves the exact amount to LI.FI's router, then calls it. A second LI.FI swap of the same token from the same wallet is refused with `409 swap_in_progress` until the first one's deposit is confirmed on chain, because both would use one router allowance.\n3. Follow `status` (`awaiting_deposit` → `processing` → `completed`, `refunded` or `failed`) by `GET /swaps/{id}` or the `swap.*` events. A refund goes back to the sending address.\n4. `GET /swaps/{id}/events` is the swap's trail, oldest first: every provider asked for its quote (refusals too), the start, each transaction of the wallet as its status changes, each new provider answer and each status of the swap. `provider_ids` on the swap holds the provider's own identifiers as they become known (SideShift `shift_id`, THORChain `memoless_reference` and `inbound_tx`/`out_tx`, LI.FI `transaction_id`, `sending_tx`, `receiving_tx` and explorer links); quote them to the provider's support.\n\nNo fee is added by kryptr.io: `amount_out` is net of the provider's fees; the wallet pays the network fee of its own transactions in the network's coin.\n\n## Merchant API request signing\n\nEvery `/api/v1/*` request carries:\n\n| Header | Value |\n|---|---|\n| `X-API-Key` | public key, `pk_live_…` |\n| `X-Timestamp` | RFC3339 time, within 5 minutes of the server clock; use milliseconds (`2026-11-29T11:05:30.123Z`) |\n| `X-Signature` | hex `HMAC-SHA256(secret, \"<timestamp>.<METHOD>.<path>.<body>\")` |\n| `Idempotency-Key` | required for wallet transfers and swaps |\n\n`<path>` is the request path as sent, plus `?` and the query string when there is one (`/api/v1/wallets?limit=10`). `<body>` is the exact body bytes (empty for `GET` and `DELETE`).\n\nEach signature is accepted **once**: a repeated request with the same signature is rejected with `401 replayed_request`. Sign every request anew; a millisecond timestamp keeps two identical requests in one second apart.\n\n```bash\nTS=$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)\nBODY='{\"name\":\"Main\",\"external_id\":\"user-42\"}'\nSIG=$(printf '%s.%s.%s.%s' \"$TS\" POST /api/v1/wallets \"$BODY\" \\\n  | openssl dgst -sha256 -hmac \"$SECRET\" | awk '{print $2}')\ncurl -s https://kryptr.io/api/v1/wallets -H \"X-API-Key: $PUBLIC\" \\\n  -H \"X-Timestamp: $TS\" -H \"X-Signature: $SIG\" -H 'Content-Type: application/json' -d \"$BODY\"\n```\n\nLimits: 600 requests a minute per key, 60 wallets created a minute per account, 10 seed phrase exports an hour per account (`429 too_many_requests`). Keys of a suspended account get `403`.\n\n### Scopes\n\n| Scope | Allows |\n|---|---|\n| `wallets:read` | list and read wallets, balances, deposits, transfers |\n| `wallets:write` | create, rename and delete wallets |\n| `wallets:transfer` | send funds from a wallet |\n| `wallets:swap` | quote and start swaps inside a wallet |\n| `wallets:mnemonic` | export a wallet's seed phrase |\n\nA new key without `scopes` gets every scope except `wallets:mnemonic`.\n\nCreating any key needs a fresh 2FA code (`totp_code`); a key with `wallets:transfer`, `wallets:swap` or `wallets:mnemonic` also the account password. Requests signed with a key need no code: the key was issued with one.\n\n## Dashboard sessions\n\nA dashboard session is bound to a key pair the client makes when it signs in, so a copied token alone is useless. Send the public half with the 2FA step of `POST /v1/auth/login` as `session_key` (base64 of the DER SubjectPublicKeyInfo of an ECDSA P-256 key; the web app makes a non-extractable WebCrypto key and keeps it in IndexedDB), then sign every `/v1/dashboard/*` request with the private half:\n\n| Header | Value |\n|---|---|\n| `Authorization` | `Bearer <token>` |\n| `X-Session-Timestamp` | Unix time in milliseconds, within 5 minutes of the server clock |\n| `X-Session-Proof` | base64url of the 64-byte `r‖s` ECDSA P-256 SHA-256 signature of `\"<timestamp>.<METHOD>.<path>.<hex SHA-256 of the body>\"` |\n\n`<path>` is the path as sent, plus `?` and the query when there is one; the body hash of an empty body is that of zero bytes. A token sent without a valid proof was used away from its client: its session ends at once (`401 session_proof_invalid`). A correct proof more than 5 minutes off the server clock gets `401 session_clock_skew` (take the time from the `Date` header and sign again), and a proof is accepted once (`401 session_proof_replayed`).\n\nA session ends after 24 hours, after an hour without requests, on `POST /v1/dashboard/logout`, when it is ended from the list of sessions (`GET /v1/dashboard/sessions`), and for every session but the current one on a password change or a new authenticator.\n\n## Spending policies and screening\n\nAn API key can carry a policy (`daily_limit_usd`, `address_book_only`), set when it is created or later with `PUT /v1/dashboard/api-keys/{id}/policy` (password and 2FA code):\n\n* **Daily limit**: what the key sent and swapped in the last 24 hours, in US dollars at CoinGecko prices, plus this request. A transfer over it is stored with status `awaiting_approval` and a `hold_reason`; a swap over it is refused with `422 policy_limit` (its quote lives two minutes, too short to wait). A coin with no price counts as over the limit.\n* **Address book only**: a transfer to an address that is not in the address book, or was added less than 24 hours ago, waits for approval.\n* The owner approves or rejects a held transfer in the dashboard with a 2FA code (`POST /v1/dashboard/transfers/{id}/approve | reject`); approval checks the recipient, the balance and the fee again.\n\n**Sanctions screening.** The OFAC SDN list's digital-currency addresses (the advanced XML from the US Treasury's Sanctions List Service, refreshed daily) are checked both ways: a transfer or an address-book entry to a listed address is refused with `422 sanctioned_address`, and a deposit from a listed sender (every input of a Bitcoin or Litecoin transaction) is marked `screening.result = match` and announced with `deposit.flagged`. `GET /v1/dashboard/screening` gives the list's size and date. The list holds only the addresses OFAC published; it is not a risk score of every address.\n\n## Wallet rules\n\nA rule tells a wallet what to do by itself with each confirmed deposit of one asset: `send` it to an address, or `swap` it into another asset of the same wallet. One rule per wallet and asset.\n\n* `scope: deposit` moves the deposit's amount; `scope: balance` moves everything the address holds above `keep_amount`. A deposit, or a remainder, below `min_amount` is left alone, so dust never costs a fee. `keep_amount` is required for a network's own coin, which pays the fee.\n* Each confirmed deposit fires a rule once. The run is recorded before anything moves and its transfer or swap carries the run's idempotency key, so a restart never sends twice. Rules of one wallet and asset act one at a time: a run waits until the wallet's earlier transfer of that asset is final.\n* Rules are made, switched on, switched off and deleted only in the dashboard; making and switching on ask for a 2FA code. An API key reads the rules and their log (`GET /api/v1/wallets/{id}/rules`, `/rule-runs`) and cannot change them, so a key under a spending policy cannot give itself a rule that sends.\n* A `send` rule's recipient is compared with the OFAC SDN list when the rule is made, when it is switched on and at each transfer. A deposit whose sender is on the list fires no run, and every run leaves on the address the sum of such deposits that are still unconfirmed or were confirmed since the rule's `active_from`; switching the rule on again starts that count anew.\n* `daily_limit` caps what a rule moves in any 24 hours, in the asset's units.\n* A deposit made by a rule's own transfer or swap can fire the next rule; such a chain stops after 3 runs, and a wallet's swap rules may not form a loop.\n* A rule whose swap was refunded or failed switches itself off (`rule.paused`) with the reason, because the refund arrives as a deposit of the same asset.\n* An unreadable network or a provider with no quote is tried again, 6 attempts with waits doubling from one minute; then the run fails (`rule.failed`). A send whose network fee cannot be paid fails at once.\n* `POST .../rules/preview` tries a rule on a deposit before it is made.\n\n## Network fee in the token\n\nA token transfer on an EVM network (Ethereum, BSC, Polygon, Arbitrum, Optimism, Base, Avalanche) or TRON can pay its network fee in the token itself, so an address that holds only USDT or USDC can send. `fee_in_asset` in `GET /v1/wallet-assets` tells which assets take the mode.\n\n1. `POST .../transfers/fee-quote` with `asset_id`, `to_address`, `amount` answers the `fee` in the token. `needed: false` means the address already holds the coin for this transfer: it goes as an ordinary one and nothing is added.\n2. `POST .../transfers` with `fee_in_asset: true` and, to cap the fee, `max_fee`. The fee is counted again at that moment; above `max_fee` the answer is `409 fee_changed` and nothing is queued. The address must hold `amount` + `fee` of the token.\n3. The platform's fee wallet sends the network's coin to the address. When that is confirmed the transfer goes out; when the transfer is final, a second transfer of the wallet (`purpose: fee`) pays the fee in the token. `fee_send` on the transfer shows the three steps and their transaction hashes.\n\n* The fee is the coin the two transfers need (estimated on the network with a margin, less what the address holds) plus the cost of delivering it, at CoinGecko prices, plus `markup_percent`; it is rounded up to 6 decimal places. The coin the transfers did not burn stays on the address and lowers the next fee.\n* One at a time per address: a `fee_in_asset` transfer is refused with `409 address_busy` while the address has a transfer that is not final, and until its fee is paid other transfers from the address wait in the queue.\n* The fee is taken once the coin was delivered, also when the transfer itself then fails on chain. When the coin is not confirmed on the address within an hour, the transfer fails (`transfer.failed`) and nothing is charged.\n* A fee transfer that fails is made again, 3 in all two minutes apart; then the address is free, the fee is owed (`fee_send.status: fee_unpaid`) and collected hourly for a day, and until it is paid the account's `fee_in_asset` transfers answer `409 fee_unpaid`.\n* An API key's daily limit counts the amount and the fee. Such a transfer never waits for approval, because the coin would already be on its way: over the limit it answers `422 policy_limit`, and under `address_book_only` a recipient that is not an active address-book entry answers `422 policy_hold`.\n* `503 fee_station_empty`: the fee wallet lacks the network's coin now; send later or pay the fee in the coin.\n* The delivered coin arrives as an ordinary deposit of the address (`deposit.detected`, `deposit.confirmed`) marked `fee_topup: true`; wallet rules do not react to it.\n* Swaps and wallet rules pay their network fees in the coin.\n* **TRON energy.** When renting the energy costs less than burning TRX for it, the fee wallet rents it from TronSave for an hour once the delivery is confirmed (the quote's `energy`), and the fee counts the rent instead of the burn. The transfer waits until the energy is on the address. When the rental is refused, or no energy arrives within two minutes, the fee wallet delivers the TRX the network then burns (`fee_send.burn_topup`) and the transfer goes once that is confirmed; the fee stays as quoted.\n\n## Test mode\n\nEvery account has a test mode on the same server (`api.kryptr.io`), kept apart from the live one like Stripe's sandbox keys: its own wallets, API keys, webhooks, address book, rules and history, on a **simulated network**. Nothing of it is signed or broadcast, and no real coins move.\n\n* **API**: a `pk_test_`/`sk_test_` key works on test-mode data only, a `pk_live_`/`sk_live_` key on live data only. Make test keys in the dashboard in test mode.\n* **Dashboard**: the header `X-Kryptr-Mode: test` switches every data route to test mode; sign-in, 2FA, the password and sessions stay the account's.\n* **Deposits**: `POST /api/v1/wallets/{id}/test-deposits` (or the dashboard route) credits a test wallet: `deposit.detected` at once, `deposit.confirmed` 5 to 15 seconds later. The sender is screened against the OFAC SDN list like a real one, so a listed address also gives `deposit.flagged`. Up to 1,000 a day per account, at most 1,000,000,000 each.\n* **Transfers**: a test wallet sends from its simulated balance with no network fee; a transfer to another test wallet's address arrives as its deposit, one to any other address leaves the simulated network. A transfer the balance no longer covers fails as on a real network.\n* **Swaps**: quoted by the provider `test` at CoinGecko's prices less 0.5 % and completed once the deposit is sent; the payout arrives as a deposit to the wallet's address on the target network.\n* **Marks**: wallets carry `livemode: false`, and every webhook body has `livemode` (`false` for test-mode events).\n* **Limits**: a live wallet cannot send to a test address (`422 test_mode_address`); a simulated deposit to a live wallet answers `409 live_wallet`. The real networks themselves are not exercised: confirmation times, fees and node errors are not simulated.\n\n## Webhooks and callbacks\n\nEvents go to every registered webhook endpoint (signed with that endpoint's secret) and to the object's own `callback_url` (wallet, transfer or swap; signed with the account's callback secret, `GET /api/v1/account/callback-secret`).\n\nEach delivery is a `POST` with the JSON body `{\"id\", \"type\", \"created_at\", \"livemode\", \"data\"}` (`livemode` is `false` for test-mode events) and the headers:\n\n* `X-CryptoEqu-Event`: the event type;\n* `X-CryptoEqu-Timestamp`: RFC3339 time of the delivery;\n* `X-CryptoEqu-Signature`: hex `HMAC-SHA256(secret, \"<timestamp>.<body>\")`.\n\nAnswer `2xx`. Failed deliveries are retried with exponential backoff, 12 attempts; the same event keeps its `id` across retries, so dedupe by it. Callback URLs must be `https` and resolve to public addresses.\n\n| Event | When | `data` |\n|---|---|---|\n| `wallet.created` | a wallet was created | Wallet |\n| `wallet.deleted` | a wallet was soft-deleted | Wallet |\n| `wallet.mnemonic_exported` | the seed phrase was exported | `{wallet_id, exported_at}` |\n| `deposit.detected` | an incoming transfer to a wallet was seen on chain | Deposit |\n| `deposit.confirmed` | it reached the network's confirmations | Deposit |\n| `deposit.failed` | it failed or was dropped from the chain | Deposit |\n| `deposit.flagged` | its sender is on the OFAC SDN list (sent after `deposit.detected`) | Deposit |\n| `transfer.created` | a transfer was queued, or held for approval (`status: awaiting_approval`) | Transfer |\n| `transfer.approved` | the owner approved a held transfer; it is queued | Transfer |\n| `transfer.sent` | it was broadcast (`tx_hash` set) | Transfer |\n| `transfer.confirmed` | it reached the network's confirmations | Transfer |\n| `transfer.failed` | it was rejected, failed on chain or expired | Transfer |\n| `swap.created` | a swap was started | Swap |\n| `swap.processing` | its deposit is on chain | Swap |\n| `swap.completed` | the provider paid out (`amount_out`, `payout_tx`) | Swap |\n| `swap.refunded` | the provider refunded the deposit | Swap |\n| `swap.failed` | a transaction of the wallet failed, or the provider gave up | Swap |\n| `rule.executed` | a rule made its transfer or swap for a deposit (`transfer_id` or `swap_id`) | RuleRun |\n| `rule.failed` | a rule could not make it (`reason`) | RuleRun |\n| `rule.paused` | a rule switched itself off after its swap was refunded or failed (`paused_reason`) | Rule |\n\nConfirmations required: Ethereum 12, BSC 15, Polygon 20, Arbitrum One 40, Optimism 10, Base 10, Avalanche 3, TRON 19 (solidified), Bitcoin 2, Litecoin 6, TON 1.\n\n## AI agents (MCP)\n\n`kryptr-mcp` is a local MCP server for Claude, Cursor and any MCP client: `npx -y kryptr-mcp` with `KRYPTR_API_KEY` and `KRYPTR_API_SECRET` of a key made for the agent in its environment. It signs these same requests on the user's machine. The agent reads the key's budget (`GET /api/v1/key`), wallets, balances, deposits and transfers, sends with an idempotency key and swaps. The key's scopes and spending policy are enforced here, by the API: a transfer over the daily limit or outside the address book is stored as `awaiting_approval`, a swap over the limit answers `422 policy_limit`. No tool touches a seed phrase; `KRYPTR_MCP_READ_ONLY=1` leaves out every tool that sends.\n\n## Errors\n\nErrors are `{\"error\": {\"code\", \"message\"}}` with the HTTP status: `400 bad_request | invalid_amount | invalid_address | unsupported_asset | same_asset | invalid_rule | fee_in_asset_unsupported`, `401 unauthorized | replayed_request`, `403 forbidden | insufficient_scope`, `404 not_found`, `409 wallet_deleted | external_id_taken | idempotency_conflict | quote_expired | quote_used | swap_in_progress | not_awaiting_approval | duplicate | rule_exists | rule_loop | fee_changed | address_busy | fee_unpaid | live_wallet`, `404 quote_not_found`, `422 no_route`, `422 insufficient_funds | transfer_would_fail | sanctioned_address | policy_limit | policy_hold | test_mode_address`, `429 too_many_requests | test_deposit_limit`, `502 network_unavailable | provider_unavailable | provider_refused | prices_unavailable`, `503 unavailable | fee_station_empty | fee_in_asset_unavailable`.\n\nAuth errors: `400 captcha_required | captcha_invalid` (the public auth routes need an hCaptcha token).\n"
  },
  "servers": [
    {
      "url": "/",
      "description": "This origin"
    },
    {
      "url": "https://api.kryptr.io",
      "description": "Production API"
    },
    {
      "url": "http://localhost:8080",
      "description": "Local backend"
    }
  ],
  "tags": [
    {
      "name": "Wallets",
      "description": "Multi-currency seed wallets (Merchant API, HMAC-signed)"
    },
    {
      "name": "Transfers",
      "description": "Sending funds from a wallet"
    },
    {
      "name": "Swaps",
      "description": "Exchanging one asset of a wallet for another (THORChain, LI.FI; SideShift when no protocol quotes)"
    },
    {
      "name": "Dashboard wallets",
      "description": "The same wallet operations for the web app (JWT)"
    },
    {
      "name": "Public",
      "description": "No authentication required"
    },
    {
      "name": "Dashboard",
      "description": "JWT bearer auth: the web app"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Session token from `POST /v1/auth/login`, sent with `X-Session-Timestamp` and `X-Session-Proof` signed by the session key (see *Dashboard sessions*)."
      },
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Public API key (`pk_live_…`). Sent with the X-Timestamp and X-Signature headers."
      }
    },
    "parameters": {
      "XTimestamp": {
        "name": "X-Timestamp",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "format": "date-time"
        },
        "description": "RFC3339 with milliseconds, within 5 minutes of the server clock"
      },
      "XSignature": {
        "name": "X-Signature",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "hex HMAC-SHA256(secret, \"<ts>.<METHOD>.<path[?query]>.<body>\"); each signature is accepted once"
      },
      "TransferIdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "maxLength": 128
        },
        "description": "Your unique id for this transfer. A retry with the same key and parameters returns the first transfer (200); the same key with other parameters is 409"
      },
      "WalletID": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "default": 50,
          "maximum": 200
        }
      },
      "Offset": {
        "name": "offset",
        "in": "query",
        "schema": {
          "type": "integer",
          "default": 0
        }
      },
      "SwapIdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "maxLength": 128
        },
        "description": "Your unique id for this swap. A retry with the same key and quote returns the first swap (200); the same key with another quote is 409"
      },
      "KryptrMode": {
        "name": "X-Kryptr-Mode",
        "in": "header",
        "required": false,
        "description": "test: work on the account's test-mode data (Test mode); live or absent: live data",
        "schema": {
          "type": "string",
          "enum": [
            "live",
            "test"
          ]
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "example": "insufficient_funds"
              },
              "message": {
                "type": "string",
                "example": "insufficient funds: 0 ETH available"
              }
            }
          }
        }
      },
      "RegisterRequest": {
        "type": "object",
        "required": [
          "email",
          "password",
          "name",
          "hcaptcha_token"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "example": "m@shop.com"
          },
          "password": {
            "type": "string",
            "format": "password",
            "minLength": 10,
            "description": "10 characters to 72 bytes, letters and digits."
          },
          "name": {
            "type": "string",
            "example": "Shop",
            "maxLength": 100,
            "description": "Up to 100 characters; links are refused."
          },
          "hcaptcha_token": {
            "type": "string",
            "description": "hCaptcha response token from the widget rendered with `hcaptcha_sitekey` (`GET /v1/auth/config`). Each token is checked once; get a new one for every request."
          }
        }
      },
      "LoginRequest": {
        "type": "object",
        "required": [
          "email",
          "password",
          "hcaptcha_token"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "example": "m@shop.com"
          },
          "password": {
            "type": "string",
            "format": "password"
          },
          "totp_code": {
            "type": "string",
            "example": "123456",
            "description": "The 6-digit code of the account's authenticator. Every session needs one: sign in without it first to learn whether to enter a code (`totp_required`) or to set up the authenticator (`totp_setup_required`)."
          },
          "hcaptcha_token": {
            "type": "string",
            "description": "hCaptcha response token from the widget rendered with `hcaptcha_sitekey` (`GET /v1/auth/config`). Each token is checked once; get a new one for every request."
          },
          "session_key": {
            "type": "string",
            "description": "Required with `totp_code`: base64 of the DER SubjectPublicKeyInfo of an ECDSA P-256 public key. The session is bound to it, and every dashboard request is signed with its private key (see *Dashboard sessions*)."
          }
        }
      },
      "AuthResponse": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "JWT bearer token"
          },
          "merchant": {
            "$ref": "#/components/schemas/Merchant"
          },
          "totp_required": {
            "type": "boolean",
            "description": "Only `true`, with no token, when 2FA is on and `totp_code` was not sent"
          },
          "totp_setup_required": {
            "type": "boolean",
            "description": "Only `true`, with no token, for an account without 2FA: add `totp_secret` (or scan `otpauth_url`) in an authenticator app, then sign in again with a code from it, which turns 2FA on. Each such answer replaces the previous unconfirmed secret."
          },
          "totp_secret": {
            "type": "string",
            "description": "Base32 authenticator key, with `totp_setup_required`"
          },
          "otpauth_url": {
            "type": "string",
            "description": "`otpauth://totp/...` URL for a QR code, with `totp_setup_required`"
          }
        },
        "description": "A session (`token` and `merchant`), or one of the 2FA steps before it"
      },
      "Merchant": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "name": {
            "type": "string"
          },
          "is_admin": {
            "type": "boolean"
          },
          "totp_enabled": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended"
            ]
          }
        }
      },
      "ApiKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "label": {
            "type": "string",
            "example": "Production server"
          },
          "public_key": {
            "type": "string",
            "example": "pk_live_…"
          },
          "secret_key": {
            "type": "string",
            "example": "sk_live_…",
            "description": "Returned once, on creation"
          },
          "secret_preview": {
            "type": "string",
            "example": "sk_live_1a2b...9f0e"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "wallets:read",
                "wallets:write",
                "wallets:transfer",
                "wallets:swap",
                "wallets:mnemonic"
              ]
            }
          },
          "revoked": {
            "type": "boolean"
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "policy": {
            "$ref": "#/components/schemas/KeyPolicy"
          }
        }
      },
      "WebhookEndpoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "secret": {
            "type": "string",
            "description": "Signing secret of this endpoint (X-CryptoEqu-Signature)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "active": {
            "type": "boolean"
          }
        }
      },
      "WebhookDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "event_type": {
            "type": "string",
            "example": "deposit.confirmed"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "delivered",
              "failed"
            ]
          },
          "attempts": {
            "type": "integer"
          },
          "last_status_code": {
            "type": "integer",
            "example": 200,
            "description": "0 before the first attempt"
          },
          "last_error": {
            "type": "string",
            "description": "Empty when the last attempt succeeded"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WalletAsset": {
        "type": "object",
        "properties": {
          "asset_id": {
            "type": "string",
            "example": "USDT.tron"
          },
          "symbol": {
            "type": "string",
            "example": "USDT"
          },
          "name": {
            "type": "string",
            "example": "USDT"
          },
          "network": {
            "type": "string",
            "example": "tron"
          },
          "native": {
            "type": "boolean",
            "example": false
          },
          "decimals": {
            "type": "integer",
            "example": 6
          },
          "contract": {
            "type": "string",
            "example": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
          },
          "confirmations": {
            "type": "integer",
            "example": 19
          },
          "transfer": {
            "type": "boolean",
            "description": "Whether the wallet can send this asset (TON jettons cannot yet)",
            "example": true
          },
          "fee_in_asset": {
            "type": "boolean",
            "example": true,
            "description": "Whether a transfer of this asset can pay its network fee in the asset"
          }
        }
      },
      "CreateApiKeyRequest": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "maxLength": 100,
            "example": "Wallet backend"
          },
          "live": {
            "type": "boolean",
            "deprecated": true,
            "description": "Ignored: the dashboard's mode decides. Keys made in test mode (`X-Kryptr-Mode: test`) are pk_test_/sk_test_, all others pk_live_/sk_live_"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "wallets:read",
                "wallets:write",
                "wallets:transfer",
                "wallets:swap",
                "wallets:mnemonic"
              ]
            },
            "description": "Omitted or empty: every scope except wallets:mnemonic",
            "example": [
              "wallets:read",
              "wallets:write",
              "wallets:transfer",
              "wallets:swap"
            ]
          },
          "password": {
            "type": "string",
            "format": "password",
            "description": "Account password; also required when scopes include wallets:transfer, wallets:swap or wallets:mnemonic (the default scopes include both wallets:transfer and wallets:swap)"
          },
          "totp_code": {
            "type": "string",
            "example": "123456",
            "description": "2FA code; required for every key"
          },
          "daily_limit_usd": {
            "type": "string",
            "nullable": true,
            "example": "1000",
            "description": "Daily limit in US dollars (decimal string); omitted or empty: no limit"
          },
          "address_book_only": {
            "type": "boolean",
            "description": "Hold transfers to addresses outside the address book for approval"
          }
        }
      },
      "WalletAddress": {
        "type": "object",
        "properties": {
          "network": {
            "type": "string",
            "enum": [
              "ethereum",
              "bsc",
              "polygon",
              "arbitrum",
              "optimism",
              "base",
              "avalanche",
              "tron",
              "bitcoin",
              "litecoin",
              "ton"
            ],
            "example": "tron"
          },
          "address": {
            "type": "string",
            "example": "TEcjzW2joBQo4t7Ek23TXDeCTLZzsqZK7o"
          },
          "derivation_path": {
            "type": "string",
            "example": "m/44'/195'/0'/0/0"
          },
          "assets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "TRX.tron",
              "USDT.tron"
            ]
          }
        }
      },
      "Wallet": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "example": "Main"
          },
          "livemode": {
            "type": "boolean",
            "description": "false for a test-mode wallet on the simulated network"
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "example": "user-42",
            "description": "Your own reference, unique among your live wallets"
          },
          "callback_url": {
            "type": "string",
            "example": "https://api.example.com/kryptr/callback"
          },
          "addresses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WalletAddress"
            }
          },
          "deleted": {
            "type": "boolean",
            "example": false
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time",
            "description": "Set for a soft-deleted wallet"
          },
          "mnemonic_exported_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last seed phrase export"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "origin": {
            "type": "string",
            "enum": [
              "created",
              "imported"
            ],
            "description": "`created`: kryptr.io generated the seed phrase; `imported`: you brought an existing one"
          },
          "backup_status": {
            "type": "string",
            "enum": [
              "none",
              "exported",
              "verified"
            ],
            "description": "`verified` once you proved holding a copy of the seed phrase (the dashboard's words check after an export, an import, or an export over the API); `exported` when it was shown but never confirmed; `none` otherwise. The dashboard keeps reminding until it is `verified`."
          },
          "backup_verified_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the backup was confirmed"
          },
          "backup_method": {
            "type": "string",
            "enum": [
              "quiz",
              "imported",
              "api_export"
            ],
            "description": "How the backup was confirmed"
          }
        }
      },
      "CreateWalletRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100,
            "example": "Main"
          },
          "external_id": {
            "type": "string",
            "maxLength": 128,
            "example": "user-42",
            "description": "Idempotency: a repeated create with the same external_id returns the existing live wallet with 200"
          },
          "callback_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "example": "https://api.example.com/kryptr/callback",
            "description": "Receives this object's events, signed with the callback secret"
          }
        }
      },
      "UpdateWalletRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "callback_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "example": "https://api.example.com/kryptr/callback",
            "description": "Empty string removes it"
          }
        }
      },
      "WalletList": {
        "type": "object",
        "properties": {
          "wallets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Wallet"
            }
          },
          "total": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "WalletBalance": {
        "type": "object",
        "properties": {
          "asset_id": {
            "type": "string",
            "example": "USDT.bsc"
          },
          "symbol": {
            "type": "string",
            "example": "USDT"
          },
          "name": {
            "type": "string",
            "example": "USDT"
          },
          "network": {
            "type": "string",
            "example": "bsc"
          },
          "address": {
            "type": "string"
          },
          "amount": {
            "type": "string",
            "example": "125.5",
            "description": "On-chain balance in whole units; Bitcoin and Litecoin count confirmed funds only. Empty when error is set"
          },
          "error": {
            "type": "string",
            "description": "The network's API could not be read"
          }
        }
      },
      "WalletBalances": {
        "type": "object",
        "properties": {
          "wallet_id": {
            "type": "string",
            "format": "uuid"
          },
          "balances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WalletBalance"
            }
          },
          "read_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Deposit": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "wallet_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_id": {
            "type": "string"
          },
          "asset_id": {
            "type": "string",
            "example": "USDT.tron"
          },
          "network": {
            "type": "string",
            "example": "tron"
          },
          "tx_hash": {
            "type": "string"
          },
          "from_address": {
            "type": "string"
          },
          "to_address": {
            "type": "string"
          },
          "amount": {
            "type": "string",
            "example": "50"
          },
          "confirmations": {
            "type": "integer"
          },
          "confirmations_required": {
            "type": "integer",
            "example": 19
          },
          "status": {
            "type": "string",
            "enum": [
              "detected",
              "confirmed",
              "failed"
            ]
          },
          "seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "confirmed_at": {
            "type": "string",
            "format": "date-time"
          },
          "screening": {
            "type": "object",
            "description": "The sender addresses compared with the OFAC SDN list when the deposit was first seen",
            "properties": {
              "list": {
                "type": "string",
                "example": "OFAC SDN"
              },
              "result": {
                "type": "string",
                "enum": [
                  "no_match",
                  "match",
                  ""
                ],
                "description": "empty: not checked (seen before screening or the list could not be read)"
              },
              "match": {
                "type": "string",
                "description": "The listed address, its SDN entry and the list date"
              }
            }
          },
          "fee_topup": {
            "type": "boolean",
            "description": "Present and true when the deposit is network coin the platform's fee wallet delivered for a transfer that pays its fee in the token (its tx_hash is that transfer's fee_send.topup.tx_hash), not a payment from outside"
          }
        }
      },
      "Mnemonic": {
        "type": "object",
        "properties": {
          "wallet_id": {
            "type": "string",
            "format": "uuid"
          },
          "mnemonic": {
            "type": "string",
            "example": "word1 word2 … word24"
          },
          "word_count": {
            "type": "integer",
            "example": 24
          },
          "passphrase": {
            "type": "string",
            "example": "",
            "description": "BIP-39 passphrase: always empty"
          },
          "derivation_paths": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "example": {
              "ethereum": "m/44'/60'/0'/0/0",
              "tron": "m/44'/195'/0'/0/0",
              "bitcoin": "m/84'/0'/0'/0/0",
              "litecoin": "m/84'/2'/0'/0/0",
              "ton": "m/44'/607'/0'"
            }
          },
          "ton_wallet": {
            "type": "string",
            "example": "v4r2"
          },
          "warning": {
            "type": "string"
          },
          "backup_token": {
            "type": "string",
            "description": "Dashboard exports only: pass it to `POST /v1/dashboard/wallets/{id}/backup` after the words check, within 30 minutes"
          }
        }
      },
      "DashboardMnemonicRequest": {
        "type": "object",
        "required": [
          "password",
          "totp_code"
        ],
        "properties": {
          "password": {
            "type": "string",
            "format": "password"
          },
          "totp_code": {
            "type": "string",
            "example": "123456",
            "description": "2FA code"
          }
        }
      },
      "TransferRequest": {
        "type": "object",
        "required": [
          "asset_id",
          "to_address",
          "amount"
        ],
        "properties": {
          "asset_id": {
            "type": "string",
            "example": "USDT.tron",
            "description": "An asset of the wallet's networks (GET /v1/wallet-assets); TON wallets send TON only"
          },
          "to_address": {
            "type": "string",
            "example": "TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf",
            "description": "Checked per network: EIP-55 checksum when mixed case, TRON checksum, Bitcoin and Litecoin bech32/base58 checksums, TON friendly-form CRC"
          },
          "amount": {
            "type": "string",
            "example": "25.5",
            "description": "Whole units, at most the asset's decimals"
          },
          "callback_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "example": "https://api.example.com/kryptr/callback",
            "description": "Receives this transfer's events; defaults to the wallet's callback_url"
          },
          "fee_in_asset": {
            "type": "boolean",
            "default": false,
            "description": "Pay the network fee in the asset when the address lacks the network's coin (see *Network fee in the token*). A token on an EVM network or TRON; `fee_in_asset` of GET /v1/wallet-assets tells which."
          },
          "max_fee": {
            "type": "string",
            "example": "6",
            "description": "With `fee_in_asset`: the most the fee may be, in the asset. A higher fee answers `409 fee_changed` and nothing is queued."
          }
        }
      },
      "Transfer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "wallet_id": {
            "type": "string",
            "format": "uuid"
          },
          "asset_id": {
            "type": "string",
            "example": "USDT.tron"
          },
          "network": {
            "type": "string",
            "example": "tron"
          },
          "from_address": {
            "type": "string"
          },
          "to_address": {
            "type": "string"
          },
          "amount": {
            "type": "string",
            "example": "25.5"
          },
          "status": {
            "type": "string",
            "enum": [
              "awaiting_approval",
              "held",
              "pending",
              "broadcasting",
              "sent",
              "confirmed",
              "failed"
            ],
            "description": "awaiting_approval: an API key's transfer that broke the key's policy, waiting for the owner (hold_reason says why); held: a swap leg waiting for the leg before it, or a `fee_in_asset` transfer waiting for the network's coin; pending: queued; broadcasting: being signed and sent; sent: on the network, tx_hash set; confirmed / failed: final"
          },
          "tx_hash": {
            "type": "string"
          },
          "confirmations": {
            "type": "integer"
          },
          "failure_reason": {
            "type": "string"
          },
          "idempotency_key": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "sent_at": {
            "type": "string",
            "format": "date-time"
          },
          "confirmed_at": {
            "type": "string",
            "format": "date-time"
          },
          "purpose": {
            "type": "string",
            "enum": [
              "transfer",
              "approve",
              "approve_reset",
              "swap_deposit",
              "fee",
              "fee_topup",
              "energy_rent"
            ],
            "description": "transfer: sent by you; the others are a swap's legs: a token allowance for the swap router (approve, approve_reset sets it to zero first) and the deposit; fee: the network fee of a `fee_in_asset` transfer, paid in the asset after it; fee_topup and energy_rent appear only in the platform's fee wallet: the coin it delivers and its payment for TRON energy"
          },
          "swap_id": {
            "type": "string",
            "format": "uuid",
            "description": "Set on a swap's legs"
          },
          "memo": {
            "type": "string",
            "description": "TON text comment, when the deposit needs one"
          },
          "api_key_id": {
            "type": "string",
            "format": "uuid",
            "description": "The API key that sent it"
          },
          "hold_reason": {
            "type": "string",
            "description": "Why it waits for approval"
          },
          "approved_at": {
            "type": "string",
            "format": "date-time"
          },
          "fee_send_id": {
            "type": "string",
            "format": "uuid",
            "description": "Set on a transfer that pays its network fee in the asset, and on its fee transfer"
          },
          "fee_send": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FeeSend"
              }
            ],
            "description": "In the answer of a single transfer (POST, GET by id) and in its events, when it has one"
          }
        }
      },
      "CallbackSecret": {
        "type": "object",
        "properties": {
          "callback_secret": {
            "type": "string",
            "example": "cbsec_…"
          }
        }
      },
      "TotpReplaceRequest": {
        "type": "object",
        "required": [
          "password",
          "totp_code"
        ],
        "properties": {
          "password": {
            "type": "string",
            "format": "password"
          },
          "totp_code": {
            "type": "string",
            "example": "123456",
            "description": "Code from the current authenticator"
          }
        }
      },
      "DashboardTransferRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/TransferRequest"
          },
          {
            "type": "object",
            "required": [
              "totp_code"
            ],
            "properties": {
              "totp_code": {
                "type": "string",
                "example": "123456",
                "description": "2FA code; each code works once"
              }
            }
          }
        ]
      },
      "ImportWalletRequest": {
        "type": "object",
        "required": [
          "mnemonic"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100,
            "example": "Trust Wallet"
          },
          "mnemonic": {
            "type": "string",
            "description": "A BIP-39 English seed phrase of 12, 15, 18, 21 or 24 words with a valid checksum. Case, line breaks and word numbers are ignored. No passphrase (25th word). Addresses follow the Trust Wallet derivation paths, so the wallet shows the same addresses as there.",
            "example": "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
          },
          "callback_url": {
            "type": "string",
            "example": "https://api.example.com/kryptr/callback"
          }
        }
      },
      "ConfirmBackupRequest": {
        "type": "object",
        "required": [
          "backup_token"
        ],
        "properties": {
          "backup_token": {
            "type": "string",
            "description": "`backup_token` from the dashboard seed phrase export"
          }
        }
      },
      "BackupDue": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer",
            "description": "Live wallets whose seed phrase backup is not confirmed"
          },
          "wallets": {
            "type": "array",
            "description": "The newest five of them",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "backup_status": {
                  "type": "string",
                  "enum": [
                    "none",
                    "exported"
                  ]
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          }
        }
      },
      "WalletExists": {
        "type": "object",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/Error/properties/error"
          },
          "wallet": {
            "$ref": "#/components/schemas/Wallet"
          }
        }
      },
      "Session": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "ip": {
            "type": "string",
            "description": "Address of the last request"
          },
          "country": {
            "type": "string",
            "description": "Country of the last request (Cloudflare's code), empty when unknown"
          },
          "user_agent": {
            "type": "string",
            "description": "Browser of the last request"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Sign-in time"
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time",
            "description": "Last request, to the minute"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "current": {
            "type": "boolean",
            "description": "The session that asked"
          }
        }
      },
      "SwapQuoteRequest": {
        "type": "object",
        "required": [
          "from_asset",
          "to_asset",
          "amount"
        ],
        "properties": {
          "from_asset": {
            "type": "string",
            "example": "USDT.bsc",
            "description": "Asset the wallet sends"
          },
          "to_asset": {
            "type": "string",
            "example": "USDC.polygon",
            "description": "Asset the wallet receives, on its own address on that network"
          },
          "amount": {
            "type": "string",
            "example": "20",
            "description": "Amount of from_asset"
          }
        }
      },
      "SwapQuote": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "wallet_id": {
            "type": "string",
            "format": "uuid"
          },
          "provider": {
            "type": "string",
            "enum": [
              "lifi",
              "thorchain",
              "sideshift"
            ]
          },
          "from_asset": {
            "type": "string",
            "example": "USDT.bsc"
          },
          "to_asset": {
            "type": "string",
            "example": "USDC.polygon"
          },
          "amount_in": {
            "type": "string",
            "example": "20"
          },
          "amount_out": {
            "type": "string",
            "example": "19.916666",
            "description": "Expected amount received, after the provider's fees"
          },
          "amount_out_min": {
            "type": "string",
            "example": "19.817082",
            "description": "The least the provider pays out; below it the swap is refunded"
          },
          "eta_seconds": {
            "type": "integer",
            "example": 39,
            "description": "The provider's estimate, 0 when it gives none"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "At most two minutes after the quote"
          }
        }
      },
      "SwapQuotes": {
        "type": "object",
        "properties": {
          "quotes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SwapQuote"
            },
            "description": "Best first (largest amount_out)"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              }
            },
            "description": "Providers that cover the pair but gave no quote, with their reason (e.g. an amount under their minimum)"
          }
        }
      },
      "CreateSwapRequest": {
        "type": "object",
        "required": [
          "quote_id"
        ],
        "properties": {
          "quote_id": {
            "type": "string",
            "format": "uuid"
          },
          "callback_url": {
            "type": "string",
            "format": "uri",
            "description": "https URL for this swap's swap.* events; defaults to the wallet's"
          }
        }
      },
      "DashboardCreateSwapRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CreateSwapRequest"
          },
          {
            "type": "object",
            "required": [
              "totp_code"
            ],
            "properties": {
              "totp_code": {
                "type": "string",
                "example": "123456",
                "description": "2FA code; each code works once"
              }
            }
          }
        ]
      },
      "Swap": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "wallet_id": {
            "type": "string",
            "format": "uuid"
          },
          "quote_id": {
            "type": "string",
            "format": "uuid"
          },
          "provider": {
            "type": "string",
            "enum": [
              "lifi",
              "thorchain",
              "sideshift"
            ]
          },
          "from_asset": {
            "type": "string"
          },
          "to_asset": {
            "type": "string"
          },
          "from_address": {
            "type": "string",
            "description": "The wallet's address that sends; refunds come back here"
          },
          "to_address": {
            "type": "string",
            "description": "The wallet's address that receives the payout"
          },
          "amount_in": {
            "type": "string",
            "description": "What the wallet sends (a THORChain reference can change the quote's last digits)"
          },
          "amount_out_expected": {
            "type": "string"
          },
          "amount_out_min": {
            "type": "string"
          },
          "amount_out": {
            "type": "string",
            "nullable": true,
            "description": "Received, once completed"
          },
          "deposit_address": {
            "type": "string",
            "description": "Where the wallet sends: the provider's deposit address or router contract"
          },
          "provider_ref": {
            "type": "string",
            "description": "SideShift shift id, THORChain memoless reference or LI.FI bridge"
          },
          "provider_ids": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "The provider's own identifiers of this swap, added as they become known: quote and order ids, its transaction id, the inbound and payout transactions, explorer links. Keys depend on the provider (SideShift: quote_id, shift_id, deposit_tx, settle_tx, refund_tx; THORChain: memo, memoless_reference, memoless_id, registration_tx, vault, inbound_tx, out_tx; LI.FI: quote_id, transaction_id, tool, sending_tx, receiving_tx, receiving_tx_link, lifi_explorer, bridge_explorer)"
          },
          "status": {
            "type": "string",
            "enum": [
              "awaiting_deposit",
              "processing",
              "completed",
              "refunded",
              "failed"
            ],
            "description": "awaiting_deposit: the wallet's transactions are queued; processing: the deposit is on chain, the provider swaps; completed / refunded / failed: final"
          },
          "deposit_tx": {
            "type": "string"
          },
          "payout_tx": {
            "type": "string",
            "description": "The provider's payout (or refund) transaction"
          },
          "failure_reason": {
            "type": "string"
          },
          "provider_status": {
            "type": "string"
          },
          "eta_seconds": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "deposit_sent_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "SwapList": {
        "type": "object",
        "properties": {
          "swaps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Swap"
            }
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "SwapEvent": {
        "type": "object",
        "description": "One entry of a swap's trail.",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "kind": {
            "type": "string",
            "enum": [
              "quote",
              "create",
              "create_failed",
              "leg",
              "provider_status",
              "provider_error",
              "status"
            ],
            "description": "quote: one provider's answer to the quote request (a refusal has `data.error`); create: the swap was started (`data.prepared` is the provider's deposit); create_failed: a start that stored no swap; leg: a transaction of the wallet changed status (`data.purpose`, `data.status`, `data.tx_hash`); provider_status / provider_error: a new answer of the provider (`data.provider_status`, `data.provider_ids`, `data.reads_since_last_entry`); status: the swap's own status changed"
          },
          "provider": {
            "type": "string"
          },
          "summary": {
            "type": "string",
            "description": "One line for people"
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The quote request the entry belongs to: every provider asked in it shares it"
          },
          "quote_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "swap_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "wallet_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "description": "What the operation carried; its keys depend on `kind`"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "KeyPolicy": {
        "type": "object",
        "description": "The key's spending policy (ADR-015). A transfer signed with the key that breaks it is stored with status `awaiting_approval` and waits for the owner's approval in the dashboard; a swap over the limit is refused with `422 policy_limit`.",
        "properties": {
          "daily_limit_usd": {
            "type": "string",
            "nullable": true,
            "example": "1000.00",
            "description": "What the key may send and swap in any 24 hours, in US dollars at CoinGecko prices; null: no limit"
          },
          "address_book_only": {
            "type": "boolean",
            "description": "Send only to address-book entries older than 24 hours; others wait for approval"
          }
        }
      },
      "SetKeyPolicyRequest": {
        "type": "object",
        "required": [
          "password",
          "totp_code"
        ],
        "properties": {
          "daily_limit_usd": {
            "type": "string",
            "nullable": true,
            "example": "1000",
            "description": "Daily limit in US dollars (decimal string); omitted or empty: no limit"
          },
          "address_book_only": {
            "type": "boolean"
          },
          "password": {
            "type": "string",
            "format": "password",
            "description": "Account password: a change can loosen the key"
          },
          "totp_code": {
            "type": "string",
            "example": "123456"
          }
        }
      },
      "AddressBookEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "network": {
            "type": "string",
            "example": "tron"
          },
          "address": {
            "type": "string",
            "description": "EVM addresses are stored lower-case"
          },
          "label": {
            "type": "string",
            "example": "Payroll"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "active_after": {
            "type": "string",
            "format": "date-time",
            "description": "Book-only keys may send to it from this time, 24 hours after it was added"
          }
        }
      },
      "AddAddressBookRequest": {
        "type": "object",
        "required": [
          "network",
          "address",
          "totp_code"
        ],
        "properties": {
          "network": {
            "type": "string",
            "example": "tron"
          },
          "address": {
            "type": "string"
          },
          "label": {
            "type": "string",
            "maxLength": 100
          },
          "totp_code": {
            "type": "string",
            "example": "123456"
          }
        }
      },
      "ApprovalRequest": {
        "type": "object",
        "required": [
          "totp_code"
        ],
        "properties": {
          "totp_code": {
            "type": "string",
            "example": "123456"
          }
        }
      },
      "Screening": {
        "type": "object",
        "properties": {
          "list": {
            "type": "string",
            "example": "OFAC SDN"
          },
          "source": {
            "type": "string",
            "format": "uri"
          },
          "addresses": {
            "type": "integer",
            "example": 1065
          },
          "list_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "loaded_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "OwnKey": {
        "type": "object",
        "description": "The API key that signed the request: its scopes, its spending policy and what it sent and swapped in the last 24 hours. An AI agent reads it to know its budget before it sends.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "label": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "wallets:read",
              "wallets:transfer"
            ]
          },
          "policy": {
            "$ref": "#/components/schemas/KeyPolicy"
          },
          "spent_usd_24h": {
            "type": "string",
            "nullable": true,
            "example": "42.10",
            "description": "Transfers (also those awaiting approval) and swaps of the last 24 hours in US dollars at CoinGecko prices; null when an asset has no price"
          },
          "remaining_usd": {
            "type": "string",
            "nullable": true,
            "example": "957.90",
            "description": "Daily limit minus spent_usd_24h, at least 0; null with no limit or no price"
          },
          "unpriced_asset": {
            "type": "string",
            "nullable": true,
            "description": "The asset with no USD price, when there is one"
          }
        }
      },
      "RuleRequest": {
        "type": "object",
        "required": [
          "asset_id",
          "action",
          "scope",
          "min_amount",
          "totp_code"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100,
            "example": "To treasury"
          },
          "asset_id": {
            "type": "string",
            "example": "USDT.tron",
            "description": "The asset whose confirmed deposits fire the rule. One rule per wallet and asset."
          },
          "action": {
            "type": "string",
            "enum": [
              "send",
              "swap"
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "deposit",
              "balance"
            ],
            "description": "`deposit`: the deposit's amount, at most what the address holds above keep_amount. `balance`: everything the address holds above keep_amount."
          },
          "to_address": {
            "type": "string",
            "description": "`send`: the recipient on the asset's network. Not the wallet's own address; checked against the OFAC SDN list when the rule is made, switched on and at each transfer."
          },
          "to_asset": {
            "type": "string",
            "example": "USDT.tron",
            "description": "`swap`: the asset the wallet receives. The wallet's swap rules may not form a loop."
          },
          "min_amount": {
            "type": "string",
            "example": "10",
            "description": "Above 0. A `deposit` rule ignores a smaller deposit; any rule moves nothing when what it would move is smaller."
          },
          "keep_amount": {
            "type": "string",
            "example": "0",
            "description": "What stays on the address. Above 0 for a network's own coin (TRX, ETH, …): it pays the network fee."
          },
          "daily_limit": {
            "type": "string",
            "example": "5000",
            "nullable": true,
            "description": "What the rule may move in any 24 hours, in the asset's units; a run that would pass it is skipped. null: no limit"
          },
          "totp_code": {
            "type": "string",
            "example": "123456"
          }
        }
      },
      "RulePreviewRequest": {
        "type": "object",
        "required": [
          "asset_id",
          "action",
          "scope",
          "min_amount",
          "deposit"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100,
            "example": "To treasury"
          },
          "asset_id": {
            "type": "string",
            "example": "USDT.tron",
            "description": "The asset whose confirmed deposits fire the rule. One rule per wallet and asset."
          },
          "action": {
            "type": "string",
            "enum": [
              "send",
              "swap"
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "deposit",
              "balance"
            ],
            "description": "`deposit`: the deposit's amount, at most what the address holds above keep_amount. `balance`: everything the address holds above keep_amount."
          },
          "to_address": {
            "type": "string",
            "description": "`send`: the recipient on the asset's network. Not the wallet's own address; checked against the OFAC SDN list when the rule is made, switched on and at each transfer."
          },
          "to_asset": {
            "type": "string",
            "example": "USDT.tron",
            "description": "`swap`: the asset the wallet receives. The wallet's swap rules may not form a loop."
          },
          "min_amount": {
            "type": "string",
            "example": "10",
            "description": "Above 0. A `deposit` rule ignores a smaller deposit; any rule moves nothing when what it would move is smaller."
          },
          "keep_amount": {
            "type": "string",
            "example": "0",
            "description": "What stays on the address. Above 0 for a network's own coin (TRX, ETH, …): it pays the network fee."
          },
          "daily_limit": {
            "type": "string",
            "example": "5000",
            "nullable": true,
            "description": "What the rule may move in any 24 hours, in the asset's units; a run that would pass it is skipped. null: no limit"
          },
          "deposit": {
            "type": "string",
            "example": "250",
            "description": "The deposit to try the rule on"
          }
        }
      },
      "RuleSwitchRequest": {
        "type": "object",
        "required": [
          "totp_code"
        ],
        "properties": {
          "totp_code": {
            "type": "string",
            "example": "123456"
          }
        }
      },
      "Rule": {
        "type": "object",
        "description": "What a wallet does by itself with a confirmed deposit of one asset (ADR-017). A rule is fixed once made, except `enabled`: to change it, delete it and make another.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "wallet_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "maxLength": 100,
            "example": "To treasury"
          },
          "asset_id": {
            "type": "string",
            "example": "USDT.tron",
            "description": "The asset whose confirmed deposits fire the rule. One rule per wallet and asset."
          },
          "action": {
            "type": "string",
            "enum": [
              "send",
              "swap"
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "deposit",
              "balance"
            ],
            "description": "`deposit`: the deposit's amount, at most what the address holds above keep_amount. `balance`: everything the address holds above keep_amount."
          },
          "to_address": {
            "type": "string",
            "description": "`send`: the recipient on the asset's network. Not the wallet's own address; checked against the OFAC SDN list when the rule is made, switched on and at each transfer."
          },
          "to_asset": {
            "type": "string",
            "example": "USDT.tron",
            "description": "`swap`: the asset the wallet receives. The wallet's swap rules may not form a loop."
          },
          "min_amount": {
            "type": "string",
            "example": "10",
            "description": "Above 0. A `deposit` rule ignores a smaller deposit; any rule moves nothing when what it would move is smaller."
          },
          "keep_amount": {
            "type": "string",
            "example": "0",
            "description": "What stays on the address. Above 0 for a network's own coin (TRX, ETH, …): it pays the network fee."
          },
          "daily_limit": {
            "type": "string",
            "example": "5000",
            "nullable": true,
            "description": "What the rule may move in any 24 hours, in the asset's units; a run that would pass it is skipped. null: no limit"
          },
          "enabled": {
            "type": "boolean"
          },
          "paused_reason": {
            "type": "string",
            "description": "Why the rule switched itself off: a swap it made was refunded or failed. Present only then."
          },
          "active_from": {
            "type": "string",
            "format": "date-time",
            "description": "When it was last switched on: only deposits confirmed from this time fire it"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RuleRun": {
        "type": "object",
        "description": "One deposit a rule looked at: each confirmed deposit gets exactly one run per rule.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "rule_id": {
            "type": "string",
            "format": "uuid"
          },
          "wallet_id": {
            "type": "string",
            "format": "uuid"
          },
          "deposit_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "done",
              "skipped",
              "failed"
            ],
            "description": "open: waiting or being retried (`reason` says for what). done: the transfer or swap was made; its own status says how it ended. skipped: the rule moved nothing (`reason`). failed: it could not make the transfer or swap (`reason`)."
          },
          "amount": {
            "type": "string",
            "nullable": true,
            "description": "What the run moved or tried to move"
          },
          "transfer_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "swap_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "reason": {
            "type": "string"
          },
          "attempts": {
            "type": "integer",
            "description": "Failed attempts so far; a run fails after 6"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "rule_name": {
            "type": "string",
            "description": "In the log only, like the fields below"
          },
          "action": {
            "type": "string",
            "enum": [
              "send",
              "swap"
            ]
          },
          "asset_id": {
            "type": "string"
          },
          "deposit_tx": {
            "type": "string"
          },
          "deposit_amount": {
            "type": "string"
          },
          "transfer_status": {
            "type": "string"
          },
          "transfer_tx": {
            "type": "string"
          },
          "swap_status": {
            "type": "string"
          }
        }
      },
      "RulePreview": {
        "type": "object",
        "properties": {
          "would": {
            "type": "string",
            "enum": [
              "send",
              "swap",
              "nothing"
            ]
          },
          "amount": {
            "type": "string",
            "example": "250"
          },
          "reason": {
            "type": "string",
            "description": "Why nothing would move"
          },
          "deposit": {
            "type": "string"
          },
          "balance": {
            "type": "string",
            "description": "What the address holds now, before the deposit"
          },
          "fee_coin": {
            "type": "string",
            "example": "TRX.tron",
            "description": "The coin that pays a token's network fee"
          },
          "fee_coin_balance": {
            "type": "string"
          },
          "fee_checked": {
            "type": "boolean",
            "description": "false when the address does not hold the amount yet, so the send's fee was not priced"
          },
          "fee_problem": {
            "type": "string",
            "description": "Why the send's network fee cannot be paid now"
          },
          "quotes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SwapQuote"
            },
            "description": "`swap`: the providers' quotes for the amount, best first"
          },
          "quote_errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "FeeQuoteRequest": {
        "type": "object",
        "required": [
          "asset_id",
          "to_address",
          "amount"
        ],
        "properties": {
          "asset_id": {
            "type": "string",
            "example": "USDT.tron"
          },
          "to_address": {
            "type": "string",
            "example": "TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf"
          },
          "amount": {
            "type": "string",
            "example": "25.5"
          }
        }
      },
      "FeeQuote": {
        "type": "object",
        "properties": {
          "asset_id": {
            "type": "string",
            "example": "USDT.tron"
          },
          "amount": {
            "type": "string",
            "example": "25.5"
          },
          "needed": {
            "type": "boolean",
            "description": "false: the address holds the network's coin for this transfer, it goes as an ordinary one and `fee` is 0"
          },
          "fee": {
            "type": "string",
            "example": "5.512",
            "description": "What the wallet pays in the asset on top of `amount`"
          },
          "total": {
            "type": "string",
            "example": "31.012",
            "description": "`amount` + `fee`: what the address must hold of the asset"
          },
          "coin": {
            "type": "string",
            "example": "TRX",
            "description": "The network's coin"
          },
          "coin_balance": {
            "type": "string",
            "example": "0",
            "description": "The coin the address holds now"
          },
          "topup_amount": {
            "type": "string",
            "example": "15.7784",
            "description": "The coin the address receives for its two transfers. With `needed: true`."
          },
          "station_cost": {
            "type": "string",
            "example": "1.37",
            "description": "What the delivery of that coin costs, in the coin. With `needed: true`."
          },
          "markup_percent": {
            "type": "string",
            "example": "15",
            "description": "Added to the cost. With `needed: true`."
          },
          "coin_usd": {
            "type": "string",
            "example": "0.29",
            "description": "The prices the fee is counted at (CoinGecko). With `needed: true`."
          },
          "asset_usd": {
            "type": "string",
            "example": "1"
          },
          "energy": {
            "type": "object",
            "description": "On TRON, when renting energy costs less than burning TRX for it: the energy rented for the two transfers. `topup_amount` then delivers only the coin the energy does not cover. With `needed: true`.",
            "properties": {
              "amount": {
                "type": "integer",
                "example": 154284,
                "description": "Energy units, rented for an hour"
              },
              "cost": {
                "type": "string",
                "example": "10.375599",
                "description": "The rent in TRX, counted into `fee`"
              },
              "provider": {
                "type": "string",
                "example": "tronsave"
              }
            }
          }
        }
      },
      "FeeSend": {
        "type": "object",
        "description": "A transfer that pays its network fee in the asset: the coin delivered to the address, the transfer, the fee",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "done",
              "failed",
              "fee_unpaid"
            ],
            "description": "open: in progress; done: the fee was paid; failed: the coin was not delivered, the transfer failed and nothing was charged; fee_unpaid: the coin was delivered and the fee could not be collected, it is tried again every hour for a day"
          },
          "asset_id": {
            "type": "string",
            "example": "USDT.tron"
          },
          "amount": {
            "type": "string",
            "example": "25.5"
          },
          "fee_amount": {
            "type": "string",
            "example": "5.512"
          },
          "coin": {
            "type": "string",
            "example": "TRX"
          },
          "topup_amount": {
            "type": "string",
            "example": "15.7784"
          },
          "markup_percent": {
            "type": "string",
            "example": "15"
          },
          "reason": {
            "type": "string",
            "description": "Why it failed or the fee is unpaid"
          },
          "fee_attempts": {
            "type": "integer",
            "description": "Fee transfers made so far"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time"
          },
          "topup": {
            "type": "object",
            "description": "The delivery of the coin",
            "properties": {
              "status": {
                "type": "string"
              },
              "tx_hash": {
                "type": "string"
              },
              "amount": {
                "type": "string"
              }
            }
          },
          "transfer_id": {
            "type": "string",
            "format": "uuid",
            "description": "The transfer to the recipient"
          },
          "fee": {
            "type": "object",
            "description": "The latest fee transfer (`purpose: fee` in the wallet's transfers)",
            "properties": {
              "transfer_id": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "type": "string"
              },
              "tx_hash": {
                "type": "string"
              },
              "failure_reason": {
                "type": "string"
              }
            }
          },
          "burn_topup": {
            "type": "object",
            "description": "On TRON, when the energy rental failed: the second delivery, of the TRX the network burns instead. The transfer waits for it.",
            "properties": {
              "status": {
                "type": "string"
              },
              "tx_hash": {
                "type": "string"
              },
              "amount": {
                "type": "string",
                "example": "15.4284"
              }
            }
          },
          "energy": {
            "type": "object",
            "description": "On TRON, the energy rented for the transfer and its fee transfer",
            "properties": {
              "amount": {
                "type": "integer",
                "example": 154284
              },
              "status": {
                "type": "string",
                "enum": [
                  "quoted",
                  "ordering",
                  "ordered",
                  "delivered",
                  "failed"
                ],
                "description": "quoted: ordered once the delivery is confirmed; ordering: the payment was handed to the provider and no answer came; ordered: the provider took the order; delivered: the energy is on the address and the transfer goes; failed: the rental was refused or no energy came within two minutes, so the TRX for the burn is delivered (`burn_topup`)"
              },
              "provider": {
                "type": "string",
                "example": "tronsave"
              },
              "order_id": {
                "type": "string",
                "description": "The provider's order id"
              },
              "payment_tx": {
                "type": "string",
                "description": "The fee wallet's TRX payment to the provider"
              },
              "error": {
                "type": "string"
              }
            }
          }
        }
      },
      "SimulateDepositRequest": {
        "type": "object",
        "required": [
          "asset_id",
          "amount"
        ],
        "properties": {
          "asset_id": {
            "type": "string",
            "example": "USDT.tron"
          },
          "amount": {
            "type": "string",
            "example": "100",
            "description": "Positive, at most the asset's decimals, at most 1000000000"
          },
          "from_address": {
            "type": "string",
            "description": "The simulated sender: any valid address of the asset's network; default test_sender. A sender on the OFAC SDN list gives deposit.flagged"
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid credentials",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Rate limited",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Not allowed",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unavailable": {
        "description": "The rate limiter or the captcha check is unreachable: the request is refused, try again later",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  },
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "Health check",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/wallet-assets": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "Assets a wallet holds",
        "responses": {
          "200": {
            "description": "Assets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "assets": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WalletAsset"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallets": {
      "post": {
        "tags": [
          "Wallets"
        ],
        "summary": "Create a wallet",
        "description": "Generates a new seed phrase and derives its addresses.\n\nScope: `wallets:write`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "A live wallet with this external_id already exists; returned as is",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "201": {
            "description": "Wallet created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "400": {
            "description": "Bad name, external_id or callback_url",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "external_id is taken",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWalletRequest"
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Wallets"
        ],
        "summary": "List wallets",
        "description": "Scope: `wallets:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "include_deleted",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Also list soft-deleted wallets"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "Wallets, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletList"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallets/{id}": {
      "get": {
        "tags": [
          "Wallets"
        ],
        "summary": "Get a wallet",
        "description": "Scope: `wallets:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "Wallet (deleted ones too)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Wallets"
        ],
        "summary": "Rename a wallet or change its callback URL",
        "description": "Scope: `wallets:write`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "Updated wallet",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The wallet is deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWalletRequest"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Wallets"
        ],
        "summary": "Delete a wallet (soft)",
        "description": "Soft delete: the wallet keeps its data and seed phrase, stops being watched and cannot send. Deleting a deleted wallet returns it unchanged.\n\nScope: `wallets:write`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted wallet (deleted_at set)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallets/{id}/balances": {
      "get": {
        "tags": [
          "Wallets"
        ],
        "summary": "Wallet balances",
        "description": "Reads every asset's balance from the chains now (no cache). A network whose API fails is listed with `error`.\n\nScope: `wallets:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "Balances",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletBalances"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallets/{id}/deposits": {
      "get": {
        "tags": [
          "Wallets"
        ],
        "summary": "Wallet deposits",
        "description": "Incoming transfers seen by the watcher.\n\nScope: `wallets:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "name": "network",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ethereum",
                "bsc",
                "polygon",
                "arbitrum",
                "optimism",
                "base",
                "avalanche",
                "tron",
                "bitcoin",
                "litecoin",
                "ton"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "Incoming transfers, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deposits": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Deposit"
                      }
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallets/{id}/test-deposits": {
      "post": {
        "tags": [
          "Wallets"
        ],
        "summary": "Simulate a deposit (test mode)",
        "description": "Credits a test-mode wallet on the simulated network: `deposit.detected` now, `deposit.confirmed` 5 to 15 seconds later. See *Test mode*.\n\nScope: `wallets:write`; a `pk_test_` key.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SimulateDepositRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The simulated deposit, detected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deposit"
                }
              }
            }
          },
          "400": {
            "description": "invalid_amount, unsupported_asset or invalid_address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "live_wallet: the wallet is a live one; wallet_deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "test_deposit_limit: 1,000 simulated deposits in 24 hours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallets/{id}/mnemonic": {
      "post": {
        "tags": [
          "Wallets"
        ],
        "summary": "Export the seed phrase",
        "description": "Returns the wallet's seed phrase (24 words, or as many as an imported one has). Rate limited (10 an hour per account), written to the audit log, announced with `wallet.mnemonic_exported`. Works for deleted wallets too. The response has `Cache-Control: no-store`. An export over the API counts as the wallet's backup (`backup_status: verified`).\n\nScope: `wallets:mnemonic`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "Seed phrase",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Mnemonic"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallets/{id}/transfers": {
      "post": {
        "tags": [
          "Transfers"
        ],
        "summary": "Send funds from a wallet",
        "description": "Checks the address and the on-chain balance, then queues the transfer; a worker signs and broadcasts it. Follow it with `GET /api/v1/transfers/{id}` or the `transfer.*` events. The network fee is paid by the wallet in the network's coin. With `fee_in_asset: true` a token transfer on an EVM network or TRON pays its fee in the token (see *Network fee in the token*).\n\nScope: `wallets:transfer`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/TransferIdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "Retry with the same Idempotency-Key: the first transfer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transfer"
                }
              }
            }
          },
          "201": {
            "description": "Transfer queued, or stored with status `awaiting_approval` when it breaks the key's policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transfer"
                }
              }
            }
          },
          "400": {
            "description": "Bad amount, address or asset, or no Idempotency-Key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Wallet deleted, or Idempotency-Key reused with other parameters; with `fee_in_asset`: `fee_changed` (the fee is above `max_fee`), `address_busy` (the address has a transfer that is not final), `fee_unpaid` (an earlier transfer's fee is still owed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "`insufficient_funds`: the wallet lacks the amount, or the network coin for the fee of a TRON token transfer; `transfer_would_fail`: a dry run of the TRON token transfer fails on chain; `sanctioned_address`: the recipient is on the OFAC SDN list; with `fee_in_asset` and an API key under a policy: `policy_limit` (amount and fee are over the daily limit), `policy_hold` (the recipient is outside the address book)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The network's API could not be read; `prices_unavailable`: the prices a fee in the asset is counted at could not be read",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "With `fee_in_asset`: `fee_station_empty` (the fee wallet lacks the network's coin now, Retry-After: 600), `fee_in_asset_unavailable` (the mode is off)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransferRequest"
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Transfers"
        ],
        "summary": "List a wallet's transfers",
        "description": "Scope: `wallets:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "Transfers, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "transfers": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Transfer"
                      }
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallets/{id}/transfers/fee-quote": {
      "post": {
        "tags": [
          "Transfers"
        ],
        "summary": "Quote the network fee in the token",
        "description": "Prices a token transfer that pays its network fee in the token (see *Network fee in the token*). Nothing is stored: the fee is counted again when the transfer is made, so cap it there with `max_fee`.\n\nScope: `wallets:transfer`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FeeQuoteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The fee",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeeQuote"
                }
              }
            }
          },
          "400": {
            "description": "Bad amount, address or asset; `fee_in_asset_unsupported`: a network's own coin, or a network outside the EVM ones and TRON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Wallet deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "`transfer_would_fail`: a dry run of the transfer fails on chain (for one, the address lacks the amount)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 30 quote requests a minute for the account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "`network_unavailable`: the network's API could not be read; `prices_unavailable`: the prices could not be read",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "`fee_station_empty`: the fee wallet lacks the network's coin now (Retry-After: 600); `fee_in_asset_unavailable`: the mode is off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/transfers/{id}": {
      "get": {
        "tags": [
          "Transfers"
        ],
        "summary": "Get a transfer",
        "description": "Scope: `wallets:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "Transfer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transfer"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Transfer not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/config": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "Public auth settings",
        "description": "The hCaptcha sitekey the sign-up, sign-in and password-reset forms render their widget with.",
        "responses": {
          "200": {
            "description": "Settings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "hcaptcha_sitekey": {
                      "type": "string",
                      "example": "10000000-ffff-ffff-ffff-000000000001"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/register": {
      "post": {
        "tags": [
          "Public"
        ],
        "summary": "Register a merchant",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Account created: merchant profile and the authenticator to set up (no token yet)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request; `captcha_required` or `captcha_invalid` when the captcha token is missing or rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "description": "Needs `hcaptcha_token`. Limited to 5 sign-ups an hour per IP. Returns no session: 2FA is required, so the answer carries the new account's authenticator key (`totp_setup_required`, `totp_secret`, `otpauth_url`); sign in with a code from it to turn 2FA on and get the token. An email that already has an account gets the same answer, so the answer does not reveal it; nothing is created, and the address gets an email about the attempt."
      }
    },
    "/v1/auth/login": {
      "post": {
        "tags": [
          "Public"
        ],
        "summary": "Login",
        "description": "2FA is required for every session. Without `totp_code` the answer is `200 {\"totp_required\": true}` when 2FA is on, or, for an account without 2FA, `200 {\"totp_setup_required\": true, \"totp_secret\", \"otpauth_url\"}`: add the key to an authenticator app and sign in again with its code, which turns 2FA on and returns the token.\n\nNeeds a fresh `hcaptcha_token` on every request, the 2FA step included. Limited to 30 attempts per 15 minutes per IP and 8 per 15 minutes per account (a successful sign-in clears the account's count); a 2FA code is accepted once, for any action.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JWT + merchant profile, or a 2FA step (`totp_required`, `totp_setup_required`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request; `captcha_required` or `captcha_invalid` when the captcha token is missing or rejected; `session_key_required` when `totp_code` comes without a valid `session_key`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Account suspended",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or too many failed attempts: try again later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/dashboard/me": {
      "get": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Merchant profile",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Merchant"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/dashboard/api-keys": {
      "get": {
        "tags": [
          "Dashboard"
        ],
        "summary": "List API keys",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Keys",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_keys": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiKey"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Create an API key",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Key pair (secret returned once)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKey"
                }
              }
            }
          },
          "400": {
            "description": "Unknown scope, or password_required for a wallets:transfer or wallets:mnemonic key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "totp_required or invalid_totp; invalid_password for a wallets:transfer or wallets:mnemonic key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many wrong passwords: login locked for a while",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyRequest"
              }
            }
          }
        },
        "description": "Every key needs a fresh 2FA code. A key with the wallets:transfer scope sends funds and one with wallets:mnemonic reads seed phrases, so issuing either also asks for the account password, the same check as a seed export."
      }
    },
    "/v1/dashboard/api-keys/{id}": {
      "delete": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Revoke an API key",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "revoked": {
                      "type": "boolean",
                      "example": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/dashboard/webhooks": {
      "get": {
        "tags": [
          "Dashboard"
        ],
        "summary": "List webhook endpoints",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Endpoints",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "webhooks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookEndpoint"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Register a webhook endpoint",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Endpoint (secret returned once)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "400": {
            "description": "url missing, not https or not a public address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/dashboard/webhooks/{id}": {
      "delete": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Delete a webhook endpoint",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean",
                      "example": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/dashboard/webhooks/deliveries": {
      "get": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Webhook delivery log",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Deliveries",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deliveries": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookDelivery"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/dashboard/2fa/setup": {
      "post": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Start replacing the authenticator",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "TOTP secret + otpauth URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "secret": {
                      "type": "string"
                    },
                    "otpauth_url": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`invalid_password`, `totp_required` or `invalid_totp`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "400": {
            "description": "`password_required` or a bad body",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many failed attempts: locked for a while",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Needs the password and a code from the current authenticator, so a session alone cannot move 2FA to another device. The new key is kept aside: the current authenticator keeps working until `POST /v1/dashboard/2fa/enable` confirms a code from the new one.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TotpReplaceRequest"
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/2fa/enable": {
      "post": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Confirm the new authenticator",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "code"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "example": "123456"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "2FA enabled",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "totp_enabled": {
                      "type": "boolean",
                      "example": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_totp`, or no replacement started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "description": "A newer replacement was started: confirm that one",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many failed attempts: locked for a while",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Checks a code from the key `POST /v1/dashboard/2fa/setup` returned and makes it the account's 2FA; the old authenticator stops working."
      }
    },
    "/api/v1/account/callback-secret": {
      "get": {
        "tags": [
          "Wallets"
        ],
        "summary": "Callback signing secret",
        "description": "The secret that signs deliveries to callback_url (webhook endpoints have their own). Needs the wallets:write scope: whoever holds it can sign deliveries to your server.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "Secret",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallbackSecret"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets": {
      "post": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Create a wallet",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "A live wallet with this external_id already exists; returned as is",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "201": {
            "description": "Wallet created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "400": {
            "description": "Bad name, external_id or callback_url",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "external_id is taken",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWalletRequest"
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "List wallets",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "include_deleted",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Also list soft-deleted wallets"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          }
        ],
        "responses": {
          "200": {
            "description": "Wallets, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletList"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets/{id}": {
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Get a wallet",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          }
        ],
        "responses": {
          "200": {
            "description": "Wallet (deleted ones too)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Update a wallet",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          }
        ],
        "responses": {
          "200": {
            "description": "Updated wallet",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The wallet is deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWalletRequest"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Delete a wallet (soft)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted wallet (deleted_at set)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Soft delete: the wallet keeps its data and seed phrase, stops being watched and cannot send. Deleting a deleted wallet returns it unchanged."
      }
    },
    "/v1/dashboard/wallets/{id}/balances": {
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Wallet balances",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          }
        ],
        "responses": {
          "200": {
            "description": "Balances",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletBalances"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Reads every asset's balance from the chains now (no cache). A network whose API fails is listed with `error`."
      }
    },
    "/v1/dashboard/wallets/{id}/deposits": {
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Wallet deposits",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "name": "network",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ethereum",
                "bsc",
                "polygon",
                "arbitrum",
                "optimism",
                "base",
                "avalanche",
                "tron",
                "bitcoin",
                "litecoin",
                "ton"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          }
        ],
        "responses": {
          "200": {
            "description": "Incoming transfers, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deposits": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Deposit"
                      }
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets/{id}/test-deposits": {
      "post": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Simulate a deposit (test mode)",
        "description": "Credits a test-mode wallet on the simulated network: `deposit.detected` now, `deposit.confirmed` 5 to 15 seconds later. See *Test mode*.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/KryptrMode"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SimulateDepositRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The simulated deposit, detected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deposit"
                }
              }
            }
          },
          "400": {
            "description": "invalid_amount, unsupported_asset or invalid_address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "live_wallet: the wallet is a live one; wallet_deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "test_deposit_limit: 1,000 simulated deposits in 24 hours",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets/{id}/mnemonic": {
      "post": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Export the seed phrase",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          }
        ],
        "responses": {
          "200": {
            "description": "Seed phrase",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Mnemonic"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many attempts or exports",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Needs the account password and, when 2FA is on, the 2FA code; wrong answers count towards the login lockout. Returns the wallet's seed phrase (24 words, or as many as an imported one has). Rate limited (10 an hour per account), written to the audit log, announced with `wallet.mnemonic_exported`. Works for deleted wallets too. The response has `Cache-Control: no-store`. The response carries a `backup_token` for `POST /v1/dashboard/wallets/{id}/backup`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DashboardMnemonicRequest"
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets/{id}/transfers": {
      "post": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Send funds from a wallet",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/TransferIdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Retry with the same Idempotency-Key: the first transfer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transfer"
                }
              }
            }
          },
          "201": {
            "description": "Transfer queued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transfer"
                }
              }
            }
          },
          "400": {
            "description": "Bad amount, address or asset, or no Idempotency-Key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session, or `totp_required` / `invalid_totp`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Wallet deleted, or Idempotency-Key reused with other parameters; with `fee_in_asset`: `fee_changed` (the fee is above `max_fee`), `address_busy` (the address has a transfer that is not final), `fee_unpaid` (an earlier transfer's fee is still owed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "`insufficient_funds`: the wallet lacks the amount, or the network coin for the fee of a TRON token transfer; `transfer_would_fail`: a dry run of the TRON token transfer fails on chain; `sanctioned_address`: the recipient is on the OFAC SDN list; with `fee_in_asset` and an API key under a policy: `policy_limit` (amount and fee are over the daily limit), `policy_hold` (the recipient is outside the address book)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The network's API could not be read; `prices_unavailable`: the prices a fee in the asset is counted at could not be read",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many failed 2FA codes: locked for a while",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "With `fee_in_asset`: `fee_station_empty` (the fee wallet lacks the network's coin now, Retry-After: 600), `fee_in_asset_unavailable` (the mode is off)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Checks the address and the on-chain balance, then queues the transfer; a worker signs and broadcasts it. Follow it with `GET /api/v1/transfers/{id}` or the `transfer.*` events. The network fee is paid by the wallet in the network's coin. With `fee_in_asset: true` a token transfer on an EVM network or TRON pays its fee in the token (see *Network fee in the token*). Needs a 2FA code (`totp_code`); API-key transfers (`POST /api/v1/wallets/{id}/transfers`) are authorised by the key's signature and scope instead.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DashboardTransferRequest"
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "List a wallet's transfers",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          }
        ],
        "responses": {
          "200": {
            "description": "Transfers, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "transfers": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Transfer"
                      }
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets/{id}/transfers/fee-quote": {
      "post": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Quote the network fee in the token",
        "description": "Prices a token transfer that pays its network fee in the token (see *Network fee in the token*). Nothing is stored: the fee is counted again when the transfer is made, so cap it there with `max_fee`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FeeQuoteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The fee",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeeQuote"
                }
              }
            }
          },
          "400": {
            "description": "Bad amount, address or asset; `fee_in_asset_unsupported`: a network's own coin, or a network outside the EVM ones and TRON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Wallet deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "`transfer_would_fail`: a dry run of the transfer fails on chain (for one, the address lacks the amount)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 30 quote requests a minute for the account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "`network_unavailable`: the network's API could not be read; `prices_unavailable`: the prices could not be read",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "`fee_station_empty`: the fee wallet lacks the network's coin now (Retry-After: 600); `fee_in_asset_unavailable`: the mode is off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/transfers/{id}": {
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Get a transfer",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Transfer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transfer"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Transfer not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/callback-secret": {
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Callback signing secret",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Secret",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallbackSecret"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/forgot-password": {
      "post": {
        "tags": [
          "Public"
        ],
        "summary": "Email a password reset link",
        "description": "Always answers 200, whether or not the email is registered.\n\nNeeds `hcaptcha_token`. Limited to 5 requests an hour per IP; at most 3 emails an hour go to one address (further requests get the same 200). A new link makes the earlier ones invalid.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "hcaptcha_token"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "hcaptcha_token": {
                    "type": "string",
                    "description": "hCaptcha response token from the widget rendered with `hcaptcha_sitekey` (`GET /v1/auth/config`). Each token is checked once; get a new one for every request."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request; `captcha_required` or `captcha_invalid` when the captcha token is missing or rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/auth/reset-password": {
      "post": {
        "tags": [
          "Public"
        ],
        "summary": "Set a new password with a reset token",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "token",
                  "new_password",
                  "hcaptcha_token"
                ],
                "properties": {
                  "token": {
                    "type": "string"
                  },
                  "new_password": {
                    "type": "string",
                    "format": "password",
                    "minLength": 10,
                    "description": "10 characters to 72 bytes, letters and digits."
                  },
                  "hcaptcha_token": {
                    "type": "string",
                    "description": "hCaptcha response token from the widget rendered with `hcaptcha_sitekey` (`GET /v1/auth/config`). Each token is checked once; get a new one for every request."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Password changed; older sessions end",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad or expired token, weak password; `captcha_required` or `captcha_invalid` when the captcha token is missing or rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "description": "Needs `hcaptcha_token`. Limited to 10 requests an hour per IP. Using a link makes the account's other links invalid, ends every session and emails a notice."
      }
    },
    "/v1/dashboard/password": {
      "post": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Change the password",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "current_password",
                  "new_password"
                ],
                "properties": {
                  "current_password": {
                    "type": "string",
                    "format": "password"
                  },
                  "new_password": {
                    "type": "string",
                    "format": "password"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Password changed; use the new token (the same session and key), every other session ends",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string",
                      "description": "JWT bearer token"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Weak new password",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Wrong current password",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/activity": {
      "post": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Report a page view, reload or sign-out of the web app",
        "description": "The web app calls this on every page it shows and on sign-out, with the browser's language, time zone, screen and platform. Each request to the API is also recorded with its time, address and browser for the activity log; request bodies are never stored.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type"
                ],
                "additionalProperties": false,
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "page_view",
                      "sign_out"
                    ]
                  },
                  "path": {
                    "type": "string",
                    "description": "The page's path in the web app"
                  },
                  "nav": {
                    "type": "string",
                    "description": "navigate, reload, back_forward or spa_push / spa_pop / spa_replace"
                  },
                  "referrer": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "language": {
                    "type": "string",
                    "example": "ru-RU"
                  },
                  "languages": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 10
                  },
                  "timezone": {
                    "type": "string",
                    "example": "Asia/Dubai"
                  },
                  "tz_offset": {
                    "type": "integer",
                    "description": "Date.getTimezoneOffset(), minutes"
                  },
                  "screen": {
                    "type": "string",
                    "example": "1920x1080"
                  },
                  "viewport": {
                    "type": "string",
                    "example": "1280x720"
                  },
                  "pixel_ratio": {
                    "type": "number"
                  },
                  "color_depth": {
                    "type": "integer"
                  },
                  "platform": {
                    "type": "string"
                  },
                  "cores": {
                    "type": "integer"
                  },
                  "memory_gb": {
                    "type": "number"
                  },
                  "touch_points": {
                    "type": "integer"
                  },
                  "cookies_enabled": {
                    "type": "boolean"
                  },
                  "do_not_track": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "description": "At most 8 KiB"
        },
        "responses": {
          "204": {
            "description": "Recorded"
          },
          "400": {
            "description": "Unknown type or field, or a body over 8 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No valid session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets/import": {
      "post": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Import a wallet from a seed phrase",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Adds a wallet for an existing seed phrase, for example one from Trust Wallet. The phrase is stored encrypted like a generated one, never logged, and counts as backed up (`backup_status: verified`). If one of your deleted wallets has this phrase, it is reopened (200, `restored: true`). Rate limited (20 an hour per account), written to the audit log, announced with `wallet.created`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportWalletRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Wallet imported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "200": {
            "description": "A deleted wallet with this phrase reopened",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "400": {
            "description": "Not a valid seed phrase (`invalid_mnemonic`), or a bad name or callback_url",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`wallet_exists`: you already have a live wallet with this phrase (returned in `wallet`); `seed_in_use`: another account holds it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletExists"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets/backup-due": {
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Wallets without a confirmed seed backup",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Feeds the dashboard's backup reminder: live wallets whose `backup_status` is not `verified`.",
        "responses": {
          "200": {
            "description": "Wallets to back up",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BackupDue"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets/{id}/backup": {
      "post": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Confirm the seed phrase backup",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          }
        ],
        "description": "Call after the user passed the words check on a phrase shown by the dashboard export. Takes that export's `backup_token`, never words, so it cannot be used to guess a phrase. Sets `backup_status` to `verified`; written to the audit log.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmBackupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Backup confirmed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "400": {
            "description": "`backup_check_expired`: the token is missing, expired or from another wallet",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallets/import": {
      "post": {
        "tags": [
          "Wallets"
        ],
        "summary": "Import a wallet from a seed phrase",
        "security": [
          {
            "apiKey": []
          }
        ],
        "description": "Adds a wallet for an existing seed phrase, for example one from Trust Wallet. The phrase is stored encrypted like a generated one, never logged, and counts as backed up (`backup_status: verified`). If one of your deleted wallets has this phrase, it is reopened (200, `restored: true`). Rate limited (20 an hour per account), written to the audit log, announced with `wallet.created`.\n\nScope: `wallets:write`.",
        "parameters": [
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportWalletRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Wallet imported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "200": {
            "description": "A deleted wallet with this phrase reopened",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            }
          },
          "400": {
            "description": "Not a valid seed phrase (`invalid_mnemonic`), or a bad name or callback_url",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`wallet_exists`: you already have a live wallet with this phrase (returned in `wallet`); `seed_in_use`: another account holds it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletExists"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Missing scope or suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prices": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "USD prices of the coins the wallets hold",
        "description": "USD price and 24-hour change of every coin symbol the wallets hold, read from CoinGecko and cached for 60 seconds. For display only: balances and transfers never use them.",
        "responses": {
          "200": {
            "description": "Prices",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "currency": {
                      "type": "string",
                      "example": "USD"
                    },
                    "prices": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "usd": {
                            "type": "number",
                            "example": 59868
                          },
                          "change_24h": {
                            "type": "number",
                            "description": "Percent",
                            "example": 1.0
                          }
                        }
                      }
                    },
                    "source": {
                      "type": "string",
                      "example": "CoinGecko"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Prices could not be read now",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/balances": {
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Portfolio: balances of every live wallet",
        "description": "Reads the balances of one page of the account's live wallets (100 per page from `offset`) from the chains now, per wallet and summed per asset over the networks that answered. Read the next page from `offset + wallets_read` until it reaches `wallets_total`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of balances",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "wallets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "wallet_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "balances": {
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/WalletBalance"
                            }
                          }
                        }
                      }
                    },
                    "totals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "asset_id": {
                            "type": "string",
                            "example": "USDT.tron"
                          },
                          "symbol": {
                            "type": "string"
                          },
                          "network": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "string",
                            "example": "12.5"
                          },
                          "failed": {
                            "type": "integer",
                            "description": "Wallets whose network could not be read; the amount leaves them out"
                          }
                        }
                      }
                    },
                    "wallets_read": {
                      "type": "integer"
                    },
                    "wallets_total": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "read_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No or expired session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/logout": {
      "post": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Sign out",
        "description": "Ends the current session on the server: its token stops working everywhere.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Ended",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/dashboard/sessions": {
      "get": {
        "tags": [
          "Dashboard"
        ],
        "summary": "List active sessions",
        "description": "Sessions of the account that still work, most recently used first.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Sessions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sessions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Session"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/dashboard/sessions/end-others": {
      "post": {
        "tags": [
          "Dashboard"
        ],
        "summary": "End every other session",
        "description": "Ends every session of the account but the current one.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "How many ended",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ended": {
                      "type": "integer",
                      "example": 2
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/dashboard/sessions/{id}/end": {
      "post": {
        "tags": [
          "Dashboard"
        ],
        "summary": "End a session",
        "description": "Ends another session of the account; the current one signs out with `POST /v1/dashboard/logout`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ended",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The current session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/wallets/{id}/swaps/quote": {
      "post": {
        "tags": [
          "Swaps"
        ],
        "summary": "Quote a swap",
        "description": "Asks THORChain and LI.FI for a quote at once (THORChain from native coins of Ethereum, BSC, Avalanche, Base, TRON, Bitcoin, Litecoin; LI.FI between EVM networks); SideShift is asked only when neither returns a quote. Each quote is kept for at most two minutes. No platform fee is added: amount_out is net of the provider's fees, and the wallet also pays the network fee of its own transactions.\n\nScope: `wallets:swap`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SwapQuoteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Quotes, best first, and the providers that refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SwapQuotes"
                }
              }
            }
          },
          "400": {
            "description": "Bad amount or asset, or the same asset twice",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Wallet deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "`no_route`: no provider covers the pair",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 20 quote requests a minute, or 500 in 24 hours, for the account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "`unavailable`: the request counters cannot be read; try again later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallets/{id}/swaps": {
      "post": {
        "tags": [
          "Swaps"
        ],
        "summary": "Start a swap from a quote",
        "description": "Checks the on-chain balance, opens the deposit with the provider and queues the wallet's transactions (its legs, listed among the wallet's transfers with `swap_id`): a LI.FI token swap first approves the exact amount to LI.FI's router 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE, then calls it; THORChain and SideShift get a plain transfer to their deposit address. Follow it with `GET .../swaps/{id}` or the `swap.*` events.\n\nScope: `wallets:swap`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/SwapIdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSwapRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Retry with the same Idempotency-Key: the first swap",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Swap"
                }
              }
            }
          },
          "201": {
            "description": "Swap started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Swap"
                }
              }
            }
          },
          "400": {
            "description": "No Idempotency-Key or a bad callback_url",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet or quote not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`quote_expired`, `quote_used`, `swap_in_progress` (a LI.FI swap of the same token from this wallet has not confirmed its deposit yet), wallet deleted, or Idempotency-Key reused with another quote",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "`insufficient_funds`: the wallet lacks the amount, or the network coin for the fee of a TRON token transfer; `transfer_would_fail`: a dry run of the TRON token transfer fails on chain; `policy_limit`: over the API key's daily limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The provider refused the deposit, or the network's API could not be read",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Swaps"
        ],
        "summary": "List a wallet's swaps",
        "description": "Newest first. Scope: `wallets:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          }
        ],
        "responses": {
          "200": {
            "description": "Swaps",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SwapList"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/swaps/{id}": {
      "get": {
        "tags": [
          "Swaps"
        ],
        "summary": "Get a swap",
        "description": "Status, amounts and transactions. Scope: `wallets:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "The swap",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Swap"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Swap not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/swaps/{id}/events": {
      "get": {
        "tags": [
          "Swaps"
        ],
        "summary": "A swap's trail",
        "description": "Every operation of the swap, oldest first: the quote request (each provider asked, refusals too), the start, the wallet's transactions, the provider's answers and the status changes. Scope: `wallets:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "The swap's trail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "swap_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SwapEvent"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Swap not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets/{id}/swaps/quote": {
      "post": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Quote a swap",
        "description": "Asks THORChain and LI.FI for a quote at once (THORChain from native coins of Ethereum, BSC, Avalanche, Base, TRON, Bitcoin, Litecoin; LI.FI between EVM networks); SideShift is asked only when neither returns a quote. Each quote is kept for at most two minutes. No platform fee is added: amount_out is net of the provider's fees, and the wallet also pays the network fee of its own transactions.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SwapQuoteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Quotes, best first, and the providers that refused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SwapQuotes"
                }
              }
            }
          },
          "400": {
            "description": "Bad amount or asset, or the same asset twice",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Wallet deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "`no_route`: no provider covers the pair",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 20 quote requests a minute, or 500 in 24 hours, for the account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "`unavailable`: the request counters cannot be read; try again later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets/{id}/swaps": {
      "post": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Start a swap from a quote",
        "description": "Checks the on-chain balance, opens the deposit with the provider and queues the wallet's transactions (its legs, listed among the wallet's transfers with `swap_id`): a LI.FI token swap first approves the exact amount to LI.FI's router 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE, then calls it; THORChain and SideShift get a plain transfer to their deposit address. Follow it with `GET .../swaps/{id}` or the `swap.*` events. Needs a 2FA code (`totp_code`).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/SwapIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DashboardCreateSwapRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Retry with the same Idempotency-Key: the first swap",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Swap"
                }
              }
            }
          },
          "201": {
            "description": "Swap started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Swap"
                }
              }
            }
          },
          "400": {
            "description": "No Idempotency-Key or a bad callback_url",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials, or `totp_required` / `invalid_totp`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet or quote not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`quote_expired`, `quote_used`, `swap_in_progress` (a LI.FI swap of the same token from this wallet has not confirmed its deposit yet), wallet deleted, or Idempotency-Key reused with another quote",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "`insufficient_funds`: the wallet lacks the amount, or the network coin for the fee of a TRON token transfer; `transfer_would_fail`: a dry run of the TRON token transfer fails on chain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The provider refused the deposit, or the network's API could not be read",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "List a wallet's swaps",
        "description": "Newest first.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          }
        ],
        "responses": {
          "200": {
            "description": "Swaps",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SwapList"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/swaps/{id}": {
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Get a swap",
        "description": "Status, amounts and transactions.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The swap",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Swap"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Swap not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/swaps/{id}/events": {
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "A swap's trail",
        "description": "Every operation of the swap, oldest first: the quote request (each provider asked, refusals too), the start, the wallet's transactions, the provider's answers and the status changes.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The swap's trail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "swap_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SwapEvent"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Swap not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/api-keys/{id}/policy": {
      "put": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Set an API key's spending policy",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "description": "Daily limit and address-book-only switch. Needs the password and a 2FA code, like issuing a key that moves funds.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetKeyPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The policy now in force",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyPolicy"
                }
              }
            }
          },
          "400": {
            "description": "Bad limit, or password_required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_password, totp_required or invalid_totp",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Key not found or revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many wrong passwords",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/address-book": {
      "get": {
        "tags": [
          "Dashboard"
        ],
        "summary": "List the address book",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Entries",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AddressBookEntry"
                      }
                    },
                    "activation_delay_hours": {
                      "type": "integer",
                      "example": 24
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Add an address",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Book-only keys may send to it 24 hours later, so a stolen session cannot add an address and drain a key at once. A sanctioned address is refused.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddAddressBookRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Added",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressBookEntry"
                }
              }
            }
          },
          "400": {
            "description": "unsupported_network or invalid_address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session; totp_required or invalid_totp",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "duplicate: already in the book",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "sanctioned_address: on the OFAC SDN list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/address-book/{id}": {
      "delete": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Remove an address",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Entry not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/transfers/awaiting-approval": {
      "get": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Transfers waiting for approval",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Held transfers, oldest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "transfers": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Transfer"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/dashboard/transfers/{id}/approve": {
      "post": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Approve a held transfer",
        "description": "Checks the recipient against the sanctions list, the balance and the fee again, then queues it (`transfer.approved`).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApprovalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The transfer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transfer"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session; totp_required or invalid_totp",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Transfer not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "not_awaiting_approval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "sanctioned_address, insufficient_funds or transfer_would_fail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The network's API could not be read",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/transfers/{id}/reject": {
      "post": {
        "tags": [
          "Dashboard"
        ],
        "summary": "Reject a held transfer",
        "description": "Fails it with `rejected by the account owner` (`transfer.failed`).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApprovalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The transfer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transfer"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session; totp_required or invalid_totp",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Transfer not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "not_awaiting_approval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/screening": {
      "get": {
        "tags": [
          "Dashboard"
        ],
        "summary": "The sanctions list addresses are checked against",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "List size and dates",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Screening"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/api/v1/key": {
      "get": {
        "tags": [
          "Wallets"
        ],
        "summary": "This API key",
        "description": "The key that signed the request: scopes, spending policy, spent and remaining in the last 24 hours (ADR-016). Any valid key.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "The key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OwnKey"
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad signature, or a replayed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Suspended account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets/{id}/rules": {
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "List a wallet's rules",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          }
        ],
        "responses": {
          "200": {
            "description": "Rules, oldest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rules": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Rule"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Make a rule",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          }
        ],
        "description": "The rule is checked first and the 2FA code is asked only for one that can be made. It is switched on at once and acts on deposits confirmed from then on. Rules are made only here: an API key cannot make, switch or delete one.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RuleRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The rule",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rule"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_rule` (the message names the field), `invalid_amount`, `unsupported_asset`, `invalid_address` or `same_asset`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session; totp_required or invalid_totp",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`rule_exists`: the wallet has a rule for this asset; `rule_loop`: its swap rules would feed one another; wallet deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "`sanctioned_address`: to_address is on the OFAC SDN list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets/{id}/rules/preview": {
      "post": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Try a rule on a deposit",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          }
        ],
        "description": "Checks the rule as making it does and tells what it would do if the deposit were confirmed now: the amount, the network fee check of a send (when the address already holds the amount), the providers' quotes of a swap. Nothing is stored except the quotes, and nothing is moved. A swap preview counts as a quote request.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RulePreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What the rule would do",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RulePreview"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_rule` (the message names the field), `invalid_amount`, `unsupported_asset`, `invalid_address` or `same_asset`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`rule_loop` or wallet deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "`sanctioned_address` or `no_route`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 20 quote requests a minute, or 500 in 24 hours, for the account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The network's API could not be read",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "`unavailable`: the request counters cannot be read; try again later",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/wallets/{id}/rule-runs": {
      "get": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "A wallet's rule log",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          }
        ],
        "description": "Every deposit a rule looked at, newest first, with what it did and why.",
        "responses": {
          "200": {
            "description": "Runs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RuleRun"
                      }
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/rules/{id}/enable": {
      "post": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Switch a rule on",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Rule id"
          }
        ],
        "description": "Checks the rule again (the recipient may have been listed since). Deposits confirmed while it was off stay where they are.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RuleSwitchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The rule",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rule"
                }
              }
            }
          },
          "401": {
            "description": "No or expired session; totp_required or invalid_totp",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rule not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`rule_loop` or wallet deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "`sanctioned_address`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/rules/{id}/disable": {
      "post": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Switch a rule off",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Rule id"
          }
        ],
        "description": "No code is asked: it only stops the wallet acting by itself. A run that has not made its transfer or swap yet is skipped.",
        "responses": {
          "200": {
            "description": "The rule",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rule"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Rule not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/dashboard/rules/{id}": {
      "delete": {
        "tags": [
          "Dashboard wallets"
        ],
        "summary": "Delete a rule",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Rule id"
          }
        ],
        "description": "Its log stays.",
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "Rule not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallets/{id}/rules": {
      "get": {
        "tags": [
          "Wallets"
        ],
        "summary": "List a wallet's rules",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          }
        ],
        "description": "Read only: rules are made and switched in the dashboard, behind a 2FA code. Scope: `wallets:read`.",
        "responses": {
          "200": {
            "description": "Rules, oldest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rules": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Rule"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/wallets/{id}/rule-runs": {
      "get": {
        "tags": [
          "Wallets"
        ],
        "summary": "A wallet's rule log",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/WalletID"
          },
          {
            "$ref": "#/components/parameters/XTimestamp"
          },
          {
            "$ref": "#/components/parameters/XSignature"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          }
        ],
        "description": "Every deposit a rule looked at, newest first. Scope: `wallets:read`.",
        "responses": {
          "200": {
            "description": "Runs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RuleRun"
                      }
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or bad credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Wallet not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  }
}
