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

# enact pay

> Make a payment-aware HTTP request.

```bash theme={null}
enact pay <url> [options]
```

Makes an HTTP request that automatically handles `402 Payment Required` responses. If the server requests payment, Enact pays using your agent session credentials and retries.

## Options

| Flag                    | Description                       |
| ----------------------- | --------------------------------- |
| `--method <METHOD>`     | HTTP method (default: `GET`)      |
| `--body <JSON>`         | Request body                      |
| `--header 'Key: Value'` | Add a request header (repeatable) |
| `--dry-run`             | Preview cost without paying       |

## Examples

```bash theme={null}
# Basic GET
enact pay https://api.example.com/resource

# POST with body
enact pay https://api.example.com/analyze \
  --method POST \
  --body '{"text": "hello world"}'

# Preview cost before paying
enact pay --dry-run https://api.example.com/resource

# Custom headers
enact pay https://api.example.com/resource \
  --header 'X-Request-ID: abc123'
```

## Dry run output

```bash theme={null}
enact pay --dry-run https://api.example.com/resource

  Dry Run: GET https://api.example.com/resource

  Payment required
  Cost:      $0.01
  Remaining: $95.50
```

<Warning>
  If `Remaining` is lower than `Cost`, the request will fail. Top up your wallet or create a new session with a higher budget.
</Warning>

## Agent mode

```bash theme={null}
enact -t pay https://api.example.com/resource
```

```json theme={null}
{
  "status": 200,
  "receipt": true,
  "body": { ... }
}
```

Dry run in agent mode:

```bash theme={null}
enact -t pay --dry-run https://api.example.com/resource
```

```json theme={null}
{
  "requiresPayment": true,
  "cost": { "amount": "0.01", "currency": "AlphaUSD" },
  "remainingBudget": "95.50",
  "wouldExceedBudget": false
}
```
