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

# CrossChain Bridging

> Bridge USDC across chains using Circle CCTP

## CrossChain Bridging (CCTP)

Aegis uses **Circle's CrossChain Transfer Protocol (CCTP)** to bridge USDC. Agents on the Arc Network can move funds to Base Sepolia, Ethereum Sepolia, Arbitrum Sepolia, and others.

Bridge transfers are **asynchronous**. The API returns a `202 Accepted` response with an `auditId`. Poll it to check completion.

`POST /v1/actions/bridge` initiates the transfer.
`GET /v1/actions/status/:auditId` polls for completion.
`POST /v1/actions/bridge/fee` and `/v1/actions/estimate/bridge` estimate route costs before execution.

## How It Works

<Steps>
  <Step title="Check supported chains">
    Query the available chain identifiers for routing:

    ```bash theme={null}
    curl -X GET https://api.aegisintent.xyz/v1/actions/bridge/chains \
      -H "Authorization: Bearer YOUR_TOKEN" \
      -H "X-Aegis-Email: agent@example.com"
    ```
  </Step>

  <Step title="Get a fee estimate">
    Check the bridging fee for a specific route. `fromChain` is required:

    ```bash theme={null}
    curl -X POST https://api.aegisintent.xyz/v1/actions/bridge/fee \
      -H "Authorization: Bearer YOUR_TOKEN" \
      -H "X-Aegis-Email: agent@example.com" \
      -H "Content-Type: application/json" \
      -d '{"fromChain": "ARC-TESTNET", "toChain": "BASE-SEPOLIA"}'
    ```
  </Step>

  <Step title="Execute the bridge">
    Submit the bridge transaction. Include idempotency headers.
    The response returns immediately with a `202 Accepted` status and an `auditId`:

    ```bash theme={null}
    curl -X POST https://api.aegisintent.xyz/v1/actions/bridge \
      -H "Authorization: Bearer YOUR_TOKEN" \
      -H "X-Aegis-Email: agent@example.com" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
      -H "X-Aegis-Nonce: 0" \
      -d '{
        "fromChain": "ARC-TESTNET",
        "toChain": "BASE-SEPOLIA",
        "amount": "50.00"
      }'
    ```

    **Response (202 Accepted):**

    ```json theme={null}
    {
      "success": true,
      "result": {
        "state": "pending",
        "message": "Bridge transfer is processing in the background. Poll GET /v1/actions/status/<auditId> to check progress.",
        "auditId": "abc-123-def-456"
      }
    }
    ```
  </Step>

  <Step title="Poll for completion">
    Use the `auditId` from the bridge response to check progress:

    ```bash theme={null}
    curl -X GET https://api.aegisintent.xyz/v1/actions/status/abc-123-def-456 \
      -H "Authorization: Bearer YOUR_TOKEN" \
      -H "X-Aegis-Email: agent@example.com"
    ```

    **While processing:**

    ```json theme={null}
    { "success": true, "action": "CCTP_BRIDGE_USDC", "status": "PROCESSING", "txHash": null }
    ```

    **When complete:**

    ```json theme={null}
    { "success": true, "action": "CCTP_BRIDGE_USDC", "status": "SUCCESS", "txHash": "0xabc..." }
    ```
  </Step>

  <Step title="Get deep bridge status (optional)">
    Once you have the `txHash`, query the full onchain bridge lifecycle:

    ```bash theme={null}
    curl -X POST https://api.aegisintent.xyz/v1/actions/bridge/status \
      -H "Authorization: Bearer YOUR_TOKEN" \
      -H "X-Aegis-Email: agent@example.com" \
      -H "Content-Type: application/json" \
      -d '{"txHash": "0xabc..."}'
    ```
  </Step>
</Steps>

<Warning>
  Bridges take **2–5 minutes** due to blockchain confirmations. The async pattern prevents the agent from blocking. Poll the status endpoint every 15–30 seconds until `status` is `SUCCESS` or `FAILED`.
</Warning>

## Bridge Parameters

| Field       | Type   | Required | Description                                                           |
| ----------- | ------ | -------- | --------------------------------------------------------------------- |
| `toChain`   | string | Yes      | Destination chain identifier (e.g. `"BASE-SEPOLIA"`, `"ETH-SEPOLIA"`) |
| `amount`    | string | Yes      | Amount of USDC to bridge                                              |
| `fromChain` | string | Yes      | Source chain identifier                                               |
| `recipient` | string | No       | Destination address (defaults to agent's own wallet)                  |

## Related Endpoints

| Endpoint                      | Method | Description                                  |
| ----------------------------- | ------ | -------------------------------------------- |
| `/v1/actions/bridge/chains`   | GET    | List supported routing chains                |
| `/v1/actions/bridge/fee`      | POST   | Get fee estimate for a bridge route          |
| `/v1/actions/bridge`          | POST   | Execute a bridge transfer (returns 202)      |
| `/v1/actions/status/:auditId` | GET    | Poll async action status (bridge, etc.)      |
| `/v1/actions/bridge/status`   | POST   | Deep onchain bridge status (requires txHash) |
| `/v1/actions/estimate/bridge` | POST   | Dry-run bridge cost estimation               |
