> For the complete documentation index, see [llms.txt](https://docs.braidpay.com/braidpay/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.braidpay.com/braidpay/security-and-privacy-settings/api-keys.md).

# API Keys

### Creating an API Key

1. Navigate to **Settings → API Keys** in your BraidPay Dashboard.
2. Click **Create API Key**.
3. Choose:
   * **Label**: A human-readable name (e.g. *My Storefront*).
   * **Scope**:
     * `checkout`: create checkout sessions and payment links.
     * `read_only`: view transactions, invoices, balances.
     * `full`: full API access.
   * **Environment**: `test` or `live`.
4. Copy the generated key — you will only see it once.

### Using API Keys

Include your key in the `Authorization` header:

```
POST https://api.braidpay.com/v1/checkout-sessions
Authorization: Bearer sk_test_xxx123
Content-Type: application/json

```

### Rotating & Revoking

* **Rotate**: Creates a new key while the old one remains valid for a short grace period.
* **Revoke**: Immediately disables a key.

## 🚀 Developer Quickstart

### Step 1: Create a Checkout Session

```
curl -X POST https://api.braidpay.com/v1/checkout-sessions \
  -H "Authorization: Bearer sk_test_xxx123" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 5000,
    "currency": "usd",
    "successUrl": "https://merchant.com/success",
    "cancelUrl": "https://merchant.com/cancel"
  }'

```

Response:

```
{
  "id": "cs_test_123",
  "checkoutUrl": "https://checkout.braidpay.com/cs_test_123"
}

```

### Step 2: Redirect Customer

Your webhook will receive events such as `payment.succeeded`:

```
{
  "event": "payment.succeeded",
  "data": {
    "id": "cs_test_123",
    "amount": 5000,
    "currency": "usd",
    "status": "succeeded"
  }
}

```

Verify the signature (see **Webhooks** doc).
