{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "AllSwap Partner API",
    "version": "2.0.0-beta.1",
    "description": "Quotes, deposit-address orders and order tracking for wallets, aggregators and dApps. AllSwap is non-custodial: each order gets its own one-time payment address; the user pays it and the swap output goes to the recipient address of the quote. Flow: GET /v2/assets, POST /v2/quote-previews (optional), POST /v2/quotes, POST /v2/orders, then GET /v2/orders/{orderId} until the order is payable, paid and settled.\n\n**Status:** phase 1 is implemented: its six operations, GET /v2/assets, POST /v2/quote-previews, POST /v2/quotes, POST /v2/orders, GET /v2/orders/{orderId} and GET /v2/orders (the order list). The partner entry is off by default; AllSwap's operators turn it on on the server, and the operations that take a key are served from then on. Operations and the webhook marked x-phase 2 (order events, usage, webhook delivery) open later. There is no sandbox. Previews and quotes cost no money but count against your quote bucket; do not create orders you do not intend to pay: every unpaid order is watched for a long time and counts against your cap of orders awaiting payment.\n\n**Keys:** issued by AllSwap after review, with scopes and an expiry date. All keys of one partner account belong to the same account identity and see the same quotes and orders; rotate by asking for a second key and revoking the first. Scopes (x-required-scope): quotes:read, quotes:write, orders:create, orders:read, orders:write, usage:read, webhooks:read, webhooks:write, recovery:read. Phase 1 keys carry quotes:read, quotes:write, orders:create and orders:read (a create replay reads the order, so it needs orders:read too); usage:read opens with phase 2.\n\n**Money:** partner orders have the same prices as the AllSwap website; fees come only from platform configuration (feeDisclosure) and requests cannot carry fee, tenant or upstream fields. Every quote needs the user's refund address on the source chain (refundPreference USER_ADDRESS); AllSwap never receives refunds for partners' users.\n\n**How to tell how an order is doing** (status / executionState / fundingState / recoveryState / paymentInstruction):\n\n| Stage | Combination | What to do |\n| --- | --- | --- |\n| Preparing | PREPARING / PREPARING / NOT_OBSERVED / NONE / null | Wait and poll. |\n| Payable | AWAITING_PAYMENT / AWAITING_PAYMENT / NOT_OBSERVED / NONE / ACTIVE | Show the payment, only under the payable rule below. |\n| Not payable now | AWAITING_PAYMENT with paymentInstruction SUSPENDED | Do not pay; keep polling. |\n| Expired, unpaid | AWAITING_PAYMENT with DEADLINE_PASSED or paymentDeadline passed | Never pay. No separate status; nothing to cancel. Not final: a payment seen after the deadline can still take it to PROCESSING, COMPLETED or NEEDS_REVIEW. No polling of its own; check it through the list until it is final. |\n| Payment seen | PROCESSING / any / OBSERVED, CONFIRMING, CONFIRMED or PARTIAL / NONE / SUSPENDED | Never ask for another payment. |\n| Completed | COMPLETED / SUCCEEDED / CONFIRMED / NONE | Final when stale is false; amountOutConfirmed is what the recipient received. |\n| Creation unknown | NEEDS_REVIEW / SUBMISSION_UNKNOWN / NOT_OBSERVED / REVIEW_REQUIRED / null | Nothing to pay for now; keep polling. It can still become payable, or be closed. Never create it again. |\n| Manual handling | NEEDS_REVIEW / ... / REVIEW_REQUIRED | Never pay; AllSwap handles it (late, partial, excess or duplicate payment, route failure, unverified refund). |\n| Refunded | REFUNDED / FAILED / ... / REFUND_CONFIRMED | Final when stale is false. |\n| Not completed | NOT_COMPLETED / CANCELLED_BEFORE_CREATE or FAILED | Final (stale may be true). Nothing was or will be paid out; a new attempt needs a new clientIntentKey. |\n\n**Payable rule** (all must hold, on a read made just before you show the address; never cache it): stale is false; status and executionState are AWAITING_PAYMENT; recoveryState is NONE; paymentInstruction.state is ACTIVE; paymentDeadline is null or in the future; reusable false and amountRule EXACT; paymentInstruction.assetId, chainId and amountRequested match the order's fromAssetId, its chain and amountInRequested; the order's assets, amount and recipient match your quote. Ask for exactly amountRequested to address, with memo when it is not null (no memo support in the user's wallet: do not pay).\n\n**Keeping a view:** replace your stored order view with every new read whose stateVersion is not lower (equal included); compare generation as a big integer (up to 20 digits), then sequence. Equal versions can carry different views.\n\n**Retries of POST /v2/orders:**\n\n| Outcome | Next |\n| --- | --- |\n| 202 or 200 | Follow the order. |\n| Timeout, 5xx, or 401 or 403 on a retry | Unknown: retry with the same Idempotency-Key and body, or find the order with GET /v2/orders?clientIntentKey= (key with orders:read). |\n| 429 | Nothing created; retry the same request after Retry-After. |\n| 409 INTENT_ALREADY_USED | An order exists for this intent or quote: find it by clientIntentKey. |\n| 410, 409 POLICY_CHANGED, 422 | Nothing created: new quote with the same clientIntentKey, then a new Idempotency-Key. |\n| 400, 404, first-attempt 401 or 403 | Fix the request, key or scope. |\n\nOne clientIntentKey per user intent (kept across re-quotes; it is returned in your order views, so it must not contain personal data); one Idempotency-Key per create attempt (per quote).\n\nRate limits: per partner account, one token bucket per category (x-rate-limit-category): quote (previews and quotes), order (order creation) and read (order reads, the order list, events, usage). Capacity and refill rate are agreed per partner, not fixed here. Every response to an authenticated request (except 401) carries X-RateLimit-Limit (bucket capacity), X-RateLimit-Remaining (tokens left after this request) and X-RateLimit-Reset (Unix time, rounded up to the second, when the bucket is full again); every request that passed authentication takes one token of its category, except those refused by the bucket itself (429), by a stopped category (403) or by the shared order capacity (503, which gives its token back). An empty bucket is 429 RATE_LIMITED with Retry-After (retryable), until the next token. POST /v2/orders is also 429 RATE_LIMITED, nothing created, while the account has as many orders awaiting payment (PREPARING before their creation deadline, or AWAITING_PAYMENT before their paymentDeadline) as its agreed cap; replays are never refused for it, and its Retry-After is an estimate, often later than the quote's validUntil (quote again before creating). The order creations of all partner accounts also share one capacity, taken only by requests that create an order (one that creates none, a replay included, takes nothing from it; one whose outcome is unknown counts as created; a place in it is held only during the order's database work, and a request refused there gives it back at once): while it is used up, POST /v2/orders is 503 TEMPORARILY_UNAVAILABLE with Retry-After (an estimate), nothing created, and the token it took from your bucket is given back. A category stopped by AllSwap is 403 SCOPE_DENIED with X-RateLimit-Limit 0 (not retryable), like a pause. Exceptions to the headers: while AllSwap has turned off reads for a partner account, its requests are refused with 403 SCOPE_DENIED during authentication; and while AllSwap cannot read the account's limits, or its table of accounts in memory is full (for a request of an account not in it), its requests are refused with 503 TEMPORARILY_UNAVAILABLE (retryable); both without X-RateLimit headers. Nor do requests refused before or during authentication carry them: 401, the 429 of a source with too many authentication failures, and the 503 when no database slot is free for the authentication. Authentication failures are limited per source address only; nobody can lock your key by failing with its key id.\n\n**Errors:** every error is {\"error\":{code,message,retryable,requestId}} (plus orderId on 409 INTENT_ALREADY_USED); message is not for program logic; retryable is true only for 429 and 503.\n\nCompatibility: within /v2, later versions only add (optional response fields, new enum values, new error codes, new operations, new optional request parameters); breaking changes get a new major path. Until 2.0.0 (the first partner release) this contract may still change. **Generated clients:** response objects are open (they may gain properties) and response enums are marked x-extensible-enum (they may gain values). Generate types that keep unknown properties and accept unknown enum values (most generators have an option for an \"unknown\" enum default); never validate responses strictly against an older copy of this file. Requests stay strict: unknown fields are refused.",
    "termsOfService": "https://allswap.io/docs/legal/terms",
    "contact": {
      "name": "AllSwap",
      "url": "https://allswap.io/docs/contact",
      "email": "service@allswap.io"
    },
    "x-logo": {
      "url": "https://allswap.io/brand/c1/icon-512.png",
      "altText": "AllSwap"
    }
  },
  "servers": [
    {
      "url": "https://api.allswap.io",
      "description": "Partner entry."
    }
  ],
  "tags": [
    {
      "name": "Catalog",
      "description": "Assets and their route groups."
    },
    {
      "name": "Quotes",
      "description": "Estimates and READY quotes."
    },
    {
      "name": "Orders",
      "description": "Deposit-address orders."
    }
  ],
  "paths": {
    "/v2/assets": {
      "get": {
        "operationId": "API01_get",
        "summary": "List assets",
        "description": "Every asset in one response, with its route groups and platform minimum payment. Public: no credentials. Takes no query parameters.",
        "tags": [
          "Catalog"
        ],
        "x-design-id": "API01",
        "x-audience": "partner",
        "x-phase": 1,
        "x-required-scope": "public",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "The asset list.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            },
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssetsResponse"
                }
              }
            }
          },
          "404": {
            "description": "NOT_FOUND: no such resource for this caller. A query string was sent (the route is then unknown).",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: unexpected failure. retryable is false.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "TEMPORARILY_UNAVAILABLE: a dependency is unavailable or busy (including route quote capacity); retry after Retry-After. retryable is true.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfterUnavailable"
              }
            },
            "x-error-codes": [
              "TEMPORARILY_UNAVAILABLE"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v2/quote-previews": {
      "post": {
        "operationId": "API02_post",
        "summary": "Preview a quote",
        "description": "An estimate for a pair and an input amount; nothing is guaranteed and no quote is stored. On some routes (deposit addresses that the route issues for every price request) each preview makes the route issue a fresh deposit address, which the platform records as used and never shows: preview only when a user needs a price. Only DEPOSIT_ADDRESS and EXACT_INPUT are supported. Not stopped by a pause of new quotes and orders.",
        "tags": [
          "Quotes"
        ],
        "x-design-id": "API02",
        "x-audience": "partner",
        "x-phase": 1,
        "x-required-scope": "quotes:read",
        "x-rate-limit-category": "quote",
        "security": [
          {
            "PartnerBearer": [],
            "KeyID": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "The estimate.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewResponse"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST: the request is malformed or breaks the contract (unknown or missing field, bad value, unknown query parameter). Includes unknown fields such as tenantId, providerId or appFees, a body over 64 KiB, an unsupported paymentMode or swapType, and (rarely) every route refusing the request as invalid; repeating it unchanged does not help.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "INVALID_REQUEST"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "AUTH_REQUIRED: credentials missing, malformed, unknown, wrong, revoked or expired; the response does not say which. Repeated failures from one source address are rate limited (429); failures by others with your key id never lock your key.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            },
            "x-error-codes": [
              "AUTH_REQUIRED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "SCOPE_DENIED: the credential is valid but not allowed this operation now. The key lacks scope quotes:read, or AllSwap has stopped the \"quote\" category for this partner account (X-RateLimit-Limit 0). retryable is false. While AllSwap has turned off reads for the partner account, every request is 403 SCOPE_DENIED during authentication, without X-RateLimit headers.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "SCOPE_DENIED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "NO_ROUTE: no enabled route serves this pair. AMOUNT_OUT_OF_RANGE: the amount is outside the range that can be swapped (platform minimum or route limits). NO_ROUTE also covers an unknown asset and fromAssetId equal to toAssetId.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "NO_ROUTE",
              "AMOUNT_OUT_OF_RANGE"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: too many requests for now; retry after Retry-After seconds. The partner's \"quote\" bucket is empty, or too many authentication failures from this source address. retryable is true.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              },
              "Retry-After": {
                "required": true,
                "schema": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 3600
                },
                "description": "Seconds to wait before retrying. Retry the same request (for POST /v2/orders: the same Idempotency-Key and body)."
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: unexpected failure. retryable is false.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "TEMPORARILY_UNAVAILABLE: a dependency is unavailable or busy (including route quote capacity); retry after Retry-After. RECOVERY_PENDING: the platform's control state is being verified; retry later. retryable is true.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfterUnavailable"
              }
            },
            "x-error-codes": [
              "TEMPORARILY_UNAVAILABLE",
              "RECOVERY_PENDING"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewRequest"
              }
            }
          },
          "x-max-bytes": 65536
        }
      }
    },
    "/v2/quotes": {
      "post": {
        "operationId": "API03_post",
        "summary": "Create a READY quote",
        "description": "Prices the swap and stores a READY quote that binds the pair, amount, slippage, recipient, refund address, price conditions and clientIntentKey; POST /v2/orders cannot change any of them. Not idempotent: every call stores a new quote (and, on routes that issue a deposit address per price request, takes a fresh address). Partners must give a refund address (USER_ADDRESS); any other refund preference is refused before a route is asked. Create the order before validUntil.",
        "tags": [
          "Quotes"
        ],
        "x-design-id": "API03",
        "x-audience": "partner",
        "x-phase": 1,
        "x-required-scope": "quotes:write",
        "x-rate-limit-category": "quote",
        "security": [
          {
            "PartnerBearer": [],
            "KeyID": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "The READY quote. Create the order right away.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerQuoteResponse"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST: the request is malformed or breaks the contract (unknown or missing field, bad value, unknown query parameter). Also: a recipient on another chain than toAssetId, a recipient that fails the chain's address checks, or a recipient memo.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "INVALID_REQUEST"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "AUTH_REQUIRED: credentials missing, malformed, unknown, wrong, revoked or expired; the response does not say which. Repeated failures from one source address are rate limited (429); failures by others with your key id never lock your key.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            },
            "x-error-codes": [
              "AUTH_REQUIRED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "SCOPE_DENIED: the credential is valid but not allowed this operation now. The key lacks scope quotes:write, AllSwap has paused new quotes and orders for this partner account (existing orders keep being tracked), or AllSwap has stopped the \"quote\" category for this partner account (X-RateLimit-Limit 0). retryable is false. While AllSwap has turned off reads for the partner account, every request is 403 SCOPE_DENIED during authentication, without X-RateLimit headers.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "SCOPE_DENIED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "POLICY_CHANGED: the route or its terms changed since pricing; request a new quote. The route changed while pricing; request the quote again.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "POLICY_CHANGED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "QUOTE_EXPIRED: the quote is too old to be used; request a new quote. The price became too old while storing; request the quote again.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "QUOTE_EXPIRED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "NO_ROUTE: no enabled route serves this pair. AMOUNT_OUT_OF_RANGE: the amount is outside the range that can be swapped (platform minimum or route limits). REFUND_POLICY_UNAVAILABLE: no acceptable refund address for this route. PRICE_CONDITION_UNSUPPORTED: the price conditions (acceptance) cannot be met. REFUND_POLICY_UNAVAILABLE: refundPreference is not USER_ADDRESS, or the refund address is on another chain than fromAssetId, has a memo or fails the chain's checks.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "NO_ROUTE",
              "AMOUNT_OUT_OF_RANGE",
              "REFUND_POLICY_UNAVAILABLE",
              "PRICE_CONDITION_UNSUPPORTED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: too many requests for now; retry after Retry-After seconds. The partner's \"quote\" bucket is empty, or too many authentication failures from this source address. retryable is true.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              },
              "Retry-After": {
                "required": true,
                "schema": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 3600
                },
                "description": "Seconds to wait before retrying. Retry the same request (for POST /v2/orders: the same Idempotency-Key and body)."
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: unexpected failure. retryable is false.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "TEMPORARILY_UNAVAILABLE: a dependency is unavailable or busy (including route quote capacity); retry after Retry-After. RECOVERY_PENDING: the platform's control state is being verified; retry later. retryable is true.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfterUnavailable"
              }
            },
            "x-error-codes": [
              "TEMPORARILY_UNAVAILABLE",
              "RECOVERY_PENDING"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteRequest"
              }
            }
          },
          "x-max-bytes": 65536
        }
      }
    },
    "/v2/orders": {
      "post": {
        "operationId": "API04_post",
        "summary": "Create an order from a READY quote",
        "description": "Consumes a READY quote of this partner account before its validUntil. 202 means stored, not payable: there is no payment address yet; follow statusUrl until the order is payable. The same Idempotency-Key with the same body, or another key with the same clientIntentKey and quoteId, returns the existing order (200) and never creates a second one; that replay reads the order, so it needs scope orders:read as well. When the outcome of a create is unknown (timeout, 5xx, or a 401 or 403 on a retry), the order may exist: retry with the same Idempotency-Key and body, or look it up with GET /v2/orders?clientIntentKey= using a key with orders:read.",
        "tags": [
          "Orders"
        ],
        "x-design-id": "API04",
        "x-audience": "partner",
        "x-phase": 1,
        "x-required-scope": "orders:create",
        "x-rate-limit-category": "order",
        "security": [
          {
            "PartnerBearer": [],
            "KeyID": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/IdempotencyKey"
            },
            "description": "One key per create attempt (per quote), 16-128 printable ASCII characters, no personal data. Keep it, with the identical body, for every retry of that attempt; a different body with the same key is 409 IDEMPOTENCY_CONFLICT."
          }
        ],
        "responses": {
          "200": {
            "description": "The order already created for this Idempotency-Key, or for this clientIntentKey and quoteId: its current view.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerOrder"
                }
              }
            }
          },
          "202": {
            "description": "Stored. Poll statusUrl after Retry-After seconds.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              },
              "Retry-After": {
                "required": true,
                "schema": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 60
                },
                "description": "Seconds before the first poll of statusUrl. Poll the existing order; never generate a new key."
              }
            },
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerOrderAccepted"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST: the request is malformed or breaks the contract (unknown or missing field, bad value, unknown query parameter). Also: Idempotency-Key missing, repeated or not 16-128 printable ASCII characters, and a clientIntentKey other than the quote's.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "INVALID_REQUEST"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "AUTH_REQUIRED: credentials missing, malformed, unknown, wrong, revoked or expired; the response does not say which. Repeated failures from one source address are rate limited (429). After an attempt whose outcome is unknown, a 401 does not prove that no order was created.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            },
            "x-error-codes": [
              "AUTH_REQUIRED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "SCOPE_DENIED: the credential is valid but not allowed this operation now. The key lacks scope orders:create (or, for a replay, orders:read), AllSwap has paused new quotes and orders for this partner account (a replay is refused too while paused), or AllSwap has stopped the \"order\" category for this partner account (X-RateLimit-Limit 0). retryable is false. After an attempt whose outcome is unknown, a 403 does not prove that no order was created. While AllSwap has turned off reads for the partner account, every request is 403 SCOPE_DENIED during authentication, without X-RateLimit headers.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "SCOPE_DENIED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "NOT_FOUND: no such resource for this caller. Unknown quoteId, or a quote of another partner account.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "IDEMPOTENCY_CONFLICT: this Idempotency-Key was used with a different body. INTENT_ALREADY_USED: the clientIntentKey or the quote already belongs to another order. POLICY_CHANGED: the route or its terms changed since pricing; request a new quote. INTENT_ALREADY_USED: error.orderId names the existing order (or find it with GET /v2/orders?clientIntentKey=). POLICY_CHANGED: request a new quote.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_CONFLICT",
              "INTENT_ALREADY_USED",
              "POLICY_CHANGED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "QUOTE_EXPIRED: the quote is too old to be used; request a new quote. validUntil has passed; nothing was created; request a new quote (same clientIntentKey, new Idempotency-Key).",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "QUOTE_EXPIRED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "REFUND_POLICY_UNAVAILABLE: no acceptable refund address for this route. PRICE_CONDITION_UNSUPPORTED: the price conditions (acceptance) cannot be met. The quote's terms can no longer be honoured; nothing was created; request a new quote.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "REFUND_POLICY_UNAVAILABLE",
              "PRICE_CONDITION_UNSUPPORTED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: too many requests for now; retry after Retry-After seconds. The partner's \"order\" bucket is empty, the account already has as many orders awaiting payment as its agreed cap (orders PREPARING before their creation deadline or AWAITING_PAYMENT before their paymentDeadline; a replay is never refused for the cap; Retry-After is then an estimate of when one of them may stop counting, often later than the quote's validUntil: quote again before creating), or too many authentication failures from this source address. Nothing was created. retryable is true.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              },
              "Retry-After": {
                "required": true,
                "schema": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 3600
                },
                "description": "Seconds to wait before retrying. Retry the same request (for POST /v2/orders: the same Idempotency-Key and body)."
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: unexpected failure. retryable is false, but the order may have been created: retry with the same Idempotency-Key and body, or look it up by clientIntentKey.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "TEMPORARILY_UNAVAILABLE: a dependency is unavailable or busy (including route quote capacity); retry after Retry-After. RECOVERY_PENDING: the platform's control state is being verified; retry later. retryable is true. The order may have been created: retry with the same Idempotency-Key and body. TEMPORARILY_UNAVAILABLE is also the answer, nothing created and without costing a token of the partner's \"order\" bucket (the one the request took is given back; the X-RateLimit headers show the bucket after that), while the order capacity that all partner accounts share is used up for now by the orders created and the order requests in flight. Retry-After is then an estimate: the seconds until the next token by refill when orders created used it up, or a few seconds when order requests in flight hold every token (one of them ending frees one or takes it for its order).",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfterUnavailable"
              }
            },
            "x-error-codes": [
              "TEMPORARILY_UNAVAILABLE",
              "RECOVERY_PENDING"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderRequest"
              }
            }
          },
          "x-max-bytes": 65536
        }
      },
      "get": {
        "operationId": "API14_get",
        "summary": "List orders",
        "description": "Summaries of this partner account's orders, newest first: createdAt descending, then orderId descending. Filters combine with AND; status filters apply to the status at the time of reading (status=AWAITING_PAYMENT includes unpaid orders past their payment deadline: use paymentDeadline). Use it to reconcile and to find an order whose orderId was lost (clientIntentKey). An order appears once POST /v2/orders has answered 202 or 200. An order whose state cannot be derived now is listed as RECOVERING instead of failing the page. One request counts once against the \"read\" bucket. Payability is never judged from the list: read the order.",
        "tags": [
          "Orders"
        ],
        "x-design-id": "API14",
        "x-audience": "partner",
        "x-phase": 1,
        "x-required-scope": "orders:read",
        "x-rate-limit-category": "read",
        "security": [
          {
            "PartnerBearer": [],
            "KeyID": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Maximum number of orders on this page (fewer may be returned)."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/Cursor"
            },
            "description": "nextCursor of the previous page, unchanged; omit for the first page."
          },
          {
            "name": "createdFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$"
            },
            "description": "Only orders created at or after this instant (inclusive). RFC 3339 with Z or an offset, at most microseconds; in a URL a \"+\" offset must be written %2B."
          },
          {
            "name": "createdTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,6})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$"
            },
            "description": "Only orders created before this instant (exclusive). Must not be before createdFrom. Same format as createdFrom."
          },
          {
            "name": "status",
            "in": "query",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "PREPARING",
                  "AWAITING_PAYMENT",
                  "PROCESSING",
                  "COMPLETED",
                  "REFUND_PENDING",
                  "REFUNDED",
                  "NEEDS_REVIEW",
                  "NOT_COMPLETED",
                  "RECOVERING"
                ]
              },
              "minItems": 1,
              "maxItems": 9,
              "uniqueItems": true
            },
            "description": "Only orders whose current status is one of these; repeat the parameter for several values."
          },
          {
            "name": "clientIntentKey",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/IntentKey"
            },
            "description": "Only the order created with this clientIntentKey (exact match; at most one order)."
          }
        ],
        "responses": {
          "200": {
            "description": "One page (possibly short or empty while nextCursor is set).",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderList"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST: the request is malformed or breaks the contract (unknown or missing field, bad value, unknown query parameter). Also: an unknown parameter, a repeated single-valued parameter, createdTo before createdFrom, and a cursor that is malformed, from another account, from another listing (different filters) or no longer valid: start again without a cursor.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "INVALID_REQUEST"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "AUTH_REQUIRED: credentials missing, malformed, unknown, wrong, revoked or expired; the response does not say which. Repeated failures from one source address are rate limited (429); failures by others with your key id never lock your key.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            },
            "x-error-codes": [
              "AUTH_REQUIRED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "SCOPE_DENIED: the credential is valid but not allowed this operation now. The key lacks scope orders:read, or AllSwap has stopped the \"read\" category for this partner account (X-RateLimit-Limit 0). retryable is false. While AllSwap has turned off reads for the partner account, every request is 403 SCOPE_DENIED during authentication, without X-RateLimit headers.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "SCOPE_DENIED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: too many requests for now; retry after Retry-After seconds. The partner's \"read\" bucket is empty, or too many authentication failures from this source address. retryable is true.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              },
              "Retry-After": {
                "required": true,
                "schema": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 3600
                },
                "description": "Seconds to wait before retrying. Retry the same request (for POST /v2/orders: the same Idempotency-Key and body)."
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: unexpected failure. retryable is false.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "TEMPORARILY_UNAVAILABLE: a dependency is unavailable or busy (including route quote capacity); retry after Retry-After. RECOVERY_PENDING: the platform's control state is being verified; retry later. retryable is true.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfterUnavailable"
              }
            },
            "x-error-codes": [
              "TEMPORARILY_UNAVAILABLE",
              "RECOVERY_PENDING"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v2/orders/{orderId}": {
      "get": {
        "operationId": "API05_get",
        "summary": "Get an order",
        "description": "The current view of one order of this partner account, and the only place to judge whether it is payable (see paymentInstruction): read it right before showing a payment address. Every key of the account sees the account's orders. Reading never triggers work at the route.",
        "tags": [
          "Orders"
        ],
        "x-design-id": "API05",
        "x-audience": "partner",
        "x-phase": 1,
        "x-required-scope": "orders:read",
        "x-rate-limit-category": "read",
        "security": [
          {
            "PartnerBearer": [],
            "KeyID": []
          }
        ],
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/ID"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The order.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerOrder"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST: the request is malformed or breaks the contract (unknown or missing field, bad value, unknown query parameter). A query parameter was sent; this operation takes none.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "INVALID_REQUEST"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "AUTH_REQUIRED: credentials missing, malformed, unknown, wrong, revoked or expired; the response does not say which. Repeated failures from one source address are rate limited (429); failures by others with your key id never lock your key.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              }
            },
            "x-error-codes": [
              "AUTH_REQUIRED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "SCOPE_DENIED: the credential is valid but not allowed this operation now. The key lacks scope orders:read, or AllSwap has stopped the \"read\" category for this partner account (X-RateLimit-Limit 0). retryable is false. While AllSwap has turned off reads for the partner account, every request is 403 SCOPE_DENIED during authentication, without X-RateLimit headers.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "SCOPE_DENIED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "NOT_FOUND: no such resource for this caller. Unknown order, an orderId that is not a lowercase UUID, or an order of another partner account (indistinguishable).",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: too many requests for now; retry after Retry-After seconds. The partner's \"read\" bucket is empty, or too many authentication failures from this source address. retryable is true.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              },
              "Retry-After": {
                "required": true,
                "schema": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 3600
                },
                "description": "Seconds to wait before retrying. Retry the same request (for POST /v2/orders: the same Idempotency-Key and body)."
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: unexpected failure. retryable is false.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "TEMPORARILY_UNAVAILABLE: a dependency is unavailable or busy (including route quote capacity); retry after Retry-After. RECOVERY_PENDING: the platform's control state is being verified; retry later. retryable is true.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/NoStore"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimitIfAuthenticated"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemainingIfAuthenticated"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitResetIfAuthenticated"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfterUnavailable"
              }
            },
            "x-error-codes": [
              "TEMPORARILY_UNAVAILABLE",
              "RECOVERY_PENDING"
            ],
            "x-max-bytes": 4194304,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "PartnerBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer <secret>. The secret is 43 characters of base64url (32 random bytes), shown once when AllSwap issues the key. Server-to-server only: never ship it to browsers or apps."
      },
      "KeyID": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Key-Id",
        "description": "The key identifier, ak_live_<random> by convention (the server accepts ^[A-Za-z0-9_-]{1,128}$). Not secret; may be logged."
      }
    },
    "headers": {
      "NoStore": {
        "schema": {
          "const": "no-store"
        },
        "description": "Private and transactional responses must never be cached."
      },
      "XRateLimitLimit": {
        "required": true,
        "schema": {
          "type": "integer",
          "minimum": 0
        },
        "description": "Capacity of the partner's token bucket for this operation's rate-limit category (x-rate-limit-category). 0: AllSwap has stopped this category for the partner (requests are then 403 SCOPE_DENIED)."
      },
      "XRateLimitLimitIfAuthenticated": {
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 0
        },
        "description": "Capacity of the partner's token bucket for this operation's rate-limit category (x-rate-limit-category). 0: AllSwap has stopped this category for the partner (requests are then 403 SCOPE_DENIED). Present when the request was authenticated."
      },
      "XRateLimitRemaining": {
        "required": true,
        "schema": {
          "type": "integer",
          "minimum": 0
        },
        "description": "Tokens left in that bucket now; each request takes one."
      },
      "XRateLimitRemainingIfAuthenticated": {
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 0
        },
        "description": "Tokens left in that bucket now; each request takes one. Present when the request was authenticated."
      },
      "XRateLimitReset": {
        "required": true,
        "schema": {
          "type": "integer",
          "minimum": 0
        },
        "description": "Unix time in seconds (UTC) at which the bucket will be full again at its agreed refill rate."
      },
      "XRateLimitResetIfAuthenticated": {
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 0
        },
        "description": "Unix time in seconds (UTC) at which the bucket will be full again at its agreed refill rate. Present when the request was authenticated."
      },
      "RetryAfterUnavailable": {
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 3600
        },
        "description": "Seconds to wait before retrying, when known."
      }
    },
    "schemas": {
      "Acceptance": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "commitMinAmountOut": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PositiveAmount"
              },
              {
                "type": "null"
              }
            ]
          },
          "requireProviderMinimum": {
            "type": "boolean"
          },
          "guaranteedMinAmountOut": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PositiveAmount"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "commitMinAmountOut",
          "requireProviderMinimum",
          "guaranteedMinAmountOut"
        ],
        "allOf": [
          {
            "if": {
              "properties": {
                "requireProviderMinimum": {
                  "const": true
                }
              }
            },
            "then": {
              "properties": {
                "guaranteedMinAmountOut": {
                  "$ref": "#/components/schemas/PositiveAmount"
                }
              }
            },
            "else": {
              "properties": {
                "guaranteedMinAmountOut": {
                  "type": "null"
                }
              }
            }
          }
        ]
      },
      "AcceptanceView": {
        "type": "object",
        "properties": {
          "commitMinAmountOut": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PositiveAmount"
              },
              {
                "type": "null"
              }
            ]
          },
          "requireProviderMinimum": {
            "type": "boolean"
          },
          "guaranteedMinAmountOut": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PositiveAmount"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "commitMinAmountOut",
          "requireProviderMinimum",
          "guaranteedMinAmountOut"
        ],
        "allOf": [
          {
            "if": {
              "properties": {
                "requireProviderMinimum": {
                  "const": true
                }
              }
            },
            "then": {
              "properties": {
                "guaranteedMinAmountOut": {
                  "$ref": "#/components/schemas/PositiveAmount"
                }
              }
            },
            "else": {
              "properties": {
                "guaranteedMinAmountOut": {
                  "type": "null"
                }
              }
            }
          }
        ],
        "description": "Acceptance in responses (open copy of the request schema Acceptance)."
      },
      "Address": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "chainId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "address": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "memo": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 256
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "chainId",
          "address"
        ]
      },
      "AddressView": {
        "type": "object",
        "properties": {
          "chainId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "address": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "memo": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 256
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "chainId",
          "address"
        ],
        "description": "Address in responses (open copy of the request schema Address)."
      },
      "Amount": {
        "type": "string",
        "pattern": "^(0|[1-9][0-9]{0,77})$"
      },
      "Asset": {
        "type": "object",
        "properties": {
          "assetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "chainId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "decimals": {
            "type": "integer",
            "minimum": 0,
            "maximum": 77
          },
          "symbol": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "quotable": {
            "type": "boolean",
            "description": "True exactly when sourceGroups or destinationGroups is non-empty."
          },
          "sourceGroups": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z]{1,8}$"
            },
            "maxItems": 8,
            "uniqueItems": true,
            "description": "Route groups in which this asset can be sent (the source of a pair). Opaque labels: only a source asset and a destination asset whose sourceGroups and destinationGroups share a label can form a pair. A shared label does not guarantee a route at this moment: a preview or quote can still answer 422 NO_ROUTE. A label means the same within one response; clients must not assume it is stable across responses."
          },
          "destinationGroups": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z]{1,8}$"
            },
            "maxItems": 8,
            "uniqueItems": true,
            "description": "Route groups in which this asset can be received (the destination of a pair). Opaque labels: only a source asset and a destination asset whose sourceGroups and destinationGroups share a label can form a pair. A shared label does not guarantee a route at this moment: a preview or quote can still answer 422 NO_ROUTE. A label means the same within one response; clients must not assume it is stable across responses."
          },
          "minAmountIn": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PositiveAmount"
              },
              {
                "type": "null"
              }
            ],
            "description": "The platform's minimum payment in this asset as the source of a pair, in base units; null or absent: none. A preview or quote asking less is refused with AMOUNT_OUT_OF_RANGE. It does not change the route groups."
          }
        },
        "required": [
          "assetId",
          "version",
          "chainId",
          "decimals",
          "symbol",
          "quotable",
          "sourceGroups",
          "destinationGroups"
        ]
      },
      "AssetID": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      },
      "AssetsResponse": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "Z$"
          },
          "stale": {
            "type": "boolean"
          },
          "assets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Asset"
            },
            "maxItems": 1000
          },
          "nextCursor": {
            "type": "null",
            "description": "Always null: the response lists every asset. Kept for compatibility."
          }
        },
        "required": [
          "version",
          "observedAt",
          "stale",
          "assets",
          "nextCursor"
        ]
      },
      "CreateOrderRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "quoteId": {
            "$ref": "#/components/schemas/ID"
          },
          "clientIntentKey": {
            "$ref": "#/components/schemas/IntentKey"
          }
        },
        "required": [
          "quoteId",
          "clientIntentKey"
        ]
      },
      "Cursor": {
        "type": "string",
        "minLength": 1,
        "maxLength": 2048,
        "pattern": "^[A-Za-z0-9_-]+$",
        "description": "Opaque page cursor (URL-safe). It is bound to the partner account and to the filters of the listing that returned it; send it back unchanged with the same filters."
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "INVALID_REQUEST",
                  "AUTH_REQUIRED",
                  "SCOPE_DENIED",
                  "NOT_FOUND",
                  "IDEMPOTENCY_CONFLICT",
                  "INTENT_ALREADY_USED",
                  "POLICY_CHANGED",
                  "STATE_VERSION_CHANGED",
                  "QUOTE_EXPIRED",
                  "NO_ROUTE",
                  "REFUND_POLICY_UNAVAILABLE",
                  "PRICE_CONDITION_UNSUPPORTED",
                  "AMOUNT_OUT_OF_RANGE",
                  "RATE_LIMITED",
                  "TEMPORARILY_UNAVAILABLE",
                  "RECOVERY_PENDING",
                  "INTERNAL_ERROR"
                ],
                "description": "Machine-readable error code. New codes may be added in later versions; treat an unknown code by its HTTP status. Extensible: treat an unknown code by its HTTP status.",
                "x-extensible-enum": true
              },
              "message": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "description": "Safe human-readable text (it may equal the code). Not for program logic; may change at any time."
              },
              "retryable": {
                "type": "boolean",
                "description": "True when the same request may be sent again unchanged (after Retry-After when present): 429 and 503. False otherwise; see the operation for what to do instead."
              },
              "requestId": {
                "type": "string",
                "pattern": "^[0-9a-f]{32}$",
                "description": "Identifier of this request for support. Not a credential."
              },
              "orderId": {
                "$ref": "#/components/schemas/ID",
                "description": "The existing order this error concerns: set on 409 INTENT_ALREADY_USED of POST /v2/orders (the order that already holds the clientIntentKey or the quote, always one of the same partner account); absent otherwise."
              }
            },
            "required": [
              "code",
              "message",
              "retryable",
              "requestId"
            ]
          }
        },
        "required": [
          "error"
        ],
        "description": "Every error response: {\"error\":{code,message,retryable,requestId}}. No upstream, credential or internal detail is ever included."
      },
      "FeeDisclosure": {
        "type": "object",
        "properties": {
          "displayBps": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "includedInQuote": {
            "type": "boolean"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          }
        },
        "required": [
          "displayBps",
          "includedInQuote",
          "description"
        ]
      },
      "Generation": {
        "type": "string",
        "pattern": "^[1-9][0-9]{0,19}$"
      },
      "GuaranteeTerms": {
        "type": "object",
        "properties": {
          "assetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "applicableAmountIn": {
            "$ref": "#/components/schemas/PositiveAmount"
          },
          "paymentDeadline": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "Z$"
              },
              {
                "type": "null"
              }
            ]
          },
          "feesIncluded": {
            "type": "boolean"
          },
          "deviationHandling": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "termsVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        "required": [
          "assetId",
          "applicableAmountIn",
          "paymentDeadline",
          "feesIncluded",
          "deviationHandling",
          "termsVersion"
        ]
      },
      "ID": {
        "type": "string",
        "format": "uuid",
        "pattern": "^[0-9a-f-]{36}$",
        "not": {
          "const": "00000000-0000-0000-0000-000000000000"
        },
        "description": "A UUID in lowercase hexadecimal with hyphens. Uppercase spellings are not accepted (404 in a path, 400 in a body)."
      },
      "IdempotencyKey": {
        "type": "string",
        "minLength": 16,
        "maxLength": 128,
        "pattern": "^[ -~]+$"
      },
      "IntentKey": {
        "type": "string",
        "minLength": 16,
        "maxLength": 128,
        "pattern": "^[A-Za-z0-9_-]+$"
      },
      "OrderList": {
        "type": "object",
        "properties": {
          "orders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderSummary"
            },
            "maxItems": 100
          },
          "nextCursor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Cursor"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "orders",
          "nextCursor"
        ],
        "description": "One page of the partner's orders, newest first (createdAt, then orderId, both descending). A page can hold fewer orders than limit, or none, while nextCursor is set (for example when the page's scan budget ran out); only a null nextCursor ends the listing."
      },
      "OrderSummary": {
        "type": "object",
        "properties": {
          "orderId": {
            "$ref": "#/components/schemas/ID"
          },
          "clientIntentKey": {
            "$ref": "#/components/schemas/IntentKey",
            "description": "The clientIntentKey the order was created with: the partner's own reconciliation key. Not a secret; must not contain personal data."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "Z$",
            "description": "When the order was stored (the start of its creating transaction: it can be a few seconds before the order became visible)."
          },
          "status": {
            "type": "string",
            "enum": [
              "PREPARING",
              "AWAITING_PAYMENT",
              "PROCESSING",
              "COMPLETED",
              "REFUND_PENDING",
              "REFUNDED",
              "NEEDS_REVIEW",
              "NOT_COMPLETED",
              "RECOVERING"
            ],
            "description": "The same status GET /v2/orders/{orderId} shows at the same moment. RECOVERING: the list cannot derive this order's state now (not expected in normal operation; also an order of an earlier platform generation, which the single read then refuses too: 503 RECOVERY_PENDING before the route accepted the order, 401 AUTH_REQUIRED after it in this version, although the key is fine). Never replace a view kept from GET /v2/orders/{orderId} with a summary (a RECOVERING summary carries the same stateVersion as the last view); retry the single read later. Extensible: later versions may add values; do not fail on an unknown value, treat it as in progress (never as payable or final).",
            "x-extensible-enum": true
          },
          "executionState": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "PREPARING",
                  "SUBMISSION_UNKNOWN",
                  "AWAITING_PAYMENT",
                  "PROCESSING",
                  "SUCCEEDED",
                  "FAILED",
                  "CANCELLED_BEFORE_CREATE"
                ],
                "x-extensible-enum": true
              },
              {
                "type": "null"
              }
            ],
            "description": "Progress of the swap at the route. SUBMISSION_UNKNOWN: whether the route accepted the order is being established; nothing to pay for now, keep polling; it can still be confirmed (and become payable) or be closed. Never create the order again. Null only when status is RECOVERING. Extensible: later versions may add values; do not fail on an unknown value, treat it as in progress (never as payable or final)."
          },
          "fundingState": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "NOT_OBSERVED",
                  "OBSERVED",
                  "CONFIRMING",
                  "CONFIRMED",
                  "PARTIAL",
                  "EXCESS",
                  "CONFLICTED"
                ],
                "x-extensible-enum": true
              },
              {
                "type": "null"
              }
            ],
            "description": "What has been observed of the user's payment to the payment instruction: NOT_OBSERVED, OBSERVED, CONFIRMING, CONFIRMED (the requested amount, confirmed), PARTIAL (less than requested), EXCESS (more than requested; the order then needs review), CONFLICTED (contradictory facts; amounts withheld; the order needs review). Null only when status is RECOVERING. Extensible: later versions may add values; do not fail on an unknown value, treat it as in progress (never as payable or final)."
          },
          "recoveryState": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "NONE",
                  "REVIEW_REQUIRED",
                  "REFUND_PENDING",
                  "REFUND_CONFIRMED",
                  "CLOSED_WITH_EVIDENCE"
                ],
                "x-extensible-enum": true
              },
              {
                "type": "null"
              }
            ],
            "description": "NONE; REVIEW_REQUIRED (held for manual handling); REFUND_CONFIRMED (the refund was verified); CLOSED_WITH_EVIDENCE (closed by an operator after review). REFUND_PENDING is not produced in this version. Null only when status is RECOVERING. Extensible: later versions may add values; do not fail on an unknown value, treat it as in progress (never as payable or final)."
          },
          "fromAssetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "toAssetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "amountInRequested": {
            "$ref": "#/components/schemas/PositiveAmount"
          },
          "amountInObserved": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Amount"
              },
              {
                "type": "null"
              }
            ],
            "description": "Payment observed so far, in base units of fromAssetId; null when none or unknown."
          },
          "amountOutExpected": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Amount"
              },
              {
                "type": "null"
              }
            ],
            "description": "Expected output in base units of toAssetId; an estimate, not a guarantee."
          },
          "amountOutConfirmed": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Amount"
              },
              {
                "type": "null"
              }
            ],
            "description": "The amount received, in base units of toAssetId, when known."
          },
          "paymentDeadline": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "Z$"
              },
              {
                "type": "null"
              }
            ],
            "description": "The payment instruction's deadline; null before the route accepted the order or when the route states none. An order with status AWAITING_PAYMENT past this deadline is in effect expired."
          },
          "stateVersion": {
            "$ref": "#/components/schemas/StateVersion",
            "description": "The order's stateVersion at the time of reading (see PartnerOrder)."
          }
        },
        "required": [
          "orderId",
          "clientIntentKey",
          "createdAt",
          "status",
          "executionState",
          "fundingState",
          "recoveryState",
          "fromAssetId",
          "toAssetId",
          "amountInRequested",
          "amountInObserved",
          "amountOutExpected",
          "amountOutConfirmed",
          "paymentDeadline",
          "stateVersion"
        ],
        "allOf": [
          {
            "if": {
              "properties": {
                "status": {
                  "not": {
                    "const": "RECOVERING"
                  }
                }
              }
            },
            "then": {
              "properties": {
                "executionState": {
                  "type": "string"
                },
                "fundingState": {
                  "type": "string"
                },
                "recoveryState": {
                  "type": "string"
                }
              }
            }
          }
        ],
        "description": "One order in the order list: a summary for reconciliation. Whether an order is payable cannot be judged from it: read GET /v2/orders/{orderId}, which alone has the payment instruction, transfers and refunds."
      },
      "PartnerOrder": {
        "type": "object",
        "properties": {
          "orderId": {
            "$ref": "#/components/schemas/ID"
          },
          "clientIntentKey": {
            "$ref": "#/components/schemas/IntentKey",
            "description": "The clientIntentKey the order was created with: the partner's own reconciliation key. Not a secret; must not contain personal data."
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Revision of the order's stored state; equals stateVersion.sequence. It does not increase with every visible change: a view can change while it stays the same."
          },
          "stateVersion": {
            "$ref": "#/components/schemas/StateVersion",
            "description": "Version of the order's stored state, not of this view: two reads with the same stateVersion can differ (the state before the route accepted the order, an operator's resolution, paymentInstruction.state and stale change without a new version). Keep the latest read: replace your stored view whenever a new read has a stateVersion not lower than the stored one (equal included). Compare generation first, as an integer (a decimal string of up to 20 digits: compare it as a big integer, not as a string or a double), then sequence."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "Z$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "Z$",
            "description": "Last change of the stored state, or of an operator's resolution. Equals createdAt before the route accepted the order (except an order an operator closed then)."
          },
          "status": {
            "type": "string",
            "enum": [
              "PREPARING",
              "AWAITING_PAYMENT",
              "PROCESSING",
              "COMPLETED",
              "REFUND_PENDING",
              "REFUNDED",
              "NEEDS_REVIEW",
              "NOT_COMPLETED",
              "RECOVERING"
            ],
            "description": "Summary for display and polling. PREPARING: not yet accepted by the route. AWAITING_PAYMENT: accepted; payable only under the rule of paymentInstruction; after the payment deadline it is in effect expired (there is no separate expired status). PROCESSING: a payment was observed or the swap is under way. COMPLETED: done. NEEDS_REVIEW: held for manual handling; never pay. REFUNDED: refund verified. NOT_COMPLETED: will not complete (never created at the route, or closed after review). REFUND_PENDING and RECOVERING are not produced in this version. Treat an unknown value as \"in progress\": no payment, keep polling. Extensible: later versions may add values; do not fail on an unknown value, treat it as in progress (never as payable or final).",
            "x-extensible-enum": true
          },
          "executionState": {
            "type": "string",
            "enum": [
              "PREPARING",
              "SUBMISSION_UNKNOWN",
              "AWAITING_PAYMENT",
              "PROCESSING",
              "SUCCEEDED",
              "FAILED",
              "CANCELLED_BEFORE_CREATE"
            ],
            "description": "Progress of the swap at the route. SUBMISSION_UNKNOWN: whether the route accepted the order is being established; nothing to pay for now, keep polling; it can still be confirmed (and become payable) or be closed. Never create the order again. Extensible: later versions may add values; do not fail on an unknown value, treat it as in progress (never as payable or final).",
            "x-extensible-enum": true
          },
          "fundingState": {
            "type": "string",
            "enum": [
              "NOT_OBSERVED",
              "OBSERVED",
              "CONFIRMING",
              "CONFIRMED",
              "PARTIAL",
              "EXCESS",
              "CONFLICTED"
            ],
            "description": "What has been observed of the user's payment to the payment instruction: NOT_OBSERVED, OBSERVED, CONFIRMING, CONFIRMED (the requested amount, confirmed), PARTIAL (less than requested), EXCESS (more than requested; the order then needs review), CONFLICTED (contradictory facts; amounts withheld; the order needs review). Extensible: later versions may add values; do not fail on an unknown value, treat it as in progress (never as payable or final).",
            "x-extensible-enum": true
          },
          "recoveryState": {
            "type": "string",
            "enum": [
              "NONE",
              "REVIEW_REQUIRED",
              "REFUND_PENDING",
              "REFUND_CONFIRMED",
              "CLOSED_WITH_EVIDENCE"
            ],
            "description": "NONE; REVIEW_REQUIRED (held for manual handling); REFUND_CONFIRMED (the refund was verified); CLOSED_WITH_EVIDENCE (closed by an operator after review). REFUND_PENDING is not produced in this version. Extensible: later versions may add values; do not fail on an unknown value, treat it as in progress (never as payable or final).",
            "x-extensible-enum": true
          },
          "paymentMode": {
            "const": "DEPOSIT_ADDRESS"
          },
          "fromAssetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "toAssetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "amountInRequested": {
            "$ref": "#/components/schemas/PositiveAmount"
          },
          "amountInObserved": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Amount"
              },
              {
                "type": "null"
              }
            ],
            "description": "Payment observed so far, in base units of fromAssetId; null when none or unknown."
          },
          "amountOutExpected": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Amount"
              },
              {
                "type": "null"
              }
            ],
            "description": "Expected output in base units of toAssetId; an estimate, not a guarantee."
          },
          "amountOutConfirmed": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Amount"
              },
              {
                "type": "null"
              }
            ],
            "description": "The amount received, in base units of the target asset. Not null on a COMPLETED order, except one an operator completed after review (recoveryState CLOSED_WITH_EVIDENCE) without recording the amount; the amount received is then that of the payout transaction."
          },
          "recipient": {
            "$ref": "#/components/schemas/AddressView"
          },
          "paymentInstruction": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PaymentInstruction"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null until the route has accepted the order (and again after an operator resolution or closure). Payable only when ALL hold, judged on a read made just before you show it: stale is false; status and executionState are AWAITING_PAYMENT; recoveryState is NONE; state is ACTIVE; paymentDeadline is null or in the future; reusable is false and amountRule is EXACT; assetId, chainId and amountRequested equal the order's fromAssetId, its chain and amountInRequested; and the order's fromAssetId, toAssetId, amountInRequested and recipient equal the quote it was created from. Then ask for exactly amountRequested of assetId on chainId to address, with memo when it is not null (if the user's wallet cannot attach the memo, do not pay). NEVER cache payability: state and stale are judged at the time of each read. SUSPENDED: not payable now (payment observed, order paused or under review). DEADLINE_PASSED: never pay."
          },
          "transfers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Transfer"
            },
            "maxItems": 1000,
            "description": "Verified movements: IN (the user's payment to the payment instruction), OUT (the payout to the recipient). REFUND transfers are not produced in this version."
          },
          "refunds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Refund"
            },
            "maxItems": 1000,
            "description": "Always empty in this version; a refund shows as status and recoveryState."
          },
          "lastVerifiedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "Z$"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the platform last verified this order with its route (after an operator resolution: the resolution time); null before the first verification."
          },
          "stale": {
            "type": "boolean",
            "description": "True when this view is not currently verified (not yet checked, a check is overdue, or the order needs review). Never offer payment from a stale view. COMPLETED and REFUNDED count as final only when stale is false; NOT_COMPLETED is final whatever stale says (before the route accepted an order, stale is always true)."
          },
          "nextCheckAfter": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "Z$"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the platform next checks this order; polling earlier rarely shows anything new. Null before the route accepted the order. When observation has ended it stays at that time, in the past: then poll at most once a minute. An unpaid order past its payment deadline needs no polling of its own, but it is not final: the platform keeps checking its deposit address, and a payment seen after the deadline (one sent just before it, or a late one) can still take the order to PROCESSING, COMPLETED or NEEDS_REVIEW; check it through the order list from time to time until it reaches a final state."
          }
        },
        "required": [
          "orderId",
          "clientIntentKey",
          "revision",
          "stateVersion",
          "createdAt",
          "updatedAt",
          "status",
          "executionState",
          "fundingState",
          "recoveryState",
          "paymentMode",
          "fromAssetId",
          "toAssetId",
          "amountInRequested",
          "amountInObserved",
          "amountOutExpected",
          "amountOutConfirmed",
          "recipient",
          "paymentInstruction",
          "transfers",
          "refunds",
          "lastVerifiedAt",
          "stale",
          "nextCheckAfter"
        ],
        "allOf": [
          {
            "if": {
              "properties": {
                "status": {
                  "enum": [
                    "PREPARING",
                    "RECOVERING"
                  ]
                }
              }
            },
            "then": {
              "properties": {
                "paymentInstruction": {
                  "type": "null"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "executionState": {
                  "const": "SUBMISSION_UNKNOWN"
                }
              }
            },
            "then": {
              "properties": {
                "paymentInstruction": {
                  "type": "null"
                },
                "status": {
                  "enum": [
                    "NEEDS_REVIEW",
                    "RECOVERING"
                  ]
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "status": {
                  "const": "COMPLETED"
                }
              }
            },
            "then": {
              "properties": {
                "amountOutConfirmed": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/PositiveAmount"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "lastVerifiedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "Z$"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "status": {
                  "const": "COMPLETED"
                },
                "recoveryState": {
                  "not": {
                    "const": "CLOSED_WITH_EVIDENCE"
                  }
                }
              }
            },
            "then": {
              "properties": {
                "amountOutConfirmed": {
                  "$ref": "#/components/schemas/PositiveAmount"
                }
              }
            }
          }
        ],
        "description": "An order as a partner sees it (GET /v2/orders/{orderId}, events). It never carries a recovery code."
      },
      "PartnerOrderAccepted": {
        "type": "object",
        "properties": {
          "orderId": {
            "$ref": "#/components/schemas/ID"
          },
          "status": {
            "const": "PREPARING"
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "stateVersion": {
            "$ref": "#/components/schemas/StateVersion"
          },
          "statusUrl": {
            "type": "string",
            "pattern": "^/v2/orders/[0-9a-f-]{36}$",
            "description": "Path of the order relative to the API server: GET it to follow the order."
          },
          "requestId": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          }
        },
        "required": [
          "orderId",
          "status",
          "revision",
          "stateVersion",
          "statusUrl",
          "requestId"
        ],
        "description": "An order accepted by POST /v2/orders: stored, not yet payable. No payment address yet; follow statusUrl."
      },
      "PartnerQuoteResponse": {
        "type": "object",
        "properties": {
          "quoteId": {
            "$ref": "#/components/schemas/ID"
          },
          "quoteKind": {
            "const": "READY"
          },
          "routeChoiceId": {
            "$ref": "#/components/schemas/ID",
            "description": "Random opaque identifier of this quote's route choice, new for every quote. It names no upstream."
          },
          "fromAssetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "toAssetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "amountIn": {
            "$ref": "#/components/schemas/PositiveAmount"
          },
          "amountOutExpected": {
            "$ref": "#/components/schemas/PositiveAmount"
          },
          "minAmountOut": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PositiveAmount"
              },
              {
                "type": "null"
              }
            ]
          },
          "priceGuarantee": {
            "type": "string",
            "enum": [
              "ESTIMATE_ONLY",
              "PROVIDER_MINIMUM"
            ],
            "x-extensible-enum": true,
            "description": "Extensible: treat an unknown value as ESTIMATE_ONLY (no guarantee)."
          },
          "guaranteeTerms": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/GuaranteeTerms"
              },
              {
                "type": "null"
              }
            ]
          },
          "acceptance": {
            "$ref": "#/components/schemas/AcceptanceView"
          },
          "validUntil": {
            "type": "string",
            "format": "date-time",
            "pattern": "Z$",
            "description": "Last moment to create the order: the quote's creation deadline (pricing time plus the route's maximum quote age, or an earlier expiry the route stated) minus a safety margin. From then on POST /v2/orders answers 410 QUOTE_EXPIRED. Create the order right away: an order created close to the end can still answer 202 and then end NOT_COMPLETED (CANCELLED_BEFORE_CREATE) when the route cannot be reached in time, and that consumes the clientIntentKey."
          },
          "recipient": {
            "$ref": "#/components/schemas/AddressView"
          },
          "refundDisclosure": {
            "$ref": "#/components/schemas/RefundDisclosure"
          },
          "feeDisclosure": {
            "$ref": "#/components/schemas/FeeDisclosure",
            "description": "AllSwap's own service fee, already included in amountOutExpected. Upstream costs (such as network fees) are also reflected in the quoted amount and are not part of displayBps. It comes from platform configuration only and is the same for every caller."
          },
          "paymentMode": {
            "const": "DEPOSIT_ADDRESS"
          },
          "policyVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "description": "Opaque identifier and version of the pricing policy used: the same value for the same route and policy version. It names no upstream."
          },
          "requestId": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          }
        },
        "required": [
          "quoteId",
          "quoteKind",
          "routeChoiceId",
          "fromAssetId",
          "toAssetId",
          "amountIn",
          "amountOutExpected",
          "minAmountOut",
          "priceGuarantee",
          "guaranteeTerms",
          "acceptance",
          "validUntil",
          "recipient",
          "refundDisclosure",
          "feeDisclosure",
          "paymentMode",
          "policyVersion",
          "requestId"
        ],
        "allOf": [
          {
            "if": {
              "properties": {
                "priceGuarantee": {
                  "const": "PROVIDER_MINIMUM"
                }
              }
            },
            "then": {
              "properties": {
                "minAmountOut": {
                  "$ref": "#/components/schemas/PositiveAmount"
                },
                "guaranteeTerms": {
                  "$ref": "#/components/schemas/GuaranteeTerms"
                }
              }
            },
            "else": {
              "properties": {
                "minAmountOut": {
                  "type": "null"
                },
                "guaranteeTerms": {
                  "type": "null"
                }
              }
            }
          }
        ],
        "description": "A READY quote as a partner receives it: the website's quote with validUntil always set."
      },
      "PaymentInstruction": {
        "type": "object",
        "properties": {
          "instructionId": {
            "$ref": "#/components/schemas/ID"
          },
          "chainId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "assetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "address": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "memo": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 256
              },
              {
                "type": "null"
              }
            ]
          },
          "amountRequested": {
            "$ref": "#/components/schemas/PositiveAmount"
          },
          "amountRule": {
            "type": "string",
            "enum": [
              "EXACT"
            ],
            "x-extensible-enum": true,
            "description": "Extensible: any value other than EXACT means do not pay."
          },
          "paymentDeadline": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "Z$"
              },
              {
                "type": "null"
              }
            ]
          },
          "reusable": {
            "const": false
          },
          "state": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DEADLINE_PASSED",
              "SUSPENDED"
            ],
            "x-extensible-enum": true,
            "description": "Extensible: any value other than ACTIVE means do not pay."
          }
        },
        "required": [
          "instructionId",
          "chainId",
          "assetId",
          "address",
          "memo",
          "amountRequested",
          "amountRule",
          "paymentDeadline",
          "reusable",
          "state"
        ]
      },
      "PositiveAmount": {
        "type": "string",
        "pattern": "^[1-9][0-9]{0,77}$"
      },
      "PreviewRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "fromAssetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "toAssetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "amount": {
            "$ref": "#/components/schemas/PositiveAmount"
          },
          "paymentMode": {
            "const": "DEPOSIT_ADDRESS"
          },
          "swapType": {
            "const": "EXACT_INPUT",
            "default": "EXACT_INPUT"
          },
          "slippageBps": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          }
        },
        "required": [
          "fromAssetId",
          "toAssetId",
          "amount",
          "paymentMode"
        ]
      },
      "PreviewResponse": {
        "type": "object",
        "properties": {
          "quoteKind": {
            "const": "ESTIMATE"
          },
          "fromAssetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "toAssetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "amountIn": {
            "$ref": "#/components/schemas/PositiveAmount"
          },
          "amountOutExpected": {
            "$ref": "#/components/schemas/PositiveAmount"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "Z$"
          },
          "conditions": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "priceGuarantee": {
            "const": "ESTIMATE_ONLY"
          },
          "requestId": {
            "type": "string",
            "pattern": "^[0-9a-f]{32}$"
          }
        },
        "required": [
          "quoteKind",
          "fromAssetId",
          "toAssetId",
          "amountIn",
          "amountOutExpected",
          "observedAt",
          "conditions",
          "priceGuarantee",
          "requestId"
        ]
      },
      "QuoteRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "fromAssetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "toAssetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "amount": {
            "$ref": "#/components/schemas/PositiveAmount"
          },
          "paymentMode": {
            "const": "DEPOSIT_ADDRESS"
          },
          "swapType": {
            "const": "EXACT_INPUT",
            "default": "EXACT_INPUT"
          },
          "slippageBps": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "recipient": {
            "$ref": "#/components/schemas/Address",
            "description": "Where the output is paid: an address on the chain of toAssetId, valid for that chain. A memo must be absent or null in this version (400 INVALID_REQUEST otherwise): a receiving address that needs a memo, tag or note to be credited (for example some exchange deposit addresses on XRP or TON) cannot be the recipient; refuse it in your own interface."
          },
          "clientIntentKey": {
            "$ref": "#/components/schemas/IntentKey",
            "description": "One key per user intent, chosen by the caller (16-128 of A-Z, a-z, 0-9, _ and -). Keep it when re-quoting the same intent; it is consumed when an order is created and then cannot create a second order. It is returned in the partner's order views as a reconciliation key: it is not a secret and must not contain personal data."
          },
          "refundPreference": {
            "$ref": "#/components/schemas/RefundPreference",
            "description": "Partners must send USER_ADDRESS with an address on the chain of fromAssetId (no memo). Partner accounts have no platform fallback wallet: EXISTING_APPROVED_POLICY, and a refund address that fails the chain's checks, are answered 422 REFUND_POLICY_UNAVAILABLE. (The website may use EXISTING_APPROVED_POLICY.)"
          },
          "acceptance": {
            "$ref": "#/components/schemas/Acceptance",
            "description": "Price conditions; all three fields are required. commitMinAmountOut (or null) is compared with the route's expected output only: when the quote is priced (above it: 422 PRICE_CONDITION_UNSUPPORTED) and when the route accepts the order (below it: the order is never made payable and goes to manual handling, NEEDS_REVIEW with executionState SUBMISSION_UNKNOWN). It never guarantees the amount actually received. No route offers a provider minimum in this version: requireProviderMinimum true is answered 422 PRICE_CONDITION_UNSUPPORTED."
          }
        },
        "required": [
          "fromAssetId",
          "toAssetId",
          "amount",
          "paymentMode",
          "recipient",
          "clientIntentKey",
          "refundPreference",
          "acceptance"
        ]
      },
      "Refund": {
        "type": "object",
        "properties": {
          "refundId": {
            "$ref": "#/components/schemas/ID"
          },
          "assetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "amount": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Amount"
              },
              {
                "type": "null"
              }
            ]
          },
          "recipient": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AddressView"
              },
              {
                "type": "null"
              }
            ]
          },
          "txHash": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "REVIEW_REQUIRED",
              "REFUND_PENDING",
              "REFUND_CONFIRMED"
            ],
            "x-extensible-enum": true,
            "description": "Extensible: treat an unknown value as not confirmed."
          },
          "verifiedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "Z$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "refundId",
          "assetId",
          "amount",
          "recipient",
          "txHash",
          "status",
          "verifiedAt"
        ]
      },
      "RefundDisclosure": {
        "type": "object",
        "properties": {
          "policyVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          }
        },
        "required": [
          "policyVersion",
          "description"
        ]
      },
      "RefundPreference": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "mode": {
                "const": "EXISTING_APPROVED_POLICY"
              }
            },
            "required": [
              "mode"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "mode": {
                "const": "USER_ADDRESS"
              },
              "address": {
                "$ref": "#/components/schemas/Address"
              }
            },
            "required": [
              "mode",
              "address"
            ]
          }
        ]
      },
      "StateVersion": {
        "type": "object",
        "properties": {
          "generation": {
            "$ref": "#/components/schemas/Generation"
          },
          "sequence": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "generation",
          "sequence"
        ]
      },
      "Transfer": {
        "type": "object",
        "properties": {
          "transferId": {
            "$ref": "#/components/schemas/ID"
          },
          "direction": {
            "type": "string",
            "enum": [
              "IN",
              "OUT",
              "REFUND"
            ],
            "x-extensible-enum": true,
            "description": "Extensible: ignore a transfer with an unknown direction."
          },
          "chainId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "assetId": {
            "$ref": "#/components/schemas/AssetID"
          },
          "amount": {
            "$ref": "#/components/schemas/Amount"
          },
          "recipient": {
            "$ref": "#/components/schemas/AddressView"
          },
          "txHash": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "OBSERVED",
              "CONFIRMED"
            ],
            "x-extensible-enum": true,
            "description": "Extensible: treat an unknown value as not confirmed."
          },
          "verifiedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "Z$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "transferId",
          "direction",
          "chainId",
          "assetId",
          "amount",
          "recipient",
          "txHash",
          "status",
          "verifiedAt"
        ]
      }
    }
  },
  "externalDocs": {
    "description": "AllSwap Partner API v2 Documentation",
    "url": "https://allswap.io/docs/api"
  }
}
