# API reference

> Every endpoint, with curl, TypeScript and Python samples generated from OpenAPI.

Base URL `https://api.intents.fi`. The OpenAPI document is at
[/openapi.json](/docs/openapi.json) — everything on this page, every sample on it and the TypeScript
SDK are generated from that file, so it is the thing to trust.

## Authentication

```http
authorization: Bearer ik_test_…
```

A **secret** key (`ik_`) reaches everything its account owns. A **publishable** key (`pk_`) is
browser-safe and reaches almost nothing: it cannot read invoices or create a custom one. The
prefix also decides the mode — `_test_` or `_live_` — and no key of either kind can change a
settlement address ([why](/docs/get-started)).

The public checkout endpoints are the exception. They take the invoice's client secret instead,
because they run in a customer's browser:

```http
x-client-secret: inv_3QkR7mVt9zLpXdB2hJn6Yw_secret_…
```

That secret reaches one invoice's public endpoints, nothing else, and expires with the invoice.
The public view deliberately omits the merchant's settlement address and net amount.

## Errors

```json
{ "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } }
```

Switch on `code`. Each one has a page under [/errors](/docs/errors/).

## Amounts

Prices (`amount`) are decimal strings in the invoice currency: `"49.00"`. Everything else —
`amountExpected`, `amountNet`, `amountIn`, `fee.amount` — is an **integer string in the asset's
base units**. Use `BigInt`, never a float. Assets are CAIP-19 IDs and chains are CAIP-2, so
`eip155:8453/erc20:0x8335…` is USDC on Base.

## Not shipped yet

An endpoint whose contract is published but whose implementation has not landed answers
[`501 NOT_IMPLEMENTED`](/docs/errors/NOT_IMPLEMENTED). The shape in this reference is what it will
return.

## Checkout: invoices, the merchant and payment links

### Create an invoice
`POST /v0/invoices`
Creates an invoice priced in USD. The customer may pay in any routable token on any routable chain; the merchant receives one settlement asset at its own address (§0).

Settlement is in a USD stablecoin (USDC on base, USDC on arbitrum, USDC on ethereum, USDC on solana, USDC on polygon, USDT on tron, USDT on ethereum, USDT on arbitrum, USDT on bsc), 1:1 with `amount`, or in BTC. A BTC invoice's `amountExpected` is locked from live quotes when it is created (`priceLock`, §5.2); if no reliable price can be had the invoice is refused with `503 PRICE_UNAVAILABLE`.

Re-sending a `reference` in the same mode returns `200` with the invoice that already exists, so a retried create never charges twice. References are scoped by mode: the same `reference` under a test key and a live key makes two separate invoices.
| Parameter | In | Required | Notes |
|---|---|---|---|
| `x-intents-affiliate` | header | no | Store plugins: the Affiliate ID from the plugin settings. Links a merchant that nobody referred yet and that has no live payment (affiliate rules); never overwrites and never changes the fee. |

| Field | Type | Required | Notes |
|---|---|---|---|
| `amount` | string | yes | Price in the invoice currency, e.g. "49.00" |
| `currency` | `USD` | no |  |
| `settlement` | object | no | Choose between the merchant's registered settlement targets. API keys cannot introduce a new address (§8.3). |
| `settlement.asset` | string | yes |  |
| `settlement.address` | string | yes |  |
| `reference` | string | no | The merchant's own ID. Unique per merchant and mode, and the idempotency key. |
| `description` | string | no |  |
| `customerEmail` | string | no |  |
| `successUrl` | string | no |  |
| `cancelUrl` | string | no |  |
| `expiresInSec` | integer | no |  |
| `metadata` | object | no |  |



```bash title="curl"
curl https://api.intents.fi/v0/invoices \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY' \
  -H 'x-intents-affiliate: <x-intents-affiliate>' \
  -H 'content-type: application/json' \
  -d '{
       "amount": "49.00",
       "settlement": {
         "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
         "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA"
       },
       "reference": "order_1042",
       "description": "Pro plan — 1 month",
       "customerEmail": "ana@example.com",
       "successUrl": "https://northwood.example/thanks"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/invoices", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "amount": "49.00",
    "settlement": {
      "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA"
    },
    "reference": "order_1042",
    "description": "Pro plan — 1 month",
    "customerEmail": "ana@example.com",
    "successUrl": "https://northwood.example/thanks"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/invoices",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
    json={
        "amount": "49.00",
        "settlement": {
            "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
            "address": "0x6A3fB91c7D8e45A2b0C1fE97D3a8B52c4e7F10dA"
        },
        "reference": "order_1042",
        "description": "Pro plan — 1 month",
        "customerEmail": "ana@example.com",
        "successUrl": "https://northwood.example/thanks"
    },
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | An invoice with this `reference` already exists in this mode; it is returned unchanged |
| `201` | Invoice created. `clientSecret` is shown only here. |

### List invoices
`GET /v0/invoices`
| Parameter | In | Required | Notes |
|---|---|---|---|
| `status` | query | no |  |
| `limit` | query | no |  |
| `startingAfter` | query | no | The last `id` of the previous page |



```bash title="curl"
curl https://api.intents.fi/v0/invoices?status=paid&limit=25 \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/invoices?status=paid&limit=25", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/invoices?status=paid&limit=25",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Invoices for this key's merchant and mode, newest first |

### Fetch an invoice
`GET /v0/invoices/{id}`
| Parameter | In | Required | Notes |
|---|---|---|---|
| `id` | path | yes |  |



```bash title="curl"
curl https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | The invoice, with its payment attempts |

### Cancel an invoice
`POST /v0/invoices/{id}/cancel`
Only while `open` or `underpaid`. An invoice with a payment in flight is never canceled, so no customer pays an invoice we have written off.
| Parameter | In | Required | Notes |
|---|---|---|---|
| `id` | path | yes |  |



```bash title="curl"
curl https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw/cancel \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw/cancel", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/invoices/inv_3QkR7mVt9zLpXdB2hJn6Yw/cancel",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | The canceled invoice |

### Fetch the merchant profile
`GET /v0/merchant`


```bash title="curl"
curl https://api.intents.fi/v0/merchant \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/merchant", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/merchant",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Profile, branding and the settlement targets in effect |

### Update branding and payment options
`PATCH /v0/merchant`
Branding, display name and `absorbRouteCost` (§5.1) only. Settlement addresses cannot be changed with an API key: a stolen key must never be able to redirect a payout (§8.3). Change them in the dashboard, where it takes fresh email OTP and 24 hours.
| Field | Type | Required | Notes |
|---|---|---|---|
| `name` | string | no |  |
| `branding` | object | no |  |
| `absorbRouteCost` | boolean | no | §5.1: absorb the route cost on stablecoin payments, up to 1% of the invoice. Applies to invoices created after the change. |



```bash title="curl"
curl https://api.intents.fi/v0/merchant \
  -X PATCH \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/merchant", {
  method: "PATCH",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.patch(
    "https://api.intents.fi/v0/merchant",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | The updated profile |

### What a payment link sells, for the link page
`GET /v0/links/{id}`
| Parameter | In | Required | Notes |
|---|---|---|---|
| `id` | path | yes |  |



```bash title="curl"
curl https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo", {
  method: "GET",
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo",
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | The link |
| `404` | Unknown or off |

### One visit to a payment link: an invoice at the link's price, or the customer's amount
`POST /v0/links/{id}/invoices`
Takes the merchant's publishable key (pk_), or no key: the link ID is its capability, and a link can only create the invoice the merchant priced, or, on a `custom` link, one at an amount the customer chose inside the merchant's bounds. A key must match the link's account and mode. Body (optional JSON, schema `PaymentLinkInvoiceRequest`): `quantity`, `amount` (custom links, required there), `customerEmail`.
| Parameter | In | Required | Notes |
|---|---|---|---|
| `id` | path | yes |  |



```bash title="curl"
curl https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo/invoices \
  -X POST
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo/invoices", {
  method: "POST",
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/links/plink_Vb3kT9qLmZ2xR8wNc4HfJpYs6dGa1uEo/invoices",
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `201` | Created; send the customer to `url` |
| `400` | A bad quantity or amount, or a key from the other mode |
| `404` | Unknown or off |
| `422` | AMOUNT_OUT_OF_RANGE: outside the link's minimum and maximum |
| `429` | Too many from this IP, or on this custom-amount link |

## Checkout: the public payment page

### Resolve a custom checkout domain
`GET /v0/checkout/domains/{host}`
Which merchant a verified custom checkout domain (`pay.merchant.com`) belongs to. The hosted page calls it for any host that is not its own, and serves only that merchant's invoices there. 404 for anything that is not a verified checkout domain, including one still waiting on DNS.
| Parameter | In | Required | Notes |
|---|---|---|---|
| `host` | path | yes |  |



```bash title="curl"
curl https://api.intents.fi/v0/checkout/domains/<host> \
  -H 'x-client-secret: $CLIENT_SECRET'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/checkout/domains/<host>", {
  method: "GET",
  headers: {
    "x-client-secret": clientSecret,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/checkout/domains/<host>",
    headers={"x-client-secret": client_secret},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | A verified checkout domain |

### Fetch the public checkout view
`GET /v0/checkout/{invoiceId}`
What the payer is shown: the price, the merchant's name and theme, the status and the active attempt. Readable with the invoice ID alone, which carries 22+ characters of randomness, so it never returns the merchant's settlement address or net amount.
| Parameter | In | Required | Notes |
|---|---|---|---|
| `invoiceId` | path | yes |  |



```bash title="curl"
curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw \
  -H 'x-client-secret: $CLIENT_SECRET'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw", {
  method: "GET",
  headers: {
    "x-client-secret": clientSecret,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw",
    headers={"x-client-secret": client_secret},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | The public view of the invoice |

### List the assets this invoice can be paid with
`GET /v0/checkout/{invoiceId}/options`
The ranked "pay with" list. Each row is quoted exact-output through the core aggregator, so `amountIn` is all-in: the invoice plus the cost of delivering it, as one number the customer reads. Route cost is never broken out as gas, bridging or slippage (§5.1).

Assets whose provider minimum exceeds the invoice amount are left out (§5.4), and `modes` lists `transfer` only where a provider returns a deposit address for that asset.

With no `payer` the list is ten popular assets. With a `payer`, what that address holds of **any** payable asset on its own network joins them (up to 10 more), each with its `balance`; a row whose balance is below `amountIn` has `covers: false` and is listed after the ones the payer can afford. A balance that cannot be read within 800 ms is left out, never waited for (§6.4).

`?assets=` quotes up to 3 named assets on demand instead: the one a customer picked from `GET …/assets`. Those rows are never `recommended`. A payable asset no provider will quote right now comes back in `unavailable`; an asset that cannot pay this invoice at all (outside `GET …/assets`: a Bitcoin or NEAR token, a Mayan-only asset, the settlement asset) is refused with `422 NO_ROUTE_FOR_ASSET` before anything is quoted, as `POST …/attempts` refuses it. Cache misses count against a per-invoice hourly limit (`429 RATE_LIMITED`).

Quotes are indicative and cached per invoice and asset for `ttlSec`; the binding amount comes from `POST /attempts`.
| Parameter | In | Required | Notes |
|---|---|---|---|
| `invoiceId` | path | yes |  |
| `payer` | query | no | The payer's address. Balances are read from it on its own VM (§6.4). |
| `chains` | query | no | Comma-separated CAIP-2 chain IDs, to narrow the list |
| `assets` | query | no | Up to 3 comma-separated CAIP-19 asset IDs to quote on demand: the asset a customer picked from search, or a short result set (§11.35). Only these are quoted. Cache misses count against a per-invoice hourly limit (`429 RATE_LIMITED`). |



```bash title="curl"
curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/options \
  -H 'x-client-secret: $CLIENT_SECRET'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/options", {
  method: "GET",
  headers: {
    "x-client-secret": clientSecret,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/options",
    headers={"x-client-secret": client_secret},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Ranked payment options, newest quote first |

### Search every asset this invoice can be paid with
`GET /v0/checkout/{invoiceId}/assets`
Searches every payable asset in the registry, not just the default list, by symbol, token name, network or contract address. Every word of `q` must match ("usdc base").

Only assets that a provider can route exact-output to the invoice's settlement asset are listed (§11.3). On Bitcoin and NEAR only the native coin is listed.

Search never quotes a long list. When the whole result set is 3 assets or fewer, each match carries its `option` (or `null`: nothing routes it right now). Otherwise price the one the customer picks with `GET …/options?assets=`.

Limited per invoice: 240 searches an hour (`429 RATE_LIMITED`).
| Parameter | In | Required | Notes |
|---|---|---|---|
| `invoiceId` | path | yes |  |
| `q` | query | yes | What the customer typed: a symbol, a token name, a network, or a contract address. Every word must match. |
| `limit` | query | no |  |
| `cursor` | query | no | `nextCursor` from the previous page |
| `payer` | query | no | The payer's address, so an inline quote can read their balance (§6.4) |



```bash title="curl"
curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/assets?q=usdc%20base&limit=10 \
  -H 'x-client-secret: $CLIENT_SECRET'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/assets?q=usdc%20base&limit=10", {
  method: "GET",
  headers: {
    "x-client-secret": clientSecret,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/assets?q=usdc%20base&limit=10",
    headers={"x-client-secret": client_secret},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Matching assets, best match first |

### Start a payment attempt
`POST /v0/checkout/{invoiceId}/attempts`
Picks one asset and turns it into a core order: an exact-output quote for the invoice's net amount (`amountExpected` less the checkout fee), paying the merchant's settlement address, with the fee charged in route on top (§5.1, §11.53).

`refundTo` is required in `transfer` mode and defaults to `payer` in `wallet` mode (§11.2). It must be valid on the origin chain, because a failed payment is returned there and nowhere else.

Creating an attempt supersedes the invoice's previous active one. The superseded deposit address can still be paid, and if it is, the money still reaches the merchant and is handled as a late payment (§3.2) — which is why the UI shows only the newest address.
| Parameter | In | Required | Notes |
|---|---|---|---|
| `invoiceId` | path | yes |  |
| `x-client-secret` | header | no | The invoice's `clientSecret`, from `POST /v0/invoices` |



```bash title="curl"
curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts \
  -X POST \
  -H 'x-client-secret: $CLIENT_SECRET' \
  -H 'content-type: application/json' \
  -d '{
       "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
       "mode": "wallet",
       "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D",
       "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts", {
  method: "POST",
  headers: {
    "x-client-secret": clientSecret,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "mode": "wallet",
    "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D",
    "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts",
    headers={"x-client-secret": client_secret},
    json={
        "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "mode": "wallet",
        "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D",
        "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b"
    },
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `201` | The attempt, with the steps that pay it |

### Pay an invoice as an agent, with no UI
`POST /v0/checkout/{invoiceId}/agent`
For software that pays on someone's behalf (§12 C3). Call it with **no body** and it answers `402 Payment Required`, x402-style: the invoice, and in `accepts[]` every asset it can be paid with and the indicative all-in amount for each. Nothing is created.

Call it again with `{ "asset", "mode": "transfer", "refundTo" }` and it creates a payment attempt, exactly like `POST …/attempts`, tagged `channel: "agent"`. The response carries the deposit address and the binding amount in `display`. Send exactly that amount, then poll `GET …/attempts/{id}` until `invoiceStatus` is `paid`. The merchant gets the same webhooks as for any other payment.

No client secret is needed: the invoice ID is the capability, as it is for the hosted page (§11.10), and the same per-invoice and per-IP attempt limits apply.
| Parameter | In | Required | Notes |
|---|---|---|---|
| `invoiceId` | path | yes |  |



```bash title="curl"
curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent \
  -X POST \
  -H 'x-client-secret: $CLIENT_SECRET' \
  -H 'content-type: application/json' \
  -d '{
       "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
       "mode": "wallet",
       "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D",
       "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent", {
  method: "POST",
  headers: {
    "x-client-secret": clientSecret,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "mode": "wallet",
    "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D",
    "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent",
    headers={"x-client-secret": client_secret},
    json={
        "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "mode": "wallet",
        "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D",
        "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b"
    },
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `201` | The attempt, with the deposit address (transfer) or the steps (wallet) |
| `402` | Payment required: the invoice and what it accepts |

### Hand in a transaction hash or signature
`POST /v0/checkout/{invoiceId}/attempts/{id}/submit`
Required by the providers that settle from a signature, and a shortcut everywhere else: telling us the hash finds the payment sooner than watching for it.
| Parameter | In | Required | Notes |
|---|---|---|---|
| `invoiceId` | path | yes |  |
| `id` | path | yes |  |
| `x-client-secret` | header | no | The invoice's `clientSecret`, from `POST /v0/invoices` |

| Field | Type | Required | Notes |
|---|---|---|---|
| `txHash` | string | no |  |
| `signature` | string | no |  |
| `chain` | string | no |  |



```bash title="curl"
curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit \
  -X POST \
  -H 'x-client-secret: $CLIENT_SECRET' \
  -H 'content-type: application/json' \
  -d '{
       "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit", {
  method: "POST",
  headers: {
    "x-client-secret": clientSecret,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit",
    headers={"x-client-secret": client_secret},
    json={
        "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4"
    },
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | The attempt, with the submission recorded |

### Fetch a payment attempt
`GET /v0/checkout/{invoiceId}/attempts/{id}`
Refreshed from the provider when stale, like core `GET /v0/orders/{id}`. Poll it every 2 s while the page is visible, backing off to 10 s after 5 minutes (§4.5). It carries `invoiceStatus` too, so one poll drives the whole screen.
| Parameter | In | Required | Notes |
|---|---|---|---|
| `invoiceId` | path | yes |  |
| `id` | path | yes |  |



```bash title="curl"
curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw \
  -H 'x-client-secret: $CLIENT_SECRET'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw", {
  method: "GET",
  headers: {
    "x-client-secret": clientSecret,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/inv_3QkR7mVt9zLpXdB2hJn6Yw",
    headers={"x-client-secret": client_secret},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | The attempt and the invoice status it implies |

## Intents Route

### POST /v0/quotes
`POST /v0/quotes`
| Field | Type | Required | Notes |
|---|---|---|---|
| `tradeType` | `EXACT_INPUT` \| `EXACT_OUTPUT` | no |  |
| `from` | object | yes |  |
| `from.asset` | string | yes |  |
| `from.amount` | string | no |  |
| `to` | object | yes |  |
| `to.asset` | string | yes |  |
| `to.amount` | string | no |  |
| `sender` | string | yes |  |
| `recipient` | string | yes |  |
| `refundTo` | string | no |  |
| `slippageBps` | object | no |  |
| `providers` | array | no |  |
| `excludeProviders` | array | no |  |
| `rank` | `output` \| `speed` \| `balanced` | no |  |
| `executionModes` | array | no |  |
| `timeoutMs` | integer | no |  |



```bash title="curl"
curl https://api.intents.fi/v0/quotes \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY' \
  -H 'content-type: application/json' \
  -d '{
       "from": {
         "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
         "amount": "100000000"
       },
       "to": {
         "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
       },
       "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764",
       "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05",
       "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/quotes", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "from": {
      "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
      "amount": "100000000"
    },
    "to": {
      "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
    },
    "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764",
    "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05",
    "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/quotes",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
    json={
        "from": {
            "asset": "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
            "amount": "100000000"
        },
        "to": {
            "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
        },
        "sender": "0x15AAB9098125C5A728CA818B31620a902C25f764",
        "recipient": "0x9b3c1f4A6D2E5b70CA18F4D3e9B2A7C641FD8E05",
        "refundTo": "0x15AAB9098125C5A728CA818B31620a902C25f764"
    },
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Ranked quotes from every provider that answered in time |

### GET /v0/chains
`GET /v0/chains`


```bash title="curl"
curl https://api.intents.fi/v0/chains \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/chains", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/chains",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Supported chains |

### GET /v0/assets
`GET /v0/assets`
| Parameter | In | Required | Notes |
|---|---|---|---|
| `chain` | query | no |  |
| `q` | query | no |  |
| `limit` | query | no |  |



```bash title="curl"
curl https://api.intents.fi/v0/assets?limit=25 \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/assets?limit=25", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/assets?limit=25",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Assets routable by at least one provider. Look up by address; symbols are display-only. |

### POST /v0/orders
`POST /v0/orders`
| Field | Type | Required | Notes |
|---|---|---|---|
| `quoteId` | string | yes |  |
| `driftToleranceBps` | integer | no |  |



```bash title="curl"
curl https://api.intents.fi/v0/orders \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY' \
  -H 'content-type: application/json' \
  -d '{
       "quoteId": "<quoteId>"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/orders", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "quoteId": "<quoteId>"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/orders",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
    json={
        "quoteId": "<quoteId>"
    },
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Existing order for this quote |
| `201` | Order created |

### POST /v0/orders/{id}/submit
`POST /v0/orders/{id}/submit`
| Parameter | In | Required | Notes |
|---|---|---|---|
| `id` | path | yes |  |

| Field | Type | Required | Notes |
|---|---|---|---|
| `txHash` | string | no |  |
| `signature` | string | no |  |
| `chain` | string | no |  |



```bash title="curl"
curl https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY' \
  -H 'content-type: application/json' \
  -d '{
       "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw/submit",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
    json={
        "txHash": "0x7c1e4f93a2bd58e06c4a7f2319db8e5a4c0f6b27d9138ae5c2f74b081d6a93e4"
    },
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Submission recorded |

### GET /v0/orders/{id}
`GET /v0/orders/{id}`
| Parameter | In | Required | Notes |
|---|---|---|---|
| `id` | path | yes |  |



```bash title="curl"
curl https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/orders/inv_3QkR7mVt9zLpXdB2hJn6Yw",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Order status (refreshed from the provider when stale) |

### Check a Connect request before showing it
`POST /v0/connect/check`
Validates what a plugin sent to `dashboard.intents.fi/connect`: a known platform, https URLs, a `return_url` on the same origin as `site_url`, a `state` and an S256 `code_challenge`. A refused request is never shown and the browser is never sent to its `return_url`. Needs no authentication and reads nothing.
| Field | Type | Required | Notes |
|---|---|---|---|
| `platform` | string | yes | One of woocommerce, whmcs, prestashop, opencart, magento |
| `site_url` | string | yes | The store, e.g. `https://shop.example.com` |
| `return_url` | string | yes | Where the browser goes back to. Must share `site_url`'s origin. |
| `state` | string | yes | The plugin's own random value, echoed back |
| `code_challenge` | string | yes | base64url(SHA-256(code_verifier)) |
| `code_challenge_method` | `S256` | no |  |
| `mode` | `test` \| `live` | no | Default `test` |
| `partner` | string | no | Agency Partner ID, when present |



```bash title="curl"
curl https://api.intents.fi/v0/connect/check \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY' \
  -H 'content-type: application/json' \
  -d '{
       "platform": "woocommerce",
       "site_url": "https://shop.northwood.example",
       "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return",
       "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd",
       "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
       "mode": "test"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/connect/check", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "platform": "woocommerce",
    "site_url": "https://shop.northwood.example",
    "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return",
    "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd",
    "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
    "mode": "test"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/connect/check",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
    json={
        "platform": "woocommerce",
        "site_url": "https://shop.northwood.example",
        "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return",
        "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd",
        "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
        "mode": "test"
    },
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | A request the consent screen may show |
| `400` | INVALID_REQUEST, with `details.field` |

### Approve a Connect request (the consent screen's Connect button)
`POST /v0/connect/authorize`
Dashboard session only. Re-checks the request, then issues a single-use code (5 minutes) bound to the site, the return URL and the challenge. `mode: live` is `LIVE_MODE_LOCKED` until the go-live checklist is done. Choose the account with `x-account-id`.
| Field | Type | Required | Notes |
|---|---|---|---|
| `platform` | string | yes | One of woocommerce, whmcs, prestashop, opencart, magento |
| `site_url` | string | yes | The store, e.g. `https://shop.example.com` |
| `return_url` | string | yes | Where the browser goes back to. Must share `site_url`'s origin. |
| `state` | string | yes | The plugin's own random value, echoed back |
| `code_challenge` | string | yes | base64url(SHA-256(code_verifier)) |
| `code_challenge_method` | `S256` | no |  |
| `mode` | `test` \| `live` | no | Default `test` |
| `partner` | string | no | Agency Partner ID, when present |



```bash title="curl"
curl https://api.intents.fi/v0/connect/authorize \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY' \
  -H 'content-type: application/json' \
  -d '{
       "platform": "woocommerce",
       "site_url": "https://shop.northwood.example",
       "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return",
       "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd",
       "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
       "mode": "test"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/connect/authorize", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "platform": "woocommerce",
    "site_url": "https://shop.northwood.example",
    "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return",
    "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd",
    "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
    "mode": "test"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/connect/authorize",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
    json={
        "platform": "woocommerce",
        "site_url": "https://shop.northwood.example",
        "return_url": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return",
        "state": "Vb3k9QxR2mT7LpZ4cW8nYaKd",
        "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
        "mode": "test"
    },
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Approved |
| `400` | INVALID_REQUEST |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED for an API key; FORBIDDEN below the role needed |

### Exchange a Connect code for the store's keys (server to server)
`POST /v0/connect/token`
Called by the plugin's server, never a browser. The code is spent by the first attempt, right or wrong; presenting a spent code again revokes the connection it made. Returns a secret key named for the site and scoped to the merchant, which can create invoices and register webhooks but never change where the merchant is paid. Test-mode keys unless the code was approved for live after go-live.
| Field | Type | Required | Notes |
|---|---|---|---|
| `code` | string | yes |  |
| `code_verifier` | string | yes |  |
| `site_url` | string | yes | The same `site_url` the request named |



```bash title="curl"
curl https://api.intents.fi/v0/connect/token \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY' \
  -H 'content-type: application/json' \
  -d '{
       "code": "<the code from return_url>",
       "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
       "site_url": "https://shop.northwood.example"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/connect/token", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "code": "<the code from return_url>",
    "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
    "site_url": "https://shop.northwood.example"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/connect/token",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
    json={
        "code": "<the code from return_url>",
        "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
        "site_url": "https://shop.northwood.example"
    },
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Connected |
| `400` | CONNECT_CODE_INVALID: unknown, expired, used, wrong verifier or site |
| `403` | LIVE_MODE_LOCKED or MERCHANT_RESTRICTED |

### Disconnect a store: revoke this key's connection
`POST /v0/connect/revoke`
Authenticated with the connection's own secret key. Revokes its keys and the webhooks they registered, at once.


```bash title="curl"
curl https://api.intents.fi/v0/connect/revoke \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/connect/revoke", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/connect/revoke",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Revoked |
| `401` | Missing or invalid API key |
| `404` | The key is not a Connect key |

### Become an affiliate: a profile with a generated code
`POST /v0/affiliate/signup`


```bash title="curl"
curl https://api.intents.fi/v0/affiliate/signup \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/affiliate/signup", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/affiliate/signup",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `201` | Created |
| `400` | INVALID_REQUEST, with `details.field` |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED for an API key |
| `409` | AFFILIATE_EXISTS: this user already has a profile |

### The affiliate's profile, link, share, status and payout wallet (masked)
`GET /v0/affiliate/me`


```bash title="curl"
curl https://api.intents.fi/v0/affiliate/me \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/affiliate/me", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/affiliate/me",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Profile |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED for an API key |
| `404` | AFFILIATE_REQUIRED: this user has no affiliate profile |

### Edit the display name, website, type, notifications, or change the code once
`PATCH /v0/affiliate/me`


```bash title="curl"
curl https://api.intents.fi/v0/affiliate/me \
  -X PATCH \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/affiliate/me", {
  method: "PATCH",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.patch(
    "https://api.intents.fi/v0/affiliate/me",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Saved |
| `400` | INVALID_REQUEST, with `details.field` |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED for an API key |
| `404` | AFFILIATE_REQUIRED: this user has no affiliate profile |
| `409` | AFFILIATE_CODE_TAKEN, or AFFILIATE_CODE_LOCKED after one change |

### Close the affiliate profile; only when nothing is pending, payable or held
`POST /v0/affiliate/me/close`
Sets `status` to `closed` (a status, not a delete: the audit trail and the code stay reserved). Refused with `AFFILIATE_CLOSE_BLOCKED` while any commission is pending, payable or held, or a payout is pending. Added by Agent B (orchestrator decision, 2026-11-26).


```bash title="curl"
curl https://api.intents.fi/v0/affiliate/me/close \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/affiliate/me/close", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/affiliate/me/close",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Closed |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED for an API key |
| `404` | AFFILIATE_REQUIRED: this user has no affiliate profile |
| `409` | AFFILIATE_CLOSE_BLOCKED: commission is still pending, payable or held |

### Totals, next payout, funnel and daily series
`GET /v0/affiliate/overview`
| Parameter | In | Required | Notes |
|---|---|---|---|
| `range` | query | no | Default `30d`; the funnel and series |



```bash title="curl"
curl https://api.intents.fi/v0/affiliate/overview \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/affiliate/overview", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/affiliate/overview",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Overview |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED for an API key |
| `404` | AFFILIATE_REQUIRED: this user has no affiliate profile |

### Earnings per referred merchant (masked); JSON or CSV
`GET /v0/affiliate/merchants`
| Parameter | In | Required | Notes |
|---|---|---|---|
| `status` | query | no |  |
| `source` | query | no |  |
| `format` | query | no | `csv` for a download |



```bash title="curl"
curl https://api.intents.fi/v0/affiliate/merchants?status=signed_up \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/affiliate/merchants?status=signed_up", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/affiliate/merchants?status=signed_up",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Merchants |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED for an API key |
| `404` | AFFILIATE_REQUIRED: this user has no affiliate profile |

### The per-payment ledger; JSON or CSV
`GET /v0/affiliate/commissions`
| Parameter | In | Required | Notes |
|---|---|---|---|
| `status` | query | no |  |
| `month` | query | no | Payment month, `YYYY-MM` |
| `merchant` | query | no | A `merchantRef` from /v0/affiliate/merchants |
| `format` | query | no | `csv` for a download |



```bash title="curl"
curl https://api.intents.fi/v0/affiliate/commissions?status=paid \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/affiliate/commissions?status=paid", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/affiliate/commissions?status=paid",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Commissions |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED for an API key |
| `404` | AFFILIATE_REQUIRED: this user has no affiliate profile |

### Tracked links with clicks, signups, live merchants and earnings each
`GET /v0/affiliate/links`


```bash title="curl"
curl https://api.intents.fi/v0/affiliate/links \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/affiliate/links", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/affiliate/links",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Links |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED for an API key |
| `404` | AFFILIATE_REQUIRED: this user has no affiliate profile |

### Add a tracked link (a name for a sub-ID and a target page)
`POST /v0/affiliate/links`


```bash title="curl"
curl https://api.intents.fi/v0/affiliate/links \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/affiliate/links", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/affiliate/links",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `201` | Created |
| `400` | INVALID_REQUEST, with `details.field` |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED for an API key |
| `404` | AFFILIATE_REQUIRED: this user has no affiliate profile |
| `409` | AFFILIATE_LINK_EXISTS: that sub-ID is already one of your links |

### Remove a tracked link (its past clicks still count)
`DELETE /v0/affiliate/links/{id}`
| Parameter | In | Required | Notes |
|---|---|---|---|
| `id` | path | yes |  |



```bash title="curl"
curl https://api.intents.fi/v0/affiliate/links/inv_3QkR7mVt9zLpXdB2hJn6Yw \
  -X DELETE \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/affiliate/links/inv_3QkR7mVt9zLpXdB2hJn6Yw", {
  method: "DELETE",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.delete(
    "https://api.intents.fi/v0/affiliate/links/inv_3QkR7mVt9zLpXdB2hJn6Yw",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `204` | Removed |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED for an API key |
| `404` | AFFILIATE_REQUIRED: this user has no affiliate profile |

### Set the USDC payout wallet; a change after the first needs a step-up code
`PUT /v0/affiliate/payout-wallet`
The first wallet takes effect at once. Every later change needs `stepUpCode` (purpose `affiliate_payout_wallet`). A wallet changed less than 24 hours before a payout run is skipped that month.


```bash title="curl"
curl https://api.intents.fi/v0/affiliate/payout-wallet \
  -X PUT \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/affiliate/payout-wallet", {
  method: "PUT",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.put(
    "https://api.intents.fi/v0/affiliate/payout-wallet",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Saved |
| `400` | INVALID_REQUEST: bad checksum, unsupported chain or a known exchange address |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED, STEP_UP_REQUIRED, AFFILIATE_SUSPENDED or AFFILIATE_CLOSED |
| `404` | AFFILIATE_REQUIRED: this user has no affiliate profile |

### Email a fresh code for a payout wallet change (purpose `affiliate_payout_wallet`)
`POST /v0/affiliate/step-up`
Works without an account (an affiliate is a user's). `POST /v0/dashboard/step-up` with `purpose: affiliate_payout_wallet` issues the same code for a user who is an account member. Send the code as `stepUpCode` on `PUT /v0/affiliate/payout-wallet`. Added by Agent B (2026-11-26).


```bash title="curl"
curl https://api.intents.fi/v0/affiliate/step-up \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/affiliate/step-up", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/affiliate/step-up",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | A code was emailed to the signed-in user |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED for an API key |
| `404` | AFFILIATE_REQUIRED: this user has no affiliate profile |
| `429` | RATE_LIMITED: too many codes this hour |

### Payout history
`GET /v0/affiliate/payouts`


```bash title="curl"
curl https://api.intents.fi/v0/affiliate/payouts \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/affiliate/payouts", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/affiliate/payouts",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Payouts |
| `401` | No valid dashboard session |
| `403` | SESSION_REQUIRED for an API key |
| `404` | AFFILIATE_REQUIRED: this user has no affiliate profile |

### Public: is this an active affiliate code? For the plugin settings field
`GET /v0/ref/resolve`
| Parameter | In | Required | Notes |
|---|---|---|---|
| `code` | query | yes |  |



```bash title="curl"
curl https://api.intents.fi/v0/ref/resolve?code=%3Ccode%3E \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/ref/resolve?code=%3Ccode%3E", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/ref/resolve?code=%3Ccode%3E",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Cached for 5 minutes |

### Route status
`GET /v0/status`
Per-protocol success and quote-error rates, the median improvement of intents.fi's best quote over NEAR Intents alone, recent failover events, and each protocol's state for each of the last 90 UTC days. Public, aggregates only, test mode excluded, recomputed at most once a minute.
| Parameter | In | Required | Notes |
|---|---|---|---|
| `window` | query | no | How far back the figures reach |



```bash title="curl"
curl https://api.intents.fi/v0/status \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/status", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/status",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | The route status for the window |

## Platform: webhooks, fees and health

### GET /health
`GET /health`


```bash title="curl"
curl https://api.intents.fi/health \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/health", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/health",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Service is up |

### GET /health/migrations
`GET /health/migrations`


```bash title="curl"
curl https://api.intents.fi/health/migrations \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/health/migrations", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/health/migrations",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | The database has applied every migration this deploy expects |
| `503` | Migrations are pending, or the migration history can't be read |

### GET /health/config
`GET /health/config`


```bash title="curl"
curl https://api.intents.fi/health/config \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/health/config", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/health/config",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Every secret production needs is set |
| `503` | A production secret is missing; `missing` names it |

### POST /v0/webhooks
`POST /v0/webhooks`
| Field | Type | Required | Notes |
|---|---|---|---|
| `url` | string | yes |  |
| `events` | array | no | Event types to deliver. Checkout merchants subscribe to `invoice.*`; they never receive `order.updated` for a payment attempt's order (SPEC-checkout §4.4). |



```bash title="curl"
curl https://api.intents.fi/v0/webhooks \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY' \
  -H 'content-type: application/json' \
  -d '{
       "url": "https://northwood.example/hooks/intents"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/webhooks", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "url": "https://northwood.example/hooks/intents"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/webhooks",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
    json={
        "url": "https://northwood.example/hooks/intents"
    },
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `201` | Webhook registered. The signing secret is returned only here. |

### GET /v0/webhooks
`GET /v0/webhooks`


```bash title="curl"
curl https://api.intents.fi/v0/webhooks \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/webhooks", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/webhooks",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Active webhooks |

### Send a signed test event to the endpoint now (test keys only)
`POST /v0/webhooks/{id}/test`
Delivers one test event, signed with the endpoint's real secret, outside the retry queue. `type` picks the event (default `invoice.paid`): its `data` is a sample test-mode invoice that does not exist, and the envelope carries `sample: true`. `webhook.test` sends a ping with no invoice. Test (`ik_test_`) keys only: a live key gets `TEST_MODE_ONLY`. The response carries the request body and the endpoint's answer (truncated to 2 KB), whatever it was.
| Parameter | In | Required | Notes |
|---|---|---|---|
| `id` | path | yes |  |

| Field | Type | Required | Notes |
|---|---|---|---|
| `type` | `webhook.test` \| `invoice.processing` \| `invoice.underpaid` \| `invoice.paid` \| `invoice.expired` \| `invoice.canceled` \| `invoice.needs_review` | no | Default `invoice.paid`. |



```bash title="curl"
curl https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test \
  -X POST \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw/test",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Sent, whether or not the endpoint accepted it: see `delivered`. |

### DELETE /v0/webhooks/{id}
`DELETE /v0/webhooks/{id}`
| Parameter | In | Required | Notes |
|---|---|---|---|
| `id` | path | yes |  |



```bash title="curl"
curl https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw \
  -X DELETE \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw", {
  method: "DELETE",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.delete(
    "https://api.intents.fi/v0/webhooks/inv_3QkR7mVt9zLpXdB2hJn6Yw",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Deleted |

### GET /v0/fees/balance
`GET /v0/fees/balance`


```bash title="curl"
curl https://api.intents.fi/v0/fees/balance \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/fees/balance", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/fees/balance",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Partner fee balance: accrued partner share minus payouts sent |

### GET /v0/fees/statement
`GET /v0/fees/statement`
| Parameter | In | Required | Notes |
|---|---|---|---|
| `month` | query | yes |  |
| `format` | query | no |  |



```bash title="curl"
curl https://api.intents.fi/v0/fees/statement?month=2026-10 \
  -H 'authorization: Bearer $INTENTS_SECRET_KEY'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/fees/statement?month=2026-10", {
  method: "GET",
  headers: {
    authorization: `Bearer ${process.env.INTENTS_SECRET_KEY}`,
  },
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import os
import httpx

response = httpx.get(
    "https://api.intents.fi/v0/fees/statement?month=2026-10",
    headers={"authorization": f"Bearer {os.environ['INTENTS_SECRET_KEY']}"},
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `200` | Per-order fee lines for a month, with totals (JSON, or CSV with format=csv) |

---

Source: https://intents.fi/docs/api · The whole corpus: https://intents.fi/docs/llms-full.txt
