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

# x402

> Use the Rye API from a crypto wallet over x402 — no API key, pay per request in USDC.

## What is x402?

[x402](https://github.com/coinbase/x402) is an open protocol for paying for HTTP requests inline with a signed stablecoin transfer. Rye exposes an x402-native endpoint at `https://x402.rye.com` that accepts purchases from any x402-compatible client — instead of authenticating with a Rye API key, the caller pays for each request with a signed USDC transfer.

It is built for AI agents and other automated clients that hold a crypto wallet but do not have a Rye developer account. It is a thin wrapper around Rye's standard [Checkout Intent](/api-v2/checkout-intent-lifecycle) flow — the same offer retrieval, order placement, and refund logic — exposed over the x402 wire format.

If you already have a Rye API key, you do not need this endpoint. Use the standard [Universal Checkout API](/api-v2/introduction) — x402 is also available there as a payment method on `/v1/checkout-intents/:id/confirm`.

## When to use it

Use x402 if **all** of the following are true:

* Your client signs HTTP requests from a crypto wallet (Base, Solana, or Tempo)
* You do not have, or do not want to manage, a Rye API key
* You are integrating with [AgentCash](https://agentcash.dev) or another x402-native runtime

## Base URL

| Environment | Base URL               |
| ----------- | ---------------------- |
| Production  | `https://x402.rye.com` |

## Endpoints

| Method | Path                           | Fee (USDC)              | Description                                                         |
| ------ | ------------------------------ | ----------------------- | ------------------------------------------------------------------- |
| `POST` | `/v1/checkout-intents`         | \$0.02                  | Create an intent and start offer retrieval                          |
| `GET`  | `/v1/checkout-intents?id=…`    | Free                    | Read intent state and the retrieved offer                           |
| `POST` | `/v1/checkout-intents/confirm` | Purchase total + \$0.03 | Confirm the intent and place the order (intent id goes in the body) |

The exact amount due is quoted in the `PAYMENT-REQUIRED` header on each `402` response. `GET` is free so polling does not accrue cost.

## Flow at a glance

```mermaid theme={null}
sequenceDiagram
    autonumber
    participant Agent
    participant Proxy as x402.rye.com
    participant Rye as Rye Checkout API

    Agent->>Proxy: POST /v1/checkout-intents
    Proxy-->>Agent: 402 Payment Required (PAYMENT-REQUIRED)
    Note over Agent: Sign $0.02 EIP-3009 authorization (offline)
    Agent->>Proxy: POST /v1/checkout-intents (PAYMENT-SIGNATURE)
    Note over Proxy: Broadcast transferWithAuthorization on Base
    Proxy->>Rye: forward request
    Proxy-->>Agent: 201 { state: "retrieving_offer" } + X-PAYMENT-RESPONSE

    loop until awaiting_confirmation
        Agent->>Proxy: GET /v1/checkout-intents?id=…
        Proxy-->>Agent: 200 { state, offer? }
    end

    Agent->>Proxy: POST /v1/checkout-intents/confirm { id, paymentMethod }
    Proxy-->>Agent: 402 Payment Required (purchase + $0.03)
    Note over Agent: Sign EIP-3009 authorization (offline)
    Agent->>Proxy: POST /confirm (PAYMENT-SIGNATURE)
    Note over Proxy: Broadcast transferWithAuthorization on Base
    Proxy-->>Agent: 200 { state: "placing_order" } + X-PAYMENT-RESPONSE

    loop until completed or failed
        Agent->>Proxy: GET /v1/checkout-intents?id=…
        Proxy-->>Agent: 200 { state, orderId? }
    end
```

## Supported networks

| Network | Chain ID (CAIP-2)                         |
| ------- | ----------------------------------------- |
| Base    | `eip155:8453`                             |
| Solana  | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` |
| Tempo   | `eip155:4217`                             |

USDC is the only accepted token on every supported network.

## Wallet identity

There is no `Authorization` header and no `X-Wallet-Address` header on paid calls. The wallet is whatever resolves from `authorization.from` inside the signed `PAYMENT-SIGNATURE` payload. A signed request *is* the authentication — payment and identity are the same.

## Discovery

The endpoint publishes an OpenAPI 3.1.0 document with `x-payment-info` annotations on each paid operation, so AgentCash and other x402 clients can discover prices and schemas without prior knowledge of the API:

```bash theme={null}
curl https://x402.rye.com/openapi.json
```

## Next steps

<CardGroup cols={2}>
  <Card title="Quickstart with AgentCash" href="/api-v2/x402/quickstart">
    Walkthrough using the AgentCash SDK
  </Card>

  <Card title="Endpoint Reference" href="/api-v2/x402/reference">
    Request and response shapes for each call
  </Card>
</CardGroup>
