{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/xmrtousdc-xyz/json-schema/xmrtousdc-xyz-agent-swap-request-schema.json",
  "title": "AgentSwapRequest",
  "description": "Quote-bound create: the body can be just { \"quoteId\": \"q_...\" }. direction, chain, amount and to come from the stored quote; any that are sent must match it (409 quote_mismatch, details.mismatched). to is required only when the quote had none (400 destination_required). A quote opens at most one order (409 quote_already_used under another key).",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/xmrtousdc-xyz-openapi.json#/components/schemas/AgentSwapRequest",
  "type": "object",
  "required": [
    "quoteId"
  ],
  "properties": {
    "quoteId": {
      "type": "string",
      "pattern": "^q_[a-f0-9]{32}$",
      "description": "data.quoteId from POST /agent/swap/quote. Required by default (400 quote_required)."
    },
    "to": {
      "type": "string",
      "description": "Destination, needed only when the quote had none. x2u: EVM address (0x + 40 hex; a mixed-case address must pass EIP-55; never the zero address or a token contract). u2x: Monero mainnet address (95 or 106 chars, checksum verified). Surrounding spaces are trimmed."
    },
    "direction": {
      "type": "string",
      "enum": [
        "x2u",
        "u2x"
      ],
      "description": "Optional; must match the quote."
    },
    "chain": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "integer"
        }
      ],
      "description": "Optional; must match the quote."
    },
    "amount": {
      "type": "string",
      "pattern": "^[0-9]+(\\.[0-9]*)?$",
      "description": "Optional; must equal the quote's data.amount."
    },
    "quoteIntentDigest": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$",
      "description": "Optional: data.intentCommitment.digest from the quote (requires quoteId). Swapper compares it with the stored quote before creating a new order; a mismatch is 409 quote_intent_mismatch."
    },
    "sessionId": {
      "type": "string",
      "format": "uuid",
      "description": "Optional grouping UUID. Usually omit it: the BFF derives one from the idempotency-key, and GET /agent/swap/orders?idempotencyKey= finds the order either way."
    }
  }
}