agent
swap

Get quote (by send amount, by target receive amount, or a re-quote)

Give direction and exactly one of amount (send asset) or receiveAmount (receive asset), or requoteOf alone. Returns state "quoted", data.amount (send amount, human units), data.quoteId (bound to that send amount and single-use: it opens at most one order), data.expiresAt (end of the confirmation window, not a price lock), data.expiresInSec and data.acceptWindowSec (QUOTE_MAX_AGE_SEC: 300 s on this deployment, default 300), data.intentCommitment, data.terms {send, receive {estimate, estimateAtomic, minimum, minimumAtomic, minimumPublished}, guaranteed:false, estimatedTimeSec, fees {itemized, integratorFee, breakdown?, feeFraction?, swapperFee: null, note}, minimumSwapUsd, minimumSendEstimate, belowProviderMinimum}, data.confirmation ({ required: false, quoteId, acceptUntil, instruction }) and the raw data.quote. The provider publishes no minimum receive amount (Wagyu v2): terms.receive.minimum is null and minimumPublished false, never derived from the estimate. With receiveAmount, Swapper searches a send amount whose estimated receive amount meets the target (rounded up to 0.01 USDC or 0.0001 XMR, at most 5 provider quotes) and adds data.target; basis "minimum" (target the provider minimum instead) is refused with 400 minimum_not_published while the provider publishes none. requoteOf re-quotes the stored inputs of an earlier quote (same direction, chain, send amount or target, destination) and adds data.delta. For u2x, data.prerequisites lists what the sending wallet needs (native USDC contract, ETH for gas on Arbitrum One) before any order exists. Estimates are not guaranteed: the final amount is set when the swap runs. Fees are included in the rate: Swapper's integrator fee (data.terms.fees.integratorFee) and the provider's own fees (itemized only when the provider reports them). Create with data.quoteId while it is valid. Creates no order. Optional agent key (x-agent-key header or agentKey): the quote and its order use the agent fee shown in GET /agent/key. 451 if the caller's region is restricted.

post/agent/swap/quote

Request

  • Base URL: https://xmrtousdc.xyz/api/v1
  • URL: https://xmrtousdc.xyz/api/v1/agent/swap/quote
  • Auth: none declared

Headers

x-agent-keystring

Optional agent key from POST /agent/key (same as agentKey in the body).

Request body

direction'x2u' | 'u2x'

x2u = XMR->USDC, u2x = USDC->XMR. Buying XMR: u2x.

amountstring

What the user SENDS: decimal string in send-asset units (XMR for x2u, USDC for u2x).

receiveAmountstring

What the user wants to RECEIVE: decimal string in receive-asset units (USDC for x2u, XMR for u2x). Same precision and positivity rules as amount, against the receive asset's decimals.

basis'estimate' | 'minimum'

With receiveAmount: "estimate" (the default) finds a send amount whose estimated output meets the target. "minimum" would target the provider's published minimum (minReceived), but it is refused with 400 invalid_request (details.field basis, details.reason minimum_not_published) while the provider publishes no minimum receive amount, which is always the case on Wagyu v2. With amount instead of receiveAmount: 400 requires_receiveAmount. Echoed as data.target.basis.

tostring

Optional on quote; validated if present (same destination checks as create).

requoteOfstring required

Re-quote an earlier quote's stored inputs (same direction, chain, send amount or target, destination), for example after it expired or once the user is funded. Send it alone (an agent key goes in the x-agent-key header). Returns a new quote plus data.delta. Unknown quoteId: 404 quote_not_found.

agentKeystring

Optional agent key (POST /agent/key): this quote and the order created from it carry a lower integrator fee (data.agentKey, terms.fees.integratorFee). The x-agent-key header works too.

Example request

{
  "amount": "0.8",
  "receiveAmount": "1"
}

Response

Quote response

okboolean
operationstring
statestring

Example response

{
  "operation": "swap.quote",
  "state": "quoted",
  "data": {
    "prerequisites": {
      "gas": {
        "symbol": "ETH",
        "chain": "Arbitrum One"
      }
    }
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.