# Connect

Connect a Paddle account with an API key, from the dashboard or with the connect API.

## Create an API key

1. In Paddle, open **Developer tools > Authentication** and create an API key.
2. Give it the **Notification settings** (write), **Transactions** (read) and **Customers** (read) permissions.
3. Copy the key. It starts with `pdl_live_apikey_`, or `pdl_sdbx_apikey_` for a sandbox key.

## Connect from the dashboard

1. Sign in to [Zernio](https://zernio.com/dashboard/connections) and open **Connections**.
2. Click **Connect an account**, pick the profile, and choose **Paddle** under **Analytics**.
3. Paste the API key and click **Connect**. Sales from then on count.

## Connect with the API

```bash
curl -X POST "https://zernio.com/api/v1/connect/paddle/credentials" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "profileId": "PROFILE_ID", "apiKey": "pdl_live_apikey_01gtgztp8f4kek3yd4g1wrksa3_q6TGTJyvoIz7LDtXT65bX7_AYV" }'
```

```json
{ "accountId": "6507a1b2c3d4e5f6a7b8c9d1", "platformUserId": "…", "accountName": "…" }
```

Zernio checks the key, then adds a notification destination (**Developer tools > Notifications**) for `transaction.completed`, `adjustment.created` and `adjustment.updated`, pointed at Zernio.

## Disconnect

On **Connections**, click **Disconnect** on the Paddle account, or call `DELETE /v1/accounts/{accountId}`. Zernio removes the webhook it added. Sales already stored stay in `GET /v1/events`; sales made while disconnected are not backfilled.

## How it behaves

- A profile holds one Paddle connection. A sandbox key connects the sandbox account, whose sales count like live ones; use a separate profile for testing.
- Paddle names no seller account for a key, so connecting the same profile again with another key replaces the connection and its notification destination.
- Zernio keeps the key and the destination's signing secret encrypted. Every delivery is checked against that secret.

## If it fails

| Error | Cause | Fix |
|---|---|---|
| `401 invalid_credentials` | Paddle refused the key, or it lacks a permission | Create a key with the three permissions above. |
| `400` on `apiKey` | The key is a legacy key without the `pdl_` prefix | Create a new API key in Paddle. |
| `502 platform_api_error` | Paddle did not answer, or did not accept the notification destination | Try again in a minute. |

## Related

- [Connect a Paddle account](/connect/connect-paddle-credentials)
- [Sales](/platforms/paddle/sales)