---
title: "codespar paywalls"
description: "Gate paywalls: create one in front of an API or MCP server, read it, change it, remove it, read its stats"
---

Gate paywalls: create one in front of an API or MCP server, read it, change it, remove it, read its stats

6 commands in `@codespar/cli 0.20.0`.

Each one prints what its operation answered. [What a command prints](/docs/cli/reference#what-a-command-prints) has the rule, and [Configuration](/docs/cli/config#what-a-script-gets-when-a-command-fails) has the exit codes and the shape of a failure.

### `codespar paywalls list`

List paywalls

```bash
codespar paywalls list
```

| option | what it does |
|---|---|
| `-q, --query <key=value>` | Query parameter (repeatable) (default: []) |
| `--timeout <ms>` | Per-request timeout in milliseconds |

`GET /v1/paywalls` · [parameters, responses and refusals](/docs/api/reference/paywalls#get-v1paywalls)

### `codespar paywalls create`

Create a paywall

```bash
codespar paywalls create --input-file body.json
```

```json title="body.json"
{
  "slug": "example",
  "name": "Example",
  "upstream_url": "https://example.com/hook",
  "price": "string",
  "currency": "BRL",
  "consumer_id": "csm_0000000000000000",
  "description": "string",
  "category": "string",
  "methods": [
    "string"
  ],
  "pricing_model": "string",
  "pricing_tiers": [
    {
      "up_to": 0,
      "price_atomic": "string"
    }
  ],
  "dynamic_price_url": "https://example.com/hook",
  "metered_config": {
    "basis": "string",
    "base_atomic": "string",
    "min_mult": 1,
    "max_mult": 1,
    "units_header": "string"
  },
  "payto": {
    "kind": "byo",
    "address": "string"
  }
}
```

| option | what it does |
|---|---|
| `-q, --query <key=value>` | Query parameter (repeatable) (default: []) |
| `--timeout <ms>` | Per-request timeout in milliseconds |
| `-i, --input <json>` | Request body as a JSON string |
| `-f, --input-file <path>` | Request body from a JSON file |

`POST /v1/paywalls` · [parameters, responses and refusals](/docs/api/reference/paywalls#post-v1paywalls)

### `codespar paywalls get`

Read one paywall

```bash
codespar paywalls get obj_0000000000000000
```

| argument | what it is |
|---|---|
| `<id>` | String. |

| option | what it does |
|---|---|
| `-q, --query <key=value>` | Query parameter (repeatable) (default: []) |
| `--timeout <ms>` | Per-request timeout in milliseconds |

`GET /v1/paywalls/{id}` · [parameters, responses and refusals](/docs/api/reference/paywalls#get-v1paywallsid)

### `codespar paywalls delete`

Delete a paywall

```bash
codespar paywalls delete obj_0000000000000000
```

| argument | what it is |
|---|---|
| `<id>` | String. |

| option | what it does |
|---|---|
| `-q, --query <key=value>` | Query parameter (repeatable) (default: []) |
| `--timeout <ms>` | Per-request timeout in milliseconds |

`DELETE /v1/paywalls/{id}` · [parameters, responses and refusals](/docs/api/reference/paywalls#delete-v1paywallsid)

### `codespar paywalls update`

Update a paywall

```bash
codespar paywalls update obj_0000000000000000 --input '{"name":"Example","upstream_url":"https://example.com/hook","price":"string","active":true}'
```

| argument | what it is |
|---|---|
| `<id>` | String. |

| option | what it does |
|---|---|
| `-q, --query <key=value>` | Query parameter (repeatable) (default: []) |
| `--timeout <ms>` | Per-request timeout in milliseconds |
| `-i, --input <json>` | Request body as a JSON string |
| `-f, --input-file <path>` | Request body from a JSON file |

`PATCH /v1/paywalls/{id}` · [parameters, responses and refusals](/docs/api/reference/paywalls#patch-v1paywallsid)

### `codespar paywalls stats`

Earnings for one paywall

```bash
codespar paywalls stats obj_0000000000000000
```

| argument | what it is |
|---|---|
| `<id>` | String. |

| option | what it does |
|---|---|
| `-q, --query <key=value>` | Query parameter (repeatable) (default: []) |
| `--timeout <ms>` | Per-request timeout in milliseconds |

`GET /v1/paywalls/{id}/stats` · [parameters, responses and refusals](/docs/api/reference/paywalls#get-v1paywallsidstats)
