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

# x402 CLI

> Reference for the x402 CLI tool: usage and prerequisites for testing x402-gated API endpoints.

# x402 CLI

A command-line tool for testing x402-gated API endpoints.

[GitHub Repository](https://github.com/Swader/x402-cli)

## Prerequisites

Ensure you have funds on the chain you are targeting. Create a `.env` file in
the directory where you run the CLI, containing the `KEY` environment variable
set to a wallet private key with sufficient balance. Alternatively, set `KEY`
as an environment variable in your shell.

## Usage

```bash theme={null}
bunx @swader/x402-cli <URL>
```

Example:

```bash theme={null}
bunx @swader/x402-cli https://fs9cqhm1.nx.link/random_joke
```
