> For the complete documentation index, see [llms.txt](https://docs.intents.aurora.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.intents.aurora.dev/intents-swap/what-is-swap-api.md).

# What is Swap API?

Programmatic cross-chain swaps for wallets, backends and agents. Same engine as the Swap Widget, no UI required.

The Swap API is the REST interface behind Aurora Intents swaps. It is the same engine that powers the Swap Widget and Intents Deposits, exposed directly so you can run cross-chain swaps from your own UI, your backend, or an automated agent, with no iframe, no bridging logic and no liquidity to manage.

### When to use the Swap API

Choose the API over the Swap Widget when you need:

* Your own swap UI, e.g. a wallet or exchange that already has a swap screen
* Headless or server-side flows: treasury rebalancing, trading bots, AI agents, payment backends
* Full control over quoting, slippage, refunds and recipient handling
* Swaps that settle into a different address than the sender, e.g. a user deposits on chain A and your protocol receives on chain B

If you just want a drop-in swap screen with no code, use the [Swap Widget](/intents-swap/what-is-swap-widget.md) instead. Both use the same API key, fee configuration and reports in Intents Studio.

### How it works

Every swap follows the same four steps. There is no on-chain approval or contract call on your side: the user (or your backend) simply sends the origin asset to a deposit address returned by the quote.

1. Get supported tokens. Call `GET /api/tokens/{apiKey}` to list the assets and chains available to your key, and pick the origin and destination asset IDs.
2. Request a quote. Call `POST /api/quote/{apiKey}` with the amount, assets, slippage, recipient and refund address. The response contains `amountOut`, `minAmountOut`, a time estimate, a deadline, and a unique `depositAddress` (plus `depositMemo` on memo-based chains).
3. Send the origin asset. Transfer `amountIn` to `depositAddress` from any wallet before the deadline. Optionally call `POST /api/deposit/submit/{apiKey}` with the transaction hash to speed up detection.
4. Track the swap. Poll `GET /api/status/{apiKey}?depositAddress=...` until the status is `SUCCESS`, `REFUNDED` or `FAILED`. Use `GET /api/transactions/{apiKey}` for history and `GET /api/incidents/{apiKey}` to surface active chain or asset incidents to your users.

### Base URL and authentication

All endpoints live under [https://intents-api.aurora.dev](https://intents-api.aurora.dev/). Authentication uses an API key passed as a path segment on every request. Create a key in Intents Studio ([studio.aurora.dev](https://studio.aurora.dev/)); the key is not secret and is safe to ship in client-side code. Each key has its own fee configuration, so you can earn fees on API swaps the same way you do with the widget. See API Keys & Fees and Rate Limits for details.

### Example: quote a swap

Swap 100 USDC on one chain for USDC on another, delivered to a recipient of your choice. Set `dry` to `true` to get a price without reserving a deposit address.

```bash
curl -X POST https://intents-api.aurora.dev/api/quote/{apiKey} \
  -H "Content-Type: application/json" \
    -d '{
      "dry": false,
      "swapType": "EXACT_INPUT",
      "depositType": "ORIGIN_CHAIN",
      "originAsset": "<asset id from /api/tokens>",
      "destinationAsset": "<asset id from /api/tokens>",
      "amount": "100000000",
      "slippageTolerance": 100,
      "refundTo": "<sender address on the origin chain>",
      "refundType": "ORIGIN_CHAIN",
      "recipient": "<recipient address on the destination chain>",
      "recipientType": "DESTINATION_CHAIN"
  }'
```

### Swap types

The `swapType` field controls how `amount` is interpreted:

* `EXACT_INPUT`: `amount` is what the user sends; the output floats with the market. This is the default for a classic swap screen.
* `EXACT_OUTPUT`: `amount` is what the recipient must receive; the API tells you how much to send. Use it for invoices, top-ups and fixed-price checkouts.
* `FLEX_INPUT`: like `EXACT_INPUT`, but the deposit may differ from the quoted amount and the swap still executes on what actually arrives.
* `ANY_INPUT`: no amount up front; whatever lands on the deposit address is swapped. This is what powers Intents Deposits and Persistent Addresses.

Deposits can be made from the origin chain (`ORIGIN_CHAIN`) or from an existing NEAR Intents balance (`INTENTS`). Set `confidentiality` to `basic` or `advanced` for Confidential Swaps.

### Next steps

* Create an API key in Intents Studio and configure your fees: [API Keys & Fees](/getting-started/api-keys-and-fees.md)
* Full endpoint schemas and error codes: [Swap API Reference](/api-reference/swap-api-reference.md)
* A step-by-step walkthrough of the same flow for deposits: [Intents Deposits API integration](/intents-deposits/quickstart/api-integration.md)
* Rate limits, UX recommendations and support handling: [Integration Best Practices](/getting-started/integration-best-practices.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.intents.aurora.dev/intents-swap/what-is-swap-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
