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

# API Tokens

> Generate personal access tokens and configure webhook URLs and signing secrets

# API Tokens

Merchant API tokens let you access your PayRequest business account through third-party apps, AI assistants, or your own integrations, without sharing your password.

## Create a Token

1. Go to **Settings** 1 **API Tokens** in your PayRequest dashboard.
2. Click **Create New Token**.
3. Enter a descriptive token name (e.g., "MCP Billing Agent").
4. Choose the required scopes; by default, only the `billing.read` scope is selected.
5. Click **Create**.
6. Copy the generated token immediately. You will not see it again.

## Available Scopes

| Scope | Description |
| - | - |
| billing.read | Read invoices and subscription data |
| billing.write | Create or update billing objects and invoices |
| billing.agent | Full billing access with AI integration |
| customers.read | View customer records |
| customers.write | Create or update customers |
| products.read | View products |
| products.write | Create or update products |

The `billing.agent` scope includes all `billing.read` and `billing.write` capabilities.

## Use Tokens Securely

* Store tokens confidentially; never commit them to version control or share publicly.
* Tokens authenticate API requests via the `Authorization: Bearer <token>` HTTP header.
* Tokens inherit your merchant account permissions and respect your business's subscription plan.

## Webhook Settings

You can configure a single webhook URL to receive real-time notifications about payments and security deposits.

### Configure Webhook

1. Enter your HTTPS endpoint URL at **Settings 1 API Tokens** under the Webhooks section.
2. Save to generate a **Signing Secret**.
3. Use this secret to verify webhook requests from PayRequest.

### Webhook Security

* Every webhook request includes an `X-PayRequest-Signature` header.
* The signature is an HMAC-SHA256 of the raw request body using your webhook secret.
* Always verify the signature before processing webhook events.

## Authorization Checks and Access

Merchant API tokens require your business to have an active Premium or Business subscription to be authorized.

Tokens issued to suspended or unpaid accounts are rejected.

Team members using linked account sessions or team sessions do not have API token or webhook access.

If your account does not have the required paid entitlement, you will get a 403 Forbidden response.

## Example: Using an API Token

```bash theme={null}
curl -H "Authorization: Bearer YOUR_TOKEN" https://payrequest.app/api/v1/invoices
```

## Troubleshooting

* **401 Unauthorized:** Token missing, invalid, or expired.
* **403 Forbidden:** Token lacks required scope or account lacks paid entitlements.
* **Webhook Signature Invalid:** Webhook secret mismatch or altered payload.

## FAQ

> [accordion] Can I restrict API access by my subscription plan?
>
> Yes. Only merchants with active Premium or Business plans can create and use API tokens.

> [accordion] Can team members use my API tokens?
>
> No. API tokens and webhook access are disabled for team-member sessions and linked account sessions.

> [accordion] What if I lose my token?
>
> Revoke the old token and create a new one. Tokens are shown only once at creation.

> [accordion] How do I verify webhook signatures?
>
> Use the `X-PayRequest-Signature` header with the webhook secret to verify an HMAC-SHA256 hash of the raw request body. See our [Webhook Development](https://docs.payreque.st/advanced-features/webhook-development.md) guide.

## Related Guides

> [card] [Webhook Configuration](https://docs.payreque.st/organization-and-automation/webhook-configuration.md)
>
> Set up your webhook and verify event signatures.

> [card] [API Overview](https://docs.payreque.st/api/overview.md)
>
> Learn about the PayRequest REST API and endpoints.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.