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

# Headless bridging

By the end of this guide, you'll know how to use Mesh's headless bridging APIs to discover bridged routes, quote a bridge, generate a bridging address, and report the deposits you handle natively — so you can offer users far more asset/network options (for deposit or withdrawal) than you natively support, with one reconciliation stream for all of them, without building, hosting, or embedding any Mesh UI.

> [!TIP]
>
> **Before you start**
>
> * Your core Mesh integration is working end-to-end (see [Prepare for go-live](https://docs.meshconnect.com/build/go-live.md))
> * **Headless bridging is enabled for your Mesh client.** This is gated per-client — contact your Mesh representative to turn it on.
> * The origin and destination asset/network pairs you want to bridge have been configured as routes for your account — your Mesh representative sets these up.

## Overview

Headless bridging gives you Mesh's cross-chain bridging engine as a pure API — **no Mesh-hosted UI, no iframe, no SDK**. You keep your own front end; Mesh does four things for you:

1. **Route discovery** — tells you every asset/network pair that Mesh can bridge into or out of the pairs you support, so you can offer them on top of your native options. These pairs can be offered in a deposit flow or withdrawal flow.
2. **Quote** *(optional)* — for a given pay-in amount on a bridged pair, returns the estimated amount the recipient will receive after bridging fees, so you can show it before anything is sent.
3. **Address generation** — returns a single-use address that is programmed to bridge funds from a pay-in pair into the destination pair (and address) the user selected.
4. **Native deposit reporting** — lets you report a deposit you received on one of your own addresses (no bridge involved) after you detect it, so Mesh verifies it on chain and tracks it with the same webhooks as a bridged transfer.

This lets you present users with many more options while you keep full control of the experience.

> [!NOTE]
>
> **Native vs. bridged pairs**
>
> A **native** pair is one your platform already sends or receives directly. A **bridged** pair is one Mesh makes possible by bridging on your behalf. Bridged pairs use the bridging APIs (`/api/v1/bridging/*`) to move funds. Native pairs are handled entirely by your platform and Mesh is not in the payment path, but you can report each native deposit after the fact with `POST /api/v1/bridging/notify` ([Step 4](#step-4-—-notify-mesh-of-a-native-deposit)) so it is tracked and reconciled like a bridged one.

## How it works

The whole flow is two required API calls plus an optional quote. Everything after route discovery only happens for bridged pairs, except the optional notify call for deposits you handle natively:

1. **You call Mesh — route discovery.** You send the asset/network pairs you support (as origins for a withdrawal, or destinations for a deposit). Mesh returns the bridged routes it can offer into (deposit) or out of (withdrawal) those pairs. Mesh does not know which pairs you support natively, so filter out routes whose other leg you already handle before showing options.
2. **You show the user their options** — your native pairs plus the bridged pairs from step 1.
3. **The user selects a destination:**
   * **If native** → you handle it exactly as you do today; Mesh is not in the payment path. Once you detect the deposit on chain, you can **notify** Mesh with its transaction hash ([Step 4](#step-4-—-notify-mesh-of-a-native-deposit)) so it is recorded, verified, and reported through the same webhooks as a bridged transfer.
   * **If bridged** → optionally call Mesh to **get a quote** for the amount the user entered, and show them the estimated receive amount. Once they confirm, call Mesh to **create a bridged address**. For user deposits, you'll show the user that address to which they can send the pay-in funds. For user withdrawals, you'll send the pay-in to that address. Mesh bridges the funds to the specified pair and address.

All endpoints live on the Mesh B2B API under `/api/v1/bridging`, use JSON with `camelCase` fields, and authenticate with your `X-Client-Id` and `X-Client-Secret` headers on every request.

> [!NOTE]
>
> **Seeing `permissionDenied`?** Until headless bridging is enabled for your client, every headless bridging call described on this page returns HTTP `403` with `"status": "permissionDenied"` and the message `Headless bridging is not enabled for this client`. That is the expected response, not a malformed request. Contact your Mesh representative to have it turned on.

> [!WARNING]
>
> Bridging executes **on mainnet**. A generated address is a real, live address, and any pay-in moves real funds — there is no testnet simulation of the bridge itself. Test with small amounts.

## Step 1 — Discover routes

Route discovery comes in two shapes depending on your flow. Both return the same response structure.

* **Withdrawal** (`POST /api/v1/bridging/routes/withdrawal`) — you send `sources` (the pairs your platform can pay out / send from). Mesh returns the destinations you can bridge those into.
* **Deposit** (`POST /api/v1/bridging/routes/deposit`) — you send `destinations` (the pairs you can ultimately receive). Mesh returns the origins a user could pay in from.

> [accordion] Parameter reference
>
> `X-Client-Id` requiredYour Mesh Client ID. Requires **read** access.
>
> `X-Client-Secret` requiredYour Mesh API Key.
>
> `sources` *(withdrawal)* requiredNon-empty array of the pairs you can send from. Each entry: `network` (CAIP-2 chain id, e.g. `eip155:1`) and `asset` (symbol, case-insensitive, e.g. `USDC`).
>
> `destinations` *(deposit)* requiredNon-empty array of the pairs you can receive. Same `{ network, asset }` shape as `sources`.
>
> `optimized` optional
>
> Defaults to `true`. When `true`, Mesh returns at most one *source* per distinct *destination* (withdrawal) or at most one *destination* per distinct *source* (deposit), choosing the preferred counterpart using a Mesh-configured network priority. Set to `false` to return every matching origin → destination pair.With a single settlement source (e.g. Polygon USDC), `optimized: true` still returns every available destination.

```bash theme={null}
# Replace YOUR_CLIENT_ID and YOUR_API_KEY with your Mesh credentials.
# Replace the sources entries with the pairs you settle in.
# eip155:137 + USDC is USDC on Polygon.
curl --request POST \
  --url https://integration-api.meshconnect.com/api/v1/bridging/routes/withdrawal \
  --header 'Content-Type: application/json' \
  --header 'X-Client-Id: YOUR_CLIENT_ID' \
  --header 'X-Client-Secret: YOUR_API_KEY' \
  --data '
{
  "sources": [
    { "network": "eip155:137", "asset": "USDC" }
  ],
  "optimized": true
}
'
```

Each item in `routes` is an `origin → destination` pair you can offer. Use `status` on the envelope to confirm success; `routes` may be empty when no bridged pairs match.

Do not branch on `status` alone. An unknown network, or a pair with no configured route, is not an error here: you get `status: "ok"` with an empty `routes` array. Schema-level failures, such as a missing required field or an empty `sources` / `destinations` array, come back in the same envelope with `status: "badRequest"` and `errorType: "invalidField"` (or `"missingField"` when a required field is omitted), with the offending field named in `message`.

```json theme={null}
{
  "status": "ok",
  "content": {
    "routes": [
      {
        "origin": { "network": "eip155:137", "asset": "USDC" },
        "destination": { "network": "eip155:1", "asset": "USDC" },
        "displayName": "USDC on Polygon → USDC on Ethereum"
      }
    ]
  }
}
```

The deposit call is the same shape with `destinations` instead of `sources`. Here the platform receives USDC on Ethereum and asks which pairs a user could pay in from:

```bash theme={null}
# Replace YOUR_CLIENT_ID and YOUR_API_KEY with your Mesh credentials.
# Replace the destinations entries with the pairs you receive.
# eip155:1 + USDC is USDC on Ethereum.
curl --request POST \
  --url https://integration-api.meshconnect.com/api/v1/bridging/routes/deposit \
  --header 'Content-Type: application/json' \
  --header 'X-Client-Id: YOUR_CLIENT_ID' \
  --header 'X-Client-Secret: YOUR_API_KEY' \
  --data '
{
  "destinations": [
    { "network": "eip155:1", "asset": "USDC" }
  ],
  "optimized": true
}
'
```

Each route's `destination` is one of the pairs you sent; `origin` is the pair the user would pay in with. With `optimized: true` you get at most one destination per distinct origin.

```json theme={null}
{
  "status": "ok",
  "content": {
    "routes": [
      {
        "origin": { "network": "eip155:137", "asset": "USDC" },
        "destination": { "network": "eip155:1", "asset": "USDC" },
        "displayName": "USDC on Polygon → USDC on Ethereum"
      },
      {
        "origin": { "network": "eip155:8453", "asset": "USDC" },
        "destination": { "network": "eip155:1", "asset": "USDC" },
        "displayName": "USDC on Base → USDC on Ethereum"
      }
    ]
  }
}
```

## Step 2 — Get a quote (optional)

Whenever you know the pay-in amount before the transfer, in either flow, call `POST /api/v1/bridging/quote` with the `origin` and `destination` from the selected route, the payout `address`, and the `amount`. For a withdrawal that is the amount the user asked to withdraw; for a deposit it is the amount the user told you they will send. Mesh returns the estimated amount the recipient will receive after bridging fees, plus the fee lines behind it. Nothing is created or persisted, so call it as often as the user changes the amount. Requires **read** access.

> [!NOTE]
>
> **The quote is an estimate.** The bridging address from Step 3 accepts any amount and the bridge is priced on what actually arrives, so fees and rates can move between quoting and settlement. Show `estimatedAmount` as an estimate and surface `warnings` to the user. Skip this step only when you have no amount to quote, for example a deposit where the user decides the amount in their own wallet after seeing the address.

> [accordion] Parameter reference
>
> `X-Client-Id` requiredYour Mesh Client ID. Requires **read** access.
>
> `X-Client-Secret` requiredYour Mesh API Key.
>
> `origin.network` / `origin.asset` requiredThe pay-in leg, taken from the selected route's `origin`. Same shape as in Step 3.
>
> `destination.network` / `destination.asset` / `destination.address` requiredThe payout leg and recipient wallet, taken from the selected route's `destination` plus the address you will pass to Step 3.
>
> `amount` requiredDecimal amount to be sent, in the **origin asset** (e.g. `100` for 100 USDC). Must be greater than zero and at most 1,000,000,000.

```bash theme={null}
# Replace YOUR_CLIENT_ID and YOUR_API_KEY with your Mesh credentials.
# origin and destination come from the route the user selected.
curl --request POST \
  --url https://integration-api.meshconnect.com/api/v1/bridging/quote \
  --header 'Content-Type: application/json' \
  --header 'X-Client-Id: YOUR_CLIENT_ID' \
  --header 'X-Client-Secret: YOUR_API_KEY' \
  --data '
{
  "origin": {
    "network": "eip155:137",
    "asset": "USDC"
  },
  "destination": {
    "network": "eip155:1",
    "asset": "USDC",
    "address": "0x1234567890123456789012345678901234567890"
  },
  "amount": 100
}
'
```

Show `destination.estimatedAmount` to the user as the estimated receive amount. `fees.items` explains where the difference went.

```json theme={null}
{
  "status": "ok",
  "content": {
    "origin": { "network": "eip155:137", "asset": "USDC", "amount": 100 },
    "destination": {
      "network": "eip155:1",
      "asset": "USDC",
      "address": "0x1234567890123456789012345678901234567890",
      "estimatedAmount": 98.7,
      "minimumAmount": 96.7
    },
    "fees": {
      "items": [
        {
          "kind": "originGas",
          "label": "Origin gas",
          "amount": 0.85,
          "asset": "POL",
          "amountUsd": 0.09,
          "includedInEstimate": false
        },
        {
          "kind": "providerRelayerService",
          "label": "Relayer service fee",
          "amount": 0.2,
          "asset": "USDC",
          "amountUsd": 0.2,
          "includedInEstimate": true
        },
        {
          "kind": "providerRelayerGas",
          "label": "Relayer gas fee",
          "amount": 1.1,
          "asset": "USDC",
          "amountUsd": 1.1,
          "includedInEstimate": true
        },
        {
          "kind": "providerAggregate",
          "label": "Relayer (aggregate)",
          "amount": 1.3,
          "asset": "USDC",
          "amountUsd": 1.3,
          "includedInEstimate": true
        }
      ],
      "totalUsd": 1.3
    },
    "rate": 0.987,
    "constraints": {
      "minimumAmount": "1.001002",
      "maximumAmount": "500500.5005"
    },
    "quotedAt": 1791000000,
    "warnings": [
      "This quote is an estimate. The deposit address returned by POST /api/v1/bridging/address accepts any amount and the bridge is priced on the amount that actually arrives; fees and rates may change between quoting and settlement."
    ]
  }
}
```

> [accordion] Response reference
>
> `origin.amount`The pay-in amount the quote was priced for, in the origin asset.
>
> `destination.estimatedAmount`Estimated amount the recipient receives in the destination asset, net of the fees marked `includedInEstimate: true`. Indicative only.
>
> `destination.minimumAmount`Worst-case receive amount in the destination asset if prices move against the quote within Mesh's slippage tolerance — the "minimum received" figure a swap UI shows (here 98.7 estimated, 96.7 worst case). May be `null`. Indicative for this quote only; the bridge is priced on what actually arrives. Not to be confused with `constraints.minimumAmount`, the smallest pay-in accepted, in the origin asset.
>
> `fees.items[]`
>
> One line per fee: `kind`, `label`, `amount`, `asset`, `amountUsd`, `includedInEstimate`.**`includedInEstimate: true` — already deducted from `destination.estimatedAmount`.** `providerRelayerService` (the bridge provider's service fee) and `providerRelayerGas` (gas to deliver on the destination chain). `providerAggregate` is the rollup of those two — do not add it to them. Their `amountUsd` sum equals `fees.totalUsd`.**`includedInEstimate: false` — not deducted; paid by the sender.** `originGas` is the gas for the pay-in transaction, in the origin network's gas token (e.g. `POL`), paid by whichever wallet sends the pay-in — your platform on a withdrawal, the end user on a deposit — so make sure it has gas. `integrator` and `subsidized` are usually `0`.Fee `amount`s are in origin-side units (the gas token or the asset you send), never the destination asset; use `amountUsd` to compare or total.
>
> `fees.totalUsd`USD value of the fees deducted from the bridged funds (`providerRelayerService` + `providerRelayerGas`). Does not include `originGas`. May be `null`.
>
> `rate`Destination units received per 1 unit sent, after fees (`estimatedAmount / amount`, here 0.987). Not a market price — on a same-asset bridge the shortfall below 1 is entirely fees. It varies with the amount, so re-quote rather than reusing it. Most integrations can simply display `estimatedAmount`.
>
> `constraints.minimumAmount / maximumAmount`Decimal strings in the **origin asset** — the pay-in range Mesh accepts for this route. An `amount` outside it is rejected with `amountBelowMinimum` / `amountExceedsMaximum`. The same limits are returned by `/address` (Step 3), converted at the current price, so they can differ slightly between calls; enforce the `/address` values you show the user.
>
> `quotedAt`Unix seconds when the quote was produced. Re-quote if the user lingers before confirming.
>
> `warnings`Human-readable caveats to show alongside the estimate.

Common errors (`errorType` in the envelope):

* `badRequest` — unknown network, or no configured route for the pair.
* `amountBelowMinimum` — under the route minimum (`constraints.minimumAmount`) or less than the provider will bridge. Raise the amount and re-quote.
* `amountExceedsMaximum` — over the route maximum (`constraints.maximumAmount`) or the provider's available liquidity. Lower the amount and re-quote.
* `invalidDestinationAddress` (`400`) — `destination.address` is not a valid address for the destination network. Fix the address; retrying will not help.
* `serverFailureRetryable` (`503`) — the route cannot be priced right now, typically a temporary liquidity gap. Retry with backoff.
* `permissionDenied` — headless bridging is not enabled for your client.
* `invalidField` / `missingField` — schema violation (missing field, `amount` not in `(0, 1,000,000,000]`, `address` over 200 characters); `message` names the field.

## Step 3 — Create a bridged address

When a user selects a **bridged** pair (and has confirmed the quoted estimate, if you showed one), call this endpoint with the route's `origin` and `destination`, plus the payout `address`: the user's wallet on a withdrawal, or your platform receive address on a deposit. Mesh returns a single-use deposit address to send the pay-in to.

> [accordion] Parameter reference
>
> `X-Client-Id` requiredYour Mesh Client ID. Requires **write** access.
>
> `X-Client-Secret` requiredYour Mesh API Key.
>
> `userId` requiredYour unique, persistent identifier for the user (max 384 characters). Do not use PII such as an email or phone number.
>
> `transactionId` requiredYour unique transfer/order id (max 128 characters). Single-use per `userId`. While the transfer is pending, repeating the call with the same `origin`, `destination`, and `address` returns the same bridging address and the same `expirationTime`; changing any of them returns `400 badRequest` with a message naming the field. Once the transfer has reached `succeeded` or `failed`, the same `transactionId` returns `409` — use a new `transactionId` for every new pay-in.
>
> `origin.network` requiredCAIP-2 chain id of the pay-in leg (the pair you'll send from). Taken from the selected route's `origin`.
>
> `origin.asset` requiredAsset symbol of the pay-in leg. Taken from the selected route's `origin`.
>
> `destination.network` requiredCAIP-2 chain id of the payout leg. Taken from the selected route's `destination`.
>
> `destination.asset` requiredAsset symbol of the payout leg. Taken from the selected route's `destination`.
>
> `destination.address` required
>
> The payout address on the destination chain. On a **withdrawal** this is the user's destination wallet. On a **deposit** it is your platform's receive address on that chain.The format must match that chain (e.g. `0x…` for EVM, base58 for Solana, `bc1…` / Bitcoin bech32 for BTC). Use the same address you quoted with in Step 2.

```bash theme={null}
# Replace YOUR_CLIENT_ID and YOUR_API_KEY with your Mesh credentials.
# Replace userId and transactionId with your own identifiers.
# origin is the pair you send from: eip155:137 + USDC is USDC on Polygon.
# destination is the route the user selected, plus the payout address:
# the user's wallet on a withdrawal, your platform's receive address on a deposit.
curl --request POST \
  --url https://integration-api.meshconnect.com/api/v1/bridging/address \
  --header 'Content-Type: application/json' \
  --header 'X-Client-Id: YOUR_CLIENT_ID' \
  --header 'X-Client-Secret: YOUR_API_KEY' \
  --data '
{
  "userId": "UNIQUE_USER_ID",
  "transactionId": "UNIQUE_TRANSACTION_ID",
  "origin": {
    "network": "eip155:137",
    "asset": "USDC"
  },
  "destination": {
    "network": "eip155:1",
    "asset": "USDC",
    "address": "0x1234567890123456789012345678901234567890"
  }
}
'
```

Send the pay-in (the `origin` asset on the `origin` network **only**) to `selectedRoute.bridgingAddress.address`. Mesh bridges it to the `destination`.

This endpoint does not take an amount and does not return a quoted `amountOut`. Send at least `constraints.minimumAmount` and, when `constraints.maximumAmount` is not `null`, no more than that (pay-ins outside these limits can fail at fill time, most often on BTC). Fees reduce what finally arrives, and the received amount is not part of this response; use Step 2 to show an estimate.

```json theme={null}
{
  "status": "ok",
  "content": {
    "tracking": {
      "userId": "UNIQUE_USER_ID",
      "transactionId": "UNIQUE_TRANSACTION_ID",
      "transferId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    },
    "selectedRoute": {
      "origin": { "network": "eip155:137", "asset": "USDC" },
      "bridgingAddress": { "address": "0xbridge000000000000000000000000000000000001" },
      "destination": {
        "network": "eip155:1",
        "asset": "USDC",
        "address": "0x1234567890123456789012345678901234567890"
      }
    },
    "constraints": {
      "minimumAmount": "1.001002",
      "maximumAmount": "500500.5005",
      "expirationTime": 1791341188,
      "singleUseAddress": true
    },
    "warnings": [
      "Single-use address only — do not reuse this address.",
      "Funds must be sent on the selected source network (Polygon).",
      "Fees may reduce the final received amount.",
      "Minimum transfer amount: 1.001002 USDC.",
      "Maximum transfer amount: 500500.5005 USDC."
    ]
  }
}
```

> [accordion] Response reference
>
> `tracking.transferId`Mesh transfer id (UUID). Use it to track status and match webhooks (see **Track the bridge** below).
>
> `selectedRoute.bridgingAddress.address`The address to display for the pay-in. Send only the `origin` asset on the `origin` network here.
>
> `constraints.minimumAmount` / `constraints.maximumAmount`
>
> Decimal strings in the *origin* asset, rounded to the asset's decimals. Limits Mesh sets for the route, converted into the origin asset at the current price (`minimumAmount` rounded up, `maximumAmount` rounded down), so they shift slightly between calls. `maximumAmount` is `null` when no maximum can be determined. The bridge provider's own limits apply on top.`warnings` repeats the minimum as `Minimum transfer amount: {n} {ASSET}.` and, when `maximumAmount` is not `null`, the maximum as `Maximum transfer amount: {n} {ASSET}.`Mesh cannot reject a pay-in once the address is live, so enforce both limits client-side before showing the address. A pay-in outside them may fail at fill time and need Mesh support to recover.
>
> `constraints.expirationTime`Unix seconds, 6 hours after the address was created. Fixed: repeat calls return the same value and do not extend it. If no pay-in has been detected by then, the transfer is marked `failed` and a `Failed` webhook is sent. Never send after this time; funds sent after expiry are not bridged automatically and need Mesh support to recover.
>
> `constraints.singleUseAddress`When `true`, the address is for this one transfer only — never reuse it for another pay-in.
>
> `warnings`Human-readable strings to surface to the user before they send the pay-in. The source network name is filled into the network warning (e.g. `Polygon`).

> [!WARNING]
>
> Addresses are **single-use**. Generate a fresh one (a new `transactionId`) for every pay-in, and never route a second transfer to a previously used address.

Errors are all in the envelope. `transactionId` reuse rules are in the parameter reference above (`400 badRequest` on a mismatch while pending, `409` after the transfer is terminal). Schema-level failures, such as a missing required field or a `destination.address` over 200 characters, return `errorType: "invalidField"` (or `"missingField"`) with the field named in `message`. `/address` prices the route before minting, so it can also return the two quote errors above: `invalidDestinationAddress` (`400`) means fix the address; `serverFailureRetryable` (`503`) means nothing was minted and the `transactionId` was not consumed, so retry the same call with backoff.

## Track the bridge

Each bridged transfer returns a Mesh `transferId`. Use it to reconcile the transfer and to match Mesh Transfer Status webhooks. Register your webhook endpoint in the Mesh dashboard under **Account > API keys > Webhooks**, and see the [Transfer status webhooks](https://docs.meshconnect.com/resources/webhooks.md) guide for payload details.

You can also poll [Get transfers initiated by Mesh](https://docs.meshconnect.com/api-reference/managed-transfers/get-transfers-initiated-by-mesh.md) (`GET /api/v1/transfers/managed/mesh`) with `Id` set to `tracking.transferId`, or `ClientTransactionId` set to your `transactionId`. The transfer is listed immediately as `pending` and then moves to `succeeded` or `failed`. Status can lag the on-chain fill by a few minutes, and BTC fills can stay pending well past the quote ETA without an error.

> [!NOTE]
>
> **Webhooks for headless bridging**
>
> * `Succeeded`: funds were delivered to `destination.address`. `TxHash` and `TransferSteps` carry the per-leg hashes; `TransactionId` echoes your `transactionId`.
> * `Failed`: sent at `expirationTime` if no pay-in was detected, or earlier if the bridge provider rejects the transfer (e.g. amount outside the min/max). For a native deposit reported via `/notify` ([Step 4](#step-4-—-notify-mesh-of-a-native-deposit)), `Failed` means Mesh could not verify the reported transaction on chain by `expirationTime`.
> * No `Pending` webhook is sent for headless transfers. Poll the list API if you need an intermediate state.
> * A pay-in that lands just before `expirationTime` can settle after `Failed` was sent; Mesh then sends `Succeeded` for the same `TransferId`. Deduplicate on `EventId` and, per `TransferId`, apply the event with the greater payload `Timestamp` — not arrival order, since a retried `Failed` can be delivered after the later `Succeeded`.

A `Succeeded` webhook for a headless bridge looks like this (USDC on Polygon → USDC on Ethereum). In `TransferSteps`, the step with `StepOrder` 1 is the pay-in leg into the bridging address and the step with `StepOrder` 2 is the payout leg to `destination.address`. Select steps by `StepOrder`, not by position, since a step is listed only once its tx hash is known. The top-level `Chain`, `Token`, `DestinationAmount` and `TxHash` all describe the payout leg.

```json theme={null}
{
  "TransferId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "TransactionId": "UNIQUE_TRANSACTION_ID",
  "UserId": "UNIQUE_USER_ID",
  "TransferStatus": "Succeeded",
  "SourceAccountProvider": "Manual",
  "Chain": "Ethereum",
  "Token": "USDC",
  "SourceAmount": 2.000196,
  "DestinationAmount": 1.883279,
  "DestinationAddress": "0x1234567890123456789012345678901234567890",
  "TxHash": "0xe921…81f56",
  "TransferSteps": [
    { "StepOrder": 1, "Chain": "Polygon",  "Token": "USDC", "Amount": 2.000196, "DestinationAddress": "0xbridge000000000000000000000000000000000001", "TxHash": "0x246b…3c56" },
    { "StepOrder": 2, "Chain": "Ethereum", "Token": "USDC", "Amount": 1.883279, "DestinationAddress": "0x1234567890123456789012345678901234567890", "TxHash": "0xe921…81f56" }
  ],
  "Timestamp": 1791319954,
  "SentTimestamp": 1791319963,
  "EventId": "3c10dd8c-0931-4a86-e3e8-08df23ebc4a8",
  "Id": "fa309c29-eff7-431f-9666-6bd16078cdeb"
}
```

**Reconciling with the list API.** When you look the transfer up with `GET /api/v1/transfers/managed/mesh`, match on `id` (= `TransferId`) or `clientTransactionId` (= your `transactionId`) and read `status`, `sourceAmount`, `destinationAmount`, and `bridgingDetails.sourceSide` / `bridgingDetails.targetSide` for the per-leg hashes, amounts and explorer links. The top-level `hash` on that endpoint is the **pay-in** (origin-network) hash, not the payout hash.

**Timing.** EVM → EVM bridges typically fill within a few minutes of the pay-in confirming, and the `Succeeded` webhook follows one to three minutes after the fill. BTC legs depend on Bitcoin confirmations and can take considerably longer; a transfer that stays `pending` past the quote ETA is not an error.

## Step 4 — Notify Mesh of a native deposit

If the user picks an asset/network you **already support natively**, there is no bridge and Mesh is not in the payment path: the user sends funds to the deposit address your platform shows them, and you detect and credit the deposit exactly as you do today. You can still give Mesh a record of it. **Once you have seen the transaction on chain**, call [`POST /api/v1/bridging/notify`](https://docs.meshconnect.com/api-reference/headless-bridging/notify-native-deposit) with its hash. Mesh records the deposit, verifies the transaction independently, and sends the same transfer webhooks a bridged deposit produces, giving you one record and one reconciliation stream for every deposit, native or bridged. Requires **write** access.

> [accordion] Parameter reference
>
> `X-Client-Id` requiredYour Mesh Client ID. Requires **write** access.
>
> `X-Client-Secret` requiredYour Mesh API Key.
>
> `userId` requiredYour unique, persistent identifier for the user (max 384 characters). Do not use PII such as an email or phone number.
>
> `transactionId` requiredYour unique id for this deposit (max 128 characters). Use a fresh `transactionId` for every on-chain transaction.
>
> `destination.network` requiredCAIP-2 chain id the deposit landed on. See **Supported networks and assets** below.
>
> `destination.asset` requiredToken symbol of the deposit: the network's native coin or any token Mesh lists on that network.
>
> `destination.address` required**Your** deposit address that received the funds.
>
> `transactionHash` requiredHash of the on-chain transaction that delivered the deposit.
>
> `amount` optionalDecimal string in `destination.asset` units. Informational: the on-chain credit is authoritative and is what the `Succeeded` webhook carries, so a differing value is logged for reconciliation but does not fail the deposit.

```bash theme={null}
# Replace YOUR_CLIENT_ID and YOUR_API_KEY with your Mesh credentials.
# Replace userId and transactionId with your own identifiers.
# destination is your own deposit address that received the funds;
# transactionHash is the on-chain transaction you detected.
curl --request POST \
  --url https://integration-api.meshconnect.com/api/v1/bridging/notify \
  --header 'Content-Type: application/json' \
  --header 'X-Client-Id: YOUR_CLIENT_ID' \
  --header 'X-Client-Secret: YOUR_API_KEY' \
  --data '
{
  "userId": "UNIQUE_USER_ID",
  "transactionId": "UNIQUE_TRANSACTION_ID",
  "destination": {
    "network": "eip155:1",
    "asset": "USDC",
    "address": "0x1234567890123456789012345678901234567890"
  },
  "transactionHash": "0xe921…81f56",
  "amount": "125.5"
}
'
```

**Supported networks and assets.** Notify accepts deposits on EVM chains, Solana, Tron, Bitcoin and the XRP Ledger. `destination.asset` is the network's native coin or any token Mesh lists on that network (`400 symbolNotSupported` otherwise); there is no per-route configuration for native deposits. `destination.address` and `transactionHash` are checked against the chain's format before anything is recorded:

| Chain family | `destination.network` (CAIP-2) | `destination.address` | `transactionHash` |
| - | - | - | - |
| EVM (Ethereum, Polygon, BNB Smart Chain, Base, …) | `eip155:1`, `eip155:137`, `eip155:56`, `eip155:8453` | `0x` + 40 hex | 32-byte hex; `0x` optional, case-insensitive (returned with a lower-case `0x` prefix) |
| Solana | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | base58 (32–44 chars) | base58 signature (86–88 chars) |
| Tron | `tron:0x2b6653dc` | base58, starts with `T` (34 chars) | 64 hex; `0x` optional |
| Bitcoin | `bip122:000000000019d6689c085ae165831e93` | `1…`, `3…` or `bc1…` | 64 hex txid |
| XRP Ledger | `xrpl:0` | classic `r…` address, one address per user; destination tags are not supported | 64 hex |

A network outside these families, or an address or hash that does not match the chain's format, returns `400 badRequest` (the `message` says which field).

Mesh creates the transfer as `pending` and verifies the transaction on chain: that it is confirmed and credited `destination.address` in `destination.asset`. As with `/address`, status is not returned in the `200` response; track it via webhooks or the list API (see [Track the bridge](#track-the-bridge)).

```json theme={null}
{
  "status": "ok",
  "content": {
    "tracking": {
      "userId": "UNIQUE_USER_ID",
      "transactionId": "UNIQUE_TRANSACTION_ID",
      "transferId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    },
    "destination": {
      "network": "eip155:1",
      "asset": "USDC",
      "address": "0x1234567890123456789012345678901234567890"
    },
    "transactionHash": "0xe921…81f56",
    "amount": "125.5",
    "expirationTime": 1791600388,
    "warnings": [
      "The transfer is pending until Mesh verifies the transaction on chain; wait for the succeeded webhook before reconciling.",
      "Report each on-chain transaction once, with its own transactionId.",
      "If the transaction cannot be verified by expirationTime, the transfer is marked failed and a failed webhook is sent."
    ]
  }
}
```

Once verified (usually within minutes, since you only call after your own detection), the transfer moves to `succeeded` and the `Succeeded` webhook fires with `TxHash` set to your hash and `DestinationAmount` set to the on-chain amount. If Mesh cannot verify the transaction by `expirationTime` (48 hours after the call), the transfer is marked `failed` and a `Failed` webhook is sent, so a bad report is visible on both sides. No `Pending` webhook is sent.

Reporting a `transactionHash` Mesh is already tracking under a different `transactionId` returns `409` naming the existing transfer; nothing new is created:

```json theme={null}
{
  "status": "conflict",
  "message": "The provided TransactionHash is already tracked by transfer 3fa85f64-5717-4562-b3fc-2c963f66afa6 (transactionId: EARLIER_TRANSACTION_ID, status: Succeeded).",
  "errorType": "transferAlreadyRequested"
}
```

> [!NOTE]
>
> **Behavior to know**
>
> * **One call per on-chain transaction, after you detect it.** The transaction hash is the deposit's identity. A user who deposits several times to the same saved address produces several transactions; report each one with its own `transactionId`. Do not call when the address is displayed, since nothing has happened yet.
> * **Retries are safe.** `transactionId` is single-use per `userId`: re-sending the same `transactionId` with the same destination and hash returns the original record (same `transferId`) in any state. The same `transactionId` with a different destination or hash, or one already used for a bridged `/address`, returns `400 badRequest` (the `message` says why).
> * **Verification is Mesh's, not yours.** The transfer only reaches `succeeded` once Mesh has confirmed the transaction on chain. Reconcile on `TransactionId` / `TxHash` from the webhook, not on the `200` from this call.
> * **Webhook payload is the same** as for other Mesh transfers: `TransferId`, `TransactionId`, `UserId`, `Chain`, `Token`, `DestinationAmount`, `DestinationAddress`, `TxHash`. There is no `TransferSteps` array and `isBridgingTransfer` is `false`, since no bridge occurred.
> * **Other errors:** `400 badRequest` for an unknown or unsupported network, an address or hash that does not match the chain's format, or an `amount` that is not a positive decimal; `400 symbolNotSupported` when Mesh does not know `destination.asset` on that network; `403 permissionDenied` when headless bridging is not enabled for your client.

## What's next

Explore related guides:

* [Headless bridging API reference](https://docs.meshconnect.com/api-reference/headless-bridging/get-deposit-routes.md) — full request and response schemas for [`POST /api/v1/bridging/routes/deposit`](https://docs.meshconnect.com/api-reference/headless-bridging/get-deposit-routes), [`POST /api/v1/bridging/routes/withdrawal`](https://docs.meshconnect.com/api-reference/headless-bridging/get-withdrawal-routes), [`POST /api/v1/bridging/quote`](https://docs.meshconnect.com/api-reference/headless-bridging/get-quote), [`POST /api/v1/bridging/address`](https://docs.meshconnect.com/api-reference/headless-bridging/create-bridged-address) and [`POST /api/v1/bridging/notify`](https://docs.meshconnect.com/api-reference/headless-bridging/notify-native-deposit), with a live request playground.
* [Add Mesh to your withdrawal flow](https://docs.meshconnect.com/extend/withdrawal.md) — the withdrawal-flow guide, which includes a section on using headless bridging to expand withdrawal destinations.
* [Transfer status webhooks](https://docs.meshconnect.com/resources/webhooks.md) — register for and consume transfer status webhooks to track your bridges.

***

> [accordion] AI coding reference (llms.txt)
>
> *AI coding reference — a compact summary of this page's APIs, parameters, and patterns for use by AI coding assistants (following the [llms.txt standard](https://llmstxt.org/)). Human readers can safely ignore this.*
>
> **llms.txt — Headless bridging**
>
> Headless bridging = Mesh's cross-chain bridging as a pure API (no Mesh UI/SDK/iframe). Three steps, the middle one optional, plus an optional report for native deposits: (1) route discovery returns every bridged route Mesh can offer into (deposit) or out of (withdrawal) the pairs you send — it does not know your native pairs, so filter overlaps client-side; (2) quote returns the estimated receive amount for a given pay-in amount on a pair (stateless, indicative); (3) address generation returns a single-use deposit address programmed to bridge a pay-in pair into a user-selected destination pair + address; (4) notify reports a deposit you already received natively (with its tx hash) so Mesh verifies it on chain and emits the same webhooks. All endpoints under `/api/v1/bridging`, JSON camelCase, auth via `X-Client-Id` + `X-Client-Secret` headers on every request. Gated per-client — must be enabled by Mesh. Bridging executes on mainnet (no testnet simulation).
>
> **Route discovery — withdrawal**: `POST /api/v1/bridging/routes/withdrawal`. Body: `sources` (required, non-empty array of `{ network (CAIP-2), asset (symbol) }` you can send from) | `optimized` (optional, default true — withdrawal returns at most one source per distinct destination, deposit at most one destination per distinct source; false = every matching origin→destination pair. With a single settlement source, true still returns every destination). Response: `content.routes[]` of `{ origin, destination, displayName }`.
>
> **Route discovery — deposit**: `POST /api/v1/bridging/routes/deposit`. Same as withdrawal but send `destinations` (pairs you can receive) instead of `sources`. Response identical shape.
>
> **Quote (optional)**: `POST /api/v1/bridging/quote` (read access). Body: `origin` `{ network, asset }` | `destination` `{ network, asset, address }` | `amount` (decimal, in the origin asset, greater than zero and at most 1,000,000,000). Response: `content.origin.amount` | `content.destination.estimatedAmount` (net of included fees, indicative) | `content.destination.minimumAmount` (worst-case receive amount in the destination asset at Mesh's slippage tolerance — "minimum received"; nullable; applies to this quote only, the later `/address` bridge is priced on the actual pay-in; distinct from `constraints.minimumAmount`, the smallest accepted pay-in in the origin asset) | `content.fees.items[]` `{ kind, label, amount, asset, amountUsd, includedInEstimate }` (`includedInEstimate: true` lines are already subtracted from `estimatedAmount`: `providerRelayerService` + `providerRelayerGas` = `totalUsd`; `providerAggregate` is their rollup, do not add it; `includedInEstimate: false` = `originGas`, the pay-in transaction's gas in the origin network's gas token, paid by whichever wallet sends the pay-in — the platform on a withdrawal, the user on a deposit; `integrator`/`subsidized` usually 0; fee amounts are in origin-side units, never the destination asset — use `amountUsd` to compare) | `content.fees.totalUsd` | `content.rate` (destination units per 1 origin unit after fees = `estimatedAmount / amount`; not a market price; amount-dependent; informational) | `content.constraints` `{ minimumAmount, maximumAmount }` (origin-asset pay-in range; same limits as `/address` but freshly converted per call — enforce the `/address` values) | `content.quotedAt` (unix secs) | `content.warnings[]`. Stateless — nothing minted or stored; call on every amount change. Errors: `badRequest` (unknown network / no route), `amountBelowMinimum` (below `constraints.minimumAmount` or the provider minimum), `amountExceedsMaximum` (above `constraints.maximumAmount` or the provider's available liquidity), `invalidDestinationAddress` (`400`, address not valid for the destination network — do not retry), `serverFailureRetryable` (`503`, route cannot be priced right now — retry with backoff; on `/address` nothing is minted and the `transactionId` is not consumed), `permissionDenied`; schema violations return `invalidField` / `missingField`.
>
> **Create bridged address**: `POST /api/v1/bridging/address` (requires write access). Body: `userId` (required, max 384 chars, no PII) | `transactionId` (required, max 128 chars) | `origin` `{ network, asset }` (pay-in leg) | `destination` `{ network, asset, address }` (payout leg; `address` is the user's wallet on a withdrawal, your platform's receive address on a deposit). `transactionId` is single-use per `userId` (scoped to your client and environment): while the transfer is pending the same `origin`/`destination`/`address` returns the same address and `expirationTime`, a changed field returns `400 badRequest` naming the field; after `succeeded`/`failed` the same `transactionId` returns `409` — use a new one per pay-in.
>
> **Create bridged address — response**: `content.tracking.transferId` (Mesh UUID, for status + webhooks) | `content.selectedRoute.bridgingAddress.address` (send `origin` asset on `origin` network here only) | `content.constraints` `{ minimumAmount, maximumAmount (nullable), expirationTime (unix secs, always set = created + 6h, never extended), singleUseAddress }` | `content.warnings[]`. Min/max are limits Mesh sets for the route, converted to the origin asset at the current price (move slightly between calls; provider limits apply on top), rounded to the asset's decimals and echoed in `warnings` as `Minimum transfer amount: {n} {ASSET}.` / `Maximum transfer amount: {n} {ASSET}.`; Mesh cannot reject a live pay-in, so enforce them client-side. Unfunded at `expirationTime` → `failed`.
>
> **Notify native deposit**: `POST /api/v1/bridging/notify` (requires write access). Call AFTER you detect the deposit on chain, once per on-chain transaction. Body: `userId` (required, max 384 chars) | `transactionId` (required, max 128 chars, fresh per transaction) | `destination` `{ network (CAIP-2), asset (symbol), address (your deposit address that received the funds) }` | `transactionHash` (required, the on-chain tx hash) | `amount` (optional decimal string in the destination asset; informational — the on-chain credit is authoritative and a differing value is logged, not rejected). Networks: EVM, Solana, Tron, Bitcoin, XRP Ledger (XRPL: one classic address per user, no destination tags); address and hash format checked per chain (`400 badRequest` otherwise); asset = native coin or any token Mesh lists on the network (`400 symbolNotSupported` otherwise). Response: `content.tracking` `{ userId, transactionId, transferId }` | `content.destination` | `content.transactionHash` | `content.amount` | `content.expirationTime` (unix secs, call + 48h) | `content.warnings[]`. No status in the response. Lifecycle: created `pending` → Mesh verifies the hash on chain (confirmed, credited `destination.address` in `destination.asset`) → `succeeded` + `Succeeded` webhook (`TxHash` = your hash, `DestinationAmount` = on-chain amount, no `TransferSteps`, `isBridgingTransfer: false`); not verifiable by `expirationTime` → `failed` + `Failed` webhook; no `Pending` webhook. Idempotent per `userId` + `transactionId`: same destination + hash → 200 with the original record (any state); different destination/hash, or `transactionId` already used for `/address` → 400 `badRequest`. Same hash under another `transactionId` → 409 `transferAlreadyRequested` (message names the existing transfer). 403 `permissionDenied` if headless bridging is not enabled.
>
> **Flow**: call route discovery with your native pairs → show native + bridged options → user picks. Native pair = handled by your platform directly, Mesh not in the payment path; skip the bridging APIs for the payment, then call notify with the tx hash once you detect the deposit so Mesh tracks it. Discovery does not know your native pairs, so filter overlapping routes client-side. Bridged pair = optionally call quote with the user's amount and show `estimatedAmount`, then call create-address, send pay-in to `bridgingAddress.address`, Mesh bridges to destination.
>
> **Critical**: addresses are single-use — new `transactionId` per pay-in, never reuse. Bridging is mainnet-only; test with small real amounts. Track via `transferId` + Transfer Status webhooks: headless emits `Succeeded` and `Failed` only (no `Pending`); `Failed` at `expirationTime` if unfunded or on provider rejection; a later `Succeeded` can follow a `Failed` for a pay-in that settled after expiry, so deduplicate on `EventId` and apply the event with the greater payload `Timestamp` per `TransferId` (not arrival order). In the `Succeeded` payload the `StepOrder` 1 step = pay-in leg, `StepOrder` 2 = payout leg (select by `StepOrder`, not array position); top-level `Chain`/`Token`/`DestinationAmount`/`TxHash` describe the payout leg. Or poll `GET /api/v1/transfers/managed/mesh` with `Id` = `tracking.transferId` or `ClientTransactionId` = your `transactionId` (listed immediately as `pending`; read `status`, `sourceAmount`, `destinationAmount`, `bridgingDetails.sourceSide/targetSide` for per-leg hashes — top-level `hash` is the pay-in hash; status can lag the on-chain fill by minutes; BTC can stay pending past the quote ETA without erroring).
>
> **Route discovery (withdrawal) — request body**:
>
> ```bash theme={null}
> # Replace YOUR_CLIENT_ID, YOUR_API_KEY and the sources entries.
> curl --request POST \
>   --url https://integration-api.meshconnect.com/api/v1/bridging/routes/withdrawal \
>   --header 'Content-Type: application/json' \
>   --header 'X-Client-Id: YOUR_CLIENT_ID' \
>   --header 'X-Client-Secret: YOUR_API_KEY' \
>   --data '
> {
>   "sources": [
>     { "network": "eip155:137", "asset": "USDC" }
>   ],
>   "optimized": true
> }
> '
> ```
>
> **Create bridged address — request body**:
>
> ```bash theme={null}
> # Replace the credentials, userId, transactionId, origin and destination.
> curl --request POST \
>   --url https://integration-api.meshconnect.com/api/v1/bridging/address \
>   --header 'Content-Type: application/json' \
>   --header 'X-Client-Id: YOUR_CLIENT_ID' \
>   --header 'X-Client-Secret: YOUR_API_KEY' \
>   --data '
> {
>   "userId": "UNIQUE_USER_ID",
>   "transactionId": "UNIQUE_TRANSACTION_ID",
>   "origin": { "network": "eip155:137", "asset": "USDC" },
>   "destination": {
>     "network": "eip155:1",
>     "asset": "USDC",
>     "address": "0x1234567890123456789012345678901234567890"
>   }
> }
> '
> ```
>
> **Notify native deposit — request body**:
>
> ```bash theme={null}
> # Replace the credentials, userId, transactionId, destination and transactionHash.
> curl --request POST \
>   --url https://integration-api.meshconnect.com/api/v1/bridging/notify \
>   --header 'Content-Type: application/json' \
>   --header 'X-Client-Id: YOUR_CLIENT_ID' \
>   --header 'X-Client-Secret: YOUR_API_KEY' \
>   --data '
> {
>   "userId": "UNIQUE_USER_ID",
>   "transactionId": "UNIQUE_TRANSACTION_ID",
>   "destination": {
>     "network": "eip155:1",
>     "asset": "USDC",
>     "address": "0x1234567890123456789012345678901234567890"
>   },
>   "transactionHash": "0xe921…81f56",
>   "amount": "125.5"
> }
> '
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.