# Pridge API for agents

Pridge is a private crypto bridge: send one coin, receive another. No account, no API key, no KYC, no logs.
The API is open to anyone: build your own app or UI on top of it.

- REST base URL: `https://pridge.tech/api/v1`
- MCP server (Streamable HTTP): `https://pridge.tech/mcp`
- OpenAPI spec: `https://pridge.tech/openapi.json`

## Flow

1. **List coins**: `GET /coins`
2. **Quote**: `GET /quote?from=btc_mainnet&to=xmr_mainnet&amount=0.01&mode=fixed`
3. **Confirm with the user**: show amount in, amount out, mode and the receiving address.
4. **Create**: `POST /bridges`
5. **Deposit**: the user (or a wallet the user controls) sends `send.amount` to `send.address`.
6. **Track**: `GET /bridges/{id}` until a final status.

## Rules

- Coin ids come from list_coins / GET /coins. The same ticker can exist on several networks (usdt_trx, usdt_eth, usdt_sol); pick the one matching the user's wallet.
- Amounts are decimal strings ("0.01"), max 9 decimals.
- Modes: fixed (rate locked, exact payout, default), floating (market rate, payout can move a little), ghost (going ghost: send a supported coin, receive XMR; output must be xmr_mainnet; +2.2% fee; always floating; coins with ghost=true can be sent).
- Always show the user the quote and the receiving address and get an explicit OK before creating a bridge.
- Each create call makes a new bridge with a new deposit address. Don't retry a create blindly: if a call timed out, ask the user before trying again, and only ever send to the latest bridge's address.
- Send exactly send.amount, on send.network, to send.address, before deposit_window_minutes run out. Sending a different coin or network loses funds.
- Add a refund_address when you can: if the swap fails, coins go back there.
- Poll get_bridge every ~30s. Final statuses: done, expired, failed, refunded, needs_support. For expired-after-sending, failed or needs_support, the user should email support@pridge.tech with the bridge id.
- Keep the bridge id and tracking_url; the user can follow it on https://pridge.tech.

## Endpoints

### GET /coins

```json
{ "data": [ { "id": "btc_mainnet", "ticker": "BTC", "name": "Bitcoin", "network": "BTC", "deposit_window_minutes": 60, "ghost": true } ] }
```

### GET /quote

Query: `from`, `to`, `amount`, `mode` (optional, default `fixed`).

```json
{ "from": "btc_mainnet", "to": "xmr_mainnet", "mode": "fixed", "amount_in": "0.01", "amount_out": "1.26767385", "rate": "126.76739" }
```

### POST /bridges

Body (JSON):

| Field | Required | Notes |
| --- | --- | --- |
| `from` | yes | Coin id to send |
| `to` | yes | Coin id to receive |
| `amount` | yes | Decimal string, amount to send |
| `mode` | no | `fixed` (default), `floating`, `ghost` |
| `address` | yes | Receiving address for the `to` coin |
| `refund_address` | no | Address for the `from` coin, used if the swap fails |

Returns `201` with a bridge:

```json
{
  "id": "e7e54525-b618-43d4-9c1e-4f1b2a3c4d5e",
  "status": "waiting_for_deposit",
  "rate_type": "fixed",
  "send": { "coin": "btc_mainnet", "ticker": "BTC", "network": "BTC", "amount": "0.01", "address": "<deposit address>", "payment_uri": "bitcoin:...", "tx_url": null },
  "receive": { "coin": "xmr_mainnet", "ticker": "XMR", "network": "Monero", "amount": "1.26767385", "address": "<your address>", "tx_url": null },
  "refund_address": null,
  "deposit_window_minutes": 60,
  "tracking_url": "https://pridge.tech/#t=e7e54525-b618-43d4-9c1e-4f1b2a3c4d5e"
}
```

### GET /bridges/{id}

Returns the same bridge object with the latest `status`:
`waiting_for_deposit` → `confirming` → `sending` → `done`, or `expired`, `failed`, `refunded`, `needs_support`.

## Errors

```json
{ "error": { "code": "invalid_request", "message": "Value of the transaction is too small. Minimum swap amount: 0.00012898 BTC", "field": "amount", "min_amount": "0.00012898" } }
```

Codes: `invalid_request` (400), `not_found` (404), `rate_limited` (429, see `retry-after`), `unavailable` (503, retry later).

## Limits

Per IP, per minute: 120 reads, 60 quotes, 10 bridge creations. Counters live in memory for a minute and are never stored.

## MCP

Add to your MCP client:

```json
{
  "mcpServers": {
    "pridge": {
      "url": "https://pridge.tech/mcp"
    }
  }
}
```

Tools: `list_coins`, `get_quote`, `create_bridge`, `get_bridge`. Same inputs and outputs as the REST API.

## Support

support@pridge.tech, with the bridge id.
