# Authentication

## API Authentication
:::tip[]
API keys for production are issued per merchant and can be obtained in the Merchant panel under **Integration** menu.
:::

- Send either header `x-api-key: <api-key>` **or** `Authorization: Bearer <api-key>`.
- Production API keys are issued per merchant and can be obtained in the Merchant panel under **Integration**.
- Sandbox uses a shared API key provided by SX Digital Pay for testing.
- Keep keys secret, rotate them periodically, and remove old keys immediately when rotating.

Sandbox notes:
- `GET /payment-links` is blocked in sandbox and returns `403`.
- Payments are disabled in sandbox; use the Sandbox panel on the quote page to simulate events.

### Sandbox API Key
Use the shared sandbox key below in the `x-api-key` header for testing:

```
sxk_sandbox_088da8714156b49f767664fc9bebbcb047841b660b8fda7b
```

### Example (Production)
```http
GET /payment-links?page=1&pageSize=20
x-api-key: sk_live_xxxxxxxxx
```

### Example (Sandbox)
```http
POST /payment-links
Content-Type: application/json
x-api-key: sk_sandbox_xxxxxxxxx

{
  "title": "Test Order #123",
  "amount": 129.90,
  "webhookUrl": "https://merchant.com/webhooks/sxpay"
}
```
