> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uatu.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Quotes

> What a quote contains and how to execute one.

A quote is a priced swap plus everything needed to execute it. `POST /quotes`
resolves the pools for a token pair on a chain, prices the swap against each DEX's
on-chain contracts concurrently, picks the best output, and persists the result with
a `pending` status.

## The request

<ParamField body="chain" type="string" required>
  Chain slug, for example `ethereum`.
</ParamField>

<ParamField body="chainId" type="integer" required>
  EVM chain ID. Must agree with `chain`.
</ParamField>

<ParamField body="tokenIn" type="string" required>
  Contract address of the token being sold.
</ParamField>

<ParamField body="tokenOut" type="string" required>
  Contract address of the token being bought.
</ParamField>

<ParamField body="amount" type="string" required>
  Amount of `tokenIn` to swap, as a decimal string in display units.
</ParamField>

<ParamField body="recipientAddress" type="string" required>
  Address that receives `tokenOut`.
</ParamField>

Every field is validated on arrival. A missing or malformed value returns `400`
rather than reverting downstream.

## Amounts come in two forms

Each side of the swap is reported twice:

| Field                              | Meaning                                                  |
| ---------------------------------- | -------------------------------------------------------- |
| `amountIn` / `amountOut`           | Integer strings in the token's smallest unit (wei-style) |
| `amountInFloat` / `amountOutFloat` | Decimal strings in display units                         |

Use the integer form for anything you send on-chain. Use the float form for display.
Both are strings, since these values exceed what a JSON number can hold safely.

## Steps

`steps` is the executable part of the quote: an ordered list of transactions your
client submits with its own signer. A swap typically needs a Permit2 approval before
the swap call itself.

<ResponseField name="message" type="string">
  What this step does, for example `approve`.
</ResponseField>

<ResponseField name="from" type="string">
  Address that must send the transaction.
</ResponseField>

<ResponseField name="to" type="string">
  Contract the transaction targets.
</ResponseField>

<ResponseField name="data" type="string">
  ABI-encoded calldata.
</ResponseField>

<ResponseField name="spender" type="string">
  Address being granted an allowance, on approval steps.
</ResponseField>

<ResponseField name="value" type="string">
  Native value to attach, when the input token is the chain's native asset.
</ResponseField>

<ResponseField name="amount" type="string">
  Amount this step moves or approves, in the token's smallest unit.
</ResponseField>

<ResponseField name="chainId" type="integer">
  Chain the transaction belongs to.
</ResponseField>

Submit them in order. uatu only encodes; it never broadcasts.

## Deadlines

Every quote carries a `deadline`, a Unix timestamp set **one minute** after the quote
is created. Past it the pricing is stale, so re-request the quote instead of
submitting its steps.

<Tip>
  Read the `deadline` field rather than hard-coding a minute, so your client keeps
  working if the TTL changes.
</Tip>

## Status

A persisted quote carries a `status` of `pending`, `completed` or `failed`, and gains
`hash` and `explorerUrl` once a transaction is associated with it.

## Identity fields

`quoteId` identifies the persisted quote. `originChain` / `originChainId` and
`destinationChain` / `destinationChainId` record both sides of the route; for a
same-chain swap they match. `pairAddress` is the pool the swap was priced against.
