Every request carries an API key in the Authorization header, as a bearer token. A key in the address, the query or the body is refused.
Kinds of key
Make keys in the Dashboard, in Developers › API keys. Each key belongs to one business and one mode, fixed when it's made.
| Key | Starts with | What it can do |
|---|---|---|
| Secret | sov_sk_live_, sov_sk_test_ | Every operation of the API. Keep it on your servers, never in a browser or an app. |
| Restricted | sov_rk_live_, sov_rk_test_ | Only the access you give it, resource by resource. The safest key for each service you run. |
| Publishable | sov_pk_live_, sov_pk_test_ | Safe in a browser, but it calls no operation yet. |
Anyone who holds it can take payments, refund them and read your balance. For a service that needs only part of that, use a restricted key.
Restricted keys
A restricted key has a level for each resource: None, Read or Write. Write includes read. A request for anything it wasn't given is refused, and the answer names the resource and the level it needs.
| Resource | Covers |
|---|---|
| Payments | Payments: read, capture, cancel and receipts. |
| Checkout sessions | Sessions: create, read and expire. |
| Refunds | Refunds. |
| Disputes | Disputes and early fraud warnings, evidence and closing. |
| Customers | Customers and their saved cards. |
| Invoices | Invoices. |
| Subscriptions | Subscriptions. |
| Products and prices | Products, prices, coupons, promotion codes, shipping rates and tax rates. |
| Usage | Telemetries, telemetry events and usage alerts; reading credit grants. |
| Payment links | Payment links. |
| Balance | The balance and balance transactions. Read only. |
| Payouts | Payouts and bank accounts. Read only. |
| Events | Events, for the resources the key can read. Read only. |
| Webhook endpoints | Reading endpoints. Read only. |
A few operations need a secret key, whatever a restricted key holds: charging a saved card, and recording an invoice payment, which marks money as received that Sovgate didn't see.
Limit where a key works
Give a secret or restricted key up to 50 Allowed IP addresses or ranges: a request from anywhere else is refused, even with the right key. A key can also expire on its own, in 30 days, 90 days or a year.
Roll a key
Rolling makes a new key like the old one. Roll on a schedule, and the old key keeps working for the time you choose, so your code can move. Roll because it may have been exposed, and the old key stops at once. A secret is shown once, when it's made: if you lose it, roll the key.
When a key is refused
| Status | Code | Why |
|---|---|---|
| 401 | api_key_expired | The key has expired. A missing, unknown or wrong key is refused with 401 too. |
| 403 | ip_not_allowed | The request came from an address not on the key's list. |
| 403 | secret_key_required | A publishable key was used. |
| 403 | permission_missing | A restricted key lacks the access this request needs. |
Repeated failed attempts from one address are slowed down.