Authentication
API keys
Create, limit, disable and revoke the keys that call the API.
Create a key in the dashboard at /settings/keys: press New key, give it a name, pick an expiry, and optionally set a spend limit.
The key starts with sk-pg-v1- and is shown only once. Copy it then.
No API creates keys; see Management keys.
Use a key
Send it as Authorization: Bearer sk-pg-v1-..., or as X-Api-Key.
sh
curl https://api.plaingateway.com/api/v1/auth/key \ -H "Authorization: Bearer $PLAINGATEWAY_API_KEY"
Current key explains the answer.
Options
| Option | Values | Effect |
|---|---|---|
| Expiry | never, 1 hour, 1 day, 7, 30, 90 or 180 days, 1 year | An expired key gets 401. |
| Spend limit | USD, or none | A key that reached its limit gets 402 until the period resets. |
| Limit reset | never, day, week, month | Periods start at 00:00 UTC; a week starts on Monday. |
A spend limit belongs to one key. The account balance is shared by all keys.
Disable, revoke, delete
- Disable stops a key until you enable it again.
- Revoke stops a key for good. Revoke any key that may have leaked.
- Delete removes a key from the list.
Changes reach the gateway within about 10 seconds. Keep keys on a server. A key in a browser or a public repository can be copied and spent.