---
title: "codespar payment-links"
description: "Payment links: the shareable URL an agent pays over x402/USDC and a person pays via Pix; list, create, read, change, remove, payments, stats"
---

Payment links: the shareable URL an agent pays over x402/USDC and a person pays via Pix; list, create, read, change, remove, payments, stats

7 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 payment-links list`

List the payment links in this project

```bash
codespar payment-links list
```

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

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

### `codespar payment-links create`

Create a multi-rail payment link

```bash
codespar payment-links create --input-file body.json
```

```json title="body.json"
{
  "slug": "example",
  "title": "Example",
  "description": "string",
  "accepts": [
    {
      "rail": "x402",
      "amount": "1000",
      "currency": "USDC",
      "pay_to": {
        "kind": "byo",
        "address": "string",
        "consumer_id": "csm_0000000000000000"
      }
    }
  ],
  "one_time": true,
  "max_uses": 1,
  "expires_at": "2026-01-15T12:00:00.000Z",
  "redirect_url": "https://example.com/hook",
  "metadata": {}
}
```

| 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/payment-links` · [parameters, responses and refusals](/docs/api/reference/payment-links#post-v1payment-links)

### `codespar payment-links stats`

Collect totals for this project's payment links

```bash
codespar payment-links stats
```

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

`GET /v1/payment-links/stats` · [parameters, responses and refusals](/docs/api/reference/payment-links#get-v1payment-linksstats)

### `codespar payment-links payments`

The payments one payment link received

```bash
codespar payment-links payments 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/payment-links/{id}/payments` · [parameters, responses and refusals](/docs/api/reference/payment-links#get-v1payment-linksidpayments)

### `codespar payment-links get`

Read one payment link

```bash
codespar payment-links 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/payment-links/{id}` · [parameters, responses and refusals](/docs/api/reference/payment-links#get-v1payment-linksid)

### `codespar payment-links delete`

Delete a payment link

```bash
codespar payment-links 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/payment-links/{id}` · [parameters, responses and refusals](/docs/api/reference/payment-links#delete-v1payment-linksid)

### `codespar payment-links update`

Update a payment link's title, copy, expiry, redirect or active flag

```bash
codespar payment-links update obj_0000000000000000 --input '{"title":"Example","description":"string","active":true,"expires_at":"2026-01-15T12:00:00.000Z","redirect_url":"https://example.com/hook"}'
```

| 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/payment-links/{id}` · [parameters, responses and refusals](/docs/api/reference/payment-links#patch-v1payment-linksid)
