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

# Authentication

> API key authentication

All API endpoints (except signup and Stripe webhooks) require authentication via API key.

## Using Your API Key

Pass the key in the `Authorization` header:

```
Authorization: Bearer pdg_your_api_key_here
```

## Managing API Keys

### Generate a New Key

```bash theme={null}
curl -X POST https://api.pedge.xyz/v1/auth/keys \
  -H "Authorization: Bearer pdg_existing_key" \
  -H "Content-Type: application/json" \
  -d '{"name": "my-bot"}'
```

### List Your Keys

```bash theme={null}
curl https://api.pedge.xyz/v1/auth/keys \
  -H "Authorization: Bearer pdg_your_key"
```

### Revoke a Key

```bash theme={null}
curl -X DELETE https://api.pedge.xyz/v1/auth/keys/KEY_ID \
  -H "Authorization: Bearer pdg_your_key"
```

## Error Responses

| Status | Meaning                    |
| ------ | -------------------------- |
| `401`  | Missing or invalid API key |
| `402`  | Insufficient credits       |

The `402` response includes `credits_required` and `credits_remaining` so you know exactly how much you need.
