{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/xmrtousdc-xyz/json-schema/xmrtousdc-xyz-create-response-schema.json",
  "title": "CreateResponse",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/xmrtousdc-xyz-openapi.json#/components/schemas/CreateResponse",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "operation": {
      "type": "string"
    },
    "state": {
      "type": "string",
      "enum": [
        "waiting_for_funding",
        "deposit_detected",
        "swap_processing",
        "refunding",
        "completed",
        "terminal_failure",
        "unknown",
        "queued"
      ],
      "description": "waiting_for_funding for a new order; a replayed or recovered create reports the live state. queued only on a 202 (QueuedCreateResponse): no order yet."
    },
    "terminal": {
      "type": "boolean",
      "description": "Live value (false for a new order)."
    },
    "outcome": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "completed",
        "refunded",
        "failed",
        "expired",
        null
      ]
    },
    "replayed": {
      "type": "boolean",
      "description": "true when this replays an earlier create under the same idempotency-key: state, terminal, outcome, next and payable are read from the live order."
    },
    "recovered": {
      "type": "boolean",
      "description": "true when the order was found after an unknown provider outcome; live state as for replayed."
    },
    "data": {
      "type": "object",
      "properties": {
        "order": {
          "type": "object",
          "description": "{ orderId, status, depositAddress, depositAmount, depositTokenSymbol, depositChainId, expectedOutput, expiresAt, ... }"
        },
        "origin": {
          "type": "string",
          "enum": [
            "agent_quote",
            "other"
          ],
          "description": "agent_quote: created by this endpoint from a quote, with the provider's order verified against it. Only agent_quote orders can be payable or attested."
        },
        "destination": {
          "type": [
            "string",
            "null"
          ],
          "description": "The payout address recorded with the order at create (what the provider was asked to pay). Show it to the user."
        },
        "payable": {
          "type": "boolean",
          "description": "true only when deposit.payment may be paid: origin agent_quote, provider order verified, state waiting_for_funding, no deposit seen, no reconfirmation pending, expiry known and at least 600 s away. With payableReason upstream_mismatch, deposit is null."
        },
        "payableReason": {
          "$ref": "#/$defs/PayableReason"
        },
        "evidence": {
          "$ref": "#/$defs/Evidence"
        },
        "received": {
          "type": [
            "string",
            "null"
          ],
          "description": "The payout the provider reports, in the payout asset's own decimals (human units); null until reported or when the unit is unknown."
        },
        "receivedDetail": {
          "$ref": "#/$defs/ReceivedDetail"
        },
        "receivedBelowMinimum": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Whether the reported payout is below the quote's published minimum; null without a published minimum (always on Wagyu v2)."
        },
        "attention": {
          "$ref": "#/$defs/Attention"
        },
        "trackUrl": {
          "type": [
            "string",
            "null"
          ],
          "description": "<public origin>/#order=<orderId>: the order in the swap app."
        },
        "sessionId": {
          "type": "string",
          "format": "uuid"
        },
        "idempotencyKey": {
          "type": [
            "string",
            "null"
          ]
        },
        "idempotentReplay": {
          "type": "boolean"
        },
        "quoteId": {
          "type": [
            "string",
            "null"
          ],
          "description": "The quote the order was created from (on a replay, the original quote, never the request's)."
        },
        "quoteBound": {
          "type": "boolean",
          "description": "true when the request's quoteId is the order's original quote; false on a replay whose request named another one."
        },
        "intentCommitment": {
          "type": [
            "object",
            "null"
          ],
          "description": "The original quote's commitment."
        },
        "intentDigestChecked": {
          "type": "boolean",
          "description": "true only when a quoteIntentDigest was checked against the original quote."
        },
        "reconfirmRequired": {
          "type": "boolean",
          "description": "true when the provider's expected output differs materially from the quote; payable is then false for good (payableReason reconfirm_required, next.action requote_and_create_new_order)."
        },
        "reconfirmReason": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "expected_output_below_confirmed_minimum",
            "expected_output_below_confirmed_estimate",
            "expected_output_unknown",
            null
          ],
          "description": "below_confirmed_minimum: under the published minimum the user confirmed; below_confirmed_estimate: no published minimum and more than RECONFIRM_MAX_SHORTFALL_BPS (default 2%) under the confirmed estimate; unknown: the provider gave no expected output."
        },
        "deposit": {
          "$ref": "#/$defs/Deposit"
        },
        "next": {
          "$ref": "#/$defs/NextHint"
        },
        "fromQueue": {
          "type": "boolean",
          "description": "true on the first 200 after the create waited in the order line (earlier answers were 202 queued)."
        },
        "fundingAuthorization": {
          "type": "string",
          "description": "Creating an order does not move funds; funds move only when the sender's wallet (the user's, or an agent's acting for the user) sends the deposit, and only while payable is true."
        },
        "lastKnown": {
          "type": [
            "object",
            "null"
          ],
          "description": "Present when a replay or recovery could not read the live order: { status, state, observedAt }; payable is then false."
        },
        "verification": {
          "type": "object",
          "description": "Present when the provider's order does not match the quote-bound request: { ok: false, mismatched }."
        },
        "fundingInstructions": {
          "type": [
            "object",
            "null"
          ],
          "description": "Legacy shape of the same deposit data; null unless payable."
        }
      }
    }
  },
  "$defs": {
    "Attention": {
      "type": [
        "array",
        "null"
      ],
      "description": "What the user must know or do that the state alone does not say, in Swapper's words (never provider text); null when nothing. Show each note. Extra fields by kind: deposit_below_expected (observedDepositAtomic, expectedDepositAtomic), deposit_below_minimum (observedDepositAtomic, minimumDepositAtomic), action_required (action: refund_address | payout_address | coinflip, how: contact_support; Swapper cannot submit it), refund_recovery (recovery), delivered_different_token (deliveredToken).",
      "items": {
        "type": "object",
        "required": [
          "kind",
          "note"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "deposit_below_expected",
              "deposit_below_minimum",
              "action_required",
              "refund_pending",
              "refund_recovery",
              "provider_review",
              "delivered_different_token",
              "coinflip_lost",
              "payout_unconfirmed",
              "refund_unconfirmed"
            ]
          },
          "note": {
            "type": "string"
          },
          "action": {
            "type": [
              "string",
              "null"
            ]
          },
          "how": {
            "type": "string",
            "enum": [
              "contact_support"
            ]
          }
        }
      }
    },
    "Deposit": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "address": {
          "type": [
            "string",
            "null"
          ]
        },
        "amount": {
          "type": [
            "string",
            "null"
          ],
          "description": "Exact amount to send, human units."
        },
        "amountAtomic": {
          "type": [
            "string",
            "null"
          ]
        },
        "decimals": {
          "type": [
            "integer",
            "null"
          ]
        },
        "tokenSymbol": {
          "type": [
            "string",
            "null"
          ]
        },
        "chainId": {
          "type": [
            "integer",
            "null"
          ],
          "description": "0 = Monero, 42161 = Arbitrum One."
        },
        "chainName": {
          "type": [
            "string",
            "null"
          ]
        },
        "expiresAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Canonical ISO-8601 UTC: the earlier of the expiry recorded at create and the provider's live one."
        },
        "expiresInSec": {
          "type": [
            "integer",
            "null"
          ]
        },
        "exactAmountRequired": {
          "type": "boolean"
        },
        "confirmations": {
          "type": "object",
          "description": "{ required, current, source: provider, note } as the provider reports them (progress, not a guarantee); nulls when it reports none."
        },
        "afterExpiry": {
          "type": "string"
        },
        "refunds": {
          "type": "string"
        },
        "payment": {
          "description": "Wallet-ready transfer of exactly this deposit. Non-null only while the response's payable is true; null otherwise (see payableReason).",
          "oneOf": [
            {
              "$ref": "#/$defs/MoneroPayment"
            },
            {
              "$ref": "#/$defs/Erc20TransferPayment"
            },
            {
              "type": "null"
            }
          ]
        },
        "attestation": {
          "$ref": "#/$defs/OrderAttestation"
        }
      }
    },
    "Erc20TransferPayment": {
      "type": "object",
      "required": [
        "kind",
        "chainId",
        "token",
        "to",
        "amountAtomic",
        "eip681",
        "tx"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "erc20_transfer"
          ]
        },
        "chainId": {
          "type": "integer",
          "enum": [
            42161
          ]
        },
        "token": {
          "type": "string",
          "description": "Native USDC contract on Arbitrum One."
        },
        "to": {
          "type": "string",
          "description": "The deposit address."
        },
        "amountAtomic": {
          "type": "string",
          "description": "Exact deposit in atomic units (USDC: 6 decimals)."
        },
        "eip681": {
          "type": "string",
          "description": "ethereum:<token>@42161/transfer?address=<to>&uint256=<amountAtomic>"
        },
        "tx": {
          "type": "object",
          "description": "Unsigned transaction request to the token contract, ready for a wallet: data = 0xa9059cbb + recipient (lowercase, left-padded to 32 bytes) + amount (hex, left-padded to 64 chars); chainId 42161. Check it before signing (MCP get_swap_status payment -> paymentCheck).",
          "properties": {
            "to": {
              "type": "string"
            },
            "value": {
              "type": "string",
              "enum": [
                "0x0"
              ]
            },
            "data": {
              "type": "string",
              "pattern": "^0xa9059cbb[0-9a-f]{128}$"
            },
            "chainId": {
              "type": "integer",
              "enum": [
                42161
              ]
            }
          }
        },
        "gas": {
          "$ref": "#/$defs/PaymentGas"
        },
        "signing": {
          "type": "string",
          "description": "Only the sender's wallet signs and sends it; Swapper never signs or holds keys."
        }
      }
    },
    "Evidence": {
      "type": [
        "object",
        "null"
      ],
      "description": "Transaction hashes the provider reports (source: provider): its statements, not chain checks by Swapper; verify them on an explorer. null when nothing is known. A completed order with payout null has no payout transaction reported yet (data.attention payout_unconfirmed): check the destination wallet before treating the funds as received.",
      "properties": {
        "source": {
          "type": "string",
          "enum": [
            "provider"
          ]
        },
        "deposit": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "txHash": {
              "type": "string"
            },
            "explorerUrl": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        "payout": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "txHash": {
              "type": "string"
            },
            "explorerUrl": {
              "type": [
                "string",
                "null"
              ],
              "description": "Arbitrum One: arbiscan.io; Monero: xmrchain.net."
            },
            "asset": {
              "type": [
                "string",
                "null"
              ],
              "description": "The payout token contract (lowercase) or XMR."
            },
            "symbol": {
              "type": [
                "string",
                "null"
              ]
            },
            "atomic": {
              "type": [
                "string",
                "null"
              ]
            },
            "decimals": {
              "type": [
                "integer",
                "null"
              ]
            },
            "deliveredAsDifferentToken": {
              "type": "boolean",
              "description": "true when the provider reports the payout in another token than requested; amounts are in that token's units."
            }
          }
        },
        "refund": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "txHash": {
              "type": "string"
            },
            "explorerUrl": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        }
      }
    },
    "MoneroPayment": {
      "type": "object",
      "required": [
        "kind",
        "uri",
        "address",
        "amount"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "monero"
          ]
        },
        "uri": {
          "type": "string",
          "description": "monero:<address>?tx_amount=<amount> (exact human decimal, never rounded)."
        },
        "address": {
          "type": "string"
        },
        "amount": {
          "type": "string"
        },
        "gas": {
          "$ref": "#/$defs/PaymentGas"
        },
        "signing": {
          "type": "string"
        }
      }
    },
    "NextHint": {
      "type": "object",
      "description": "What to do next. action: user_sends_deposit_then_poll_status (only while payable is true) | poll_status | poll_status_then_contact_support (state unknown) | contact_support (data.attention has action_required or coinflip_lost: the provider needs an action Swapper cannot take; open a support ticket with the orderId, never share seed phrases or private keys) | requote_and_create_new_order (reconfirm_required: this order can never be funded through Swapper; re-quote with requote.body and create a new order) | done (completed) | contact_support_if_unexpected (terminal failure).",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "user_sends_deposit_then_poll_status",
            "poll_status",
            "poll_status_then_contact_support",
            "contact_support",
            "requote_and_create_new_order",
            "done",
            "contact_support_if_unexpected"
          ]
        },
        "statusPath": {
          "type": [
            "string",
            "null"
          ]
        },
        "statusUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "orderPath": {
          "type": [
            "string",
            "null"
          ]
        },
        "supportPath": {
          "type": "string"
        },
        "pollIntervalSec": {
          "type": [
            "integer",
            "null"
          ],
          "description": "null when terminal (and for requote_and_create_new_order)."
        },
        "maxPollIntervalSec": {
          "type": [
            "integer",
            "null"
          ]
        },
        "backoff": {
          "type": [
            "string",
            "null"
          ]
        },
        "recheckAfterSec": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Terminal but mayChange (failed/expired): re-check after this many seconds if funds were sent."
        },
        "terminal": {
          "type": "boolean"
        },
        "reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "requote_and_create_new_order only: the reconfirmReason."
        },
        "note": {
          "type": "string",
          "description": "requote_and_create_new_order only: why the order cannot be funded."
        },
        "requote": {
          "type": "object",
          "description": "requote_and_create_new_order only: { path: /api/v1/agent/swap/quote, body: { requoteOf: <the order's quoteId> } | null }."
        }
      }
    },
    "OrderAttestation": {
      "type": [
        "object",
        "null"
      ],
      "description": "swapper.order-attestation.v1 envelope (docs/TRANSPARENCY.md): Swapper's Ed25519 signature over this order's deposit instructions and payout address. Present only for orders created through create from a quote (origin agent_quote) whose provider order matched the request, and only when signing is configured (capabilities.attestation.status active); signed once and returned unchanged on replays and status; null otherwise. Verify it against a key set you obtained yourself (keys/attestation-keys.json in the source): it shows what Swapper's API stated, not that the provider controls the deposit address.",
      "properties": {
        "v": {
          "type": "string",
          "enum": [
            "swapper.order-attestation.v1"
          ]
        },
        "kid": {
          "type": "string"
        },
        "claim": {
          "type": "object",
          "description": "issuedAt, provider, orderId, quoteId, quoteDigest, direction, depositChainId, depositAsset, depositAddress, depositAtomic, depositExpiresAt, payoutChainId, payoutAsset, destination, expectedPayoutAtomic (strings or null)."
        },
        "sig": {
          "type": "string",
          "description": "Ed25519 signature, base64url."
        }
      }
    },
    "PayableReason": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        null,
        "replay_check_status",
        "deposit_seen",
        "not_waiting",
        "expiry_unknown",
        "expired",
        "expiring",
        "reconfirm_required",
        "status_unavailable",
        "upstream_mismatch",
        "unverified_origin",
        "queued"
      ],
      "description": "Why payable is false (null while payable). queued: a 202 create waiting in the order line (no order exists yet). On create and status, the first failing check names it: status_unavailable (the live order could not be read, e.g. on a replay or recovery, or a long-poll ended on cached data; read the status again without waitSec), upstream_mismatch (the provider's order did not match the request; deposit is null), unverified_origin (the order was not created through this API from a quote: origin other, e.g. one made by the removed raw POST /orders route or one Swapper has no record of; never fund it, create your own order from a quote), deposit_seen (a deposit was already seen; never send again), not_waiting (the order no longer waits for funding), reconfirm_required (the provider's expected output differs materially from the quote; nothing clears it: next.action requote_and_create_new_order), expiry_unknown (the deposit expiry is unknown), expired (the deposit window has closed while the provider still shows the order waiting), expiring (less than 600 s to expiry). On lists: replay_check_status (a list never offers a payment; read the order's status)."
    },
    "PaymentGas": {
      "type": "object",
      "properties": {
        "symbol": {
          "type": "string"
        },
        "chain": {
          "type": "string"
        },
        "note": {
          "type": "string"
        }
      }
    },
    "ReceivedDetail": {
      "type": [
        "object",
        "null"
      ],
      "description": "The payout as the provider reports it, in the payout asset's own decimals (the delivered token's when the provider delivered a different token). null until the provider reports an output.",
      "properties": {
        "atomic": {
          "type": "string"
        },
        "decimals": {
          "type": [
            "integer",
            "null"
          ]
        },
        "asset": {
          "type": [
            "string",
            "null"
          ]
        },
        "symbol": {
          "type": [
            "string",
            "null"
          ]
        },
        "chainId": {
          "type": [
            "integer",
            "null"
          ]
        },
        "deliveredAsDifferentToken": {
          "type": "boolean"
        },
        "source": {
          "type": "string",
          "enum": [
            "provider"
          ]
        }
      }
    }
  }
}