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

# Add a paywall

> Price a route under a service. Agents hit the URL, pay the 402, and get your API response.

A **paywall** is where the money happens. It protects one route: price in USDC, methods, path — Proceeds generates the public payment URL.

## Before you start

* An existing [service](https://docs.myproceeds.xyz/quickstart/create-a-service.md)
* For the API path: an API key with `paywalls:write`

## Using the dashboard

**1. Open the service**

On **Paywalls**, expand the service and click **New Paywall**.

**2. Fill in the form**

| Field | Example |
| - | - |
| Name | `Current weather` |
| Slug | `current-weather` (or click **Generate**) |
| Allowed HTTP methods | `GET` |
| Path | Upstream path under the service base URL |
| Query parameters / custom headers | Optional |
| Price | Amount in USDC |

**3. Save & Activate**

Copy the payment URL:

```text theme={null}
https://myproceeds.xyz/api/pay/{serviceId}/{slug}
```

> [!TIP]
>
> Use clear slugs and descriptions — they show up in transactions, events, and [agent guidance](https://docs.myproceeds.xyz/guides/api-discovery.md).

## Using the API

> [!NOTE]
>
> In the API, `price` is USDC in **smallest units** (6 decimals) as a string. `"50000"` = `$0.05`. That field is Exact pricing. Set **Tiered** prices in the dashboard.

```bash cURL theme={null}
curl -X POST https://api.myproceeds.xyz/v1/paywalls \
  -H "Authorization: Bearer mpk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "serviceId": "YOUR_SERVICE_ID",
    "slug": "current-weather",
    "name": "Current weather",
    "description": "Latest conditions for a location",
    "targetUrl": "https://api.example.com/v1/weather/current",
    "price": "50000",
    "currency": "USDC",
    "allowedMethods": ["GET"],
    "networks": ["base-sepolia", "tempo-testnet"],
    "enabled": true
  }'
```

```javascript JavaScript theme={null}
const response = await fetch("https://api.myproceeds.xyz/v1/paywalls", {
  method: "POST",
  headers: {
    Authorization: "Bearer mpk_your_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    serviceId: "YOUR_SERVICE_ID",
    slug: "current-weather",
    name: "Current weather",
    description: "Latest conditions for a location",
    targetUrl: "https://api.example.com/v1/weather/current",
    price: "50000", // $0.05 USDC
    currency: "USDC",
    allowedMethods: ["GET"],
    networks: ["base-sepolia", "tempo-testnet"],
    enabled: true,
  }),
});

const { data: paywall } = await response.json();
```

Full reference: [Create a paywall (API)](https://docs.myproceeds.xyz/api-reference/paywalls/create-a-paywall.md).

## Verify the challenge

```bash theme={null}
curl -i https://myproceeds.xyz/api/pay/{serviceId}/current-weather
```

You should get `402 Payment Required`. x402 v2 puts terms in the `PAYMENT-REQUIRED` header. Older tutorials use `X-PAYMENT` — that is v1.

## Next

> [card] [Test paywalls](https://docs.myproceeds.xyz/quickstart/test-paywalls.md)
>
> Run Test Payment in the console. First 200, no mainnet USDC.


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