Authentication and keys
Every request is authenticated with an API key in the Authorization header.
curl https://api.klinkpay.net/v1/balance \
-H "Authorization: Bearer kp_test_…"
Keys are created in the dashboard under Developers → API keys. A key is shown once when it is created; store it in your server's secret store and never put it in a browser or mobile app.
Kinds of keys
| Prefix | Kind | Mode | Can do |
|---|---|---|---|
kp_test_… |
Secret | Test | Everything, against the sandbox |
kp_live_… |
Secret | Live | Everything, real money |
rk_test_… |
Restricted | Test | Only its permissions |
rk_live_… |
Restricted | Live | Only its permissions |
The mode of the key decides the mode of everything it creates and sees: a test key only sees test payments, refunds, events and payouts (livemode: false), a live key only live ones.
Restricted keys
Give a service only what it needs, e.g. a reporting job that may read payments and payouts but never create a refund. A restricted key that calls an endpoint outside its permissions gets 403 forbidden.
| Permission | Allows |
|---|---|
payments:read |
List and retrieve payments |
payments:write |
Create and cancel payments |
refunds:read |
List and retrieve refunds |
refunds:write |
Create refunds |
payment_links:read |
List and retrieve payment links |
payment_links:write |
Create and deactivate payment links |
events:read |
List and retrieve events |
balance:read |
Retrieve the balance |
payouts:read |
List and retrieve payouts |
webhook_endpoints:read |
List webhook endpoints |
webhook_endpoints:write |
Create and delete webhook endpoints |
Live keys and account status
- Test keys work from sign-up, whatever the account status.
- Live keys only work once your account is
active(reviewed and approved). Otherwise every live request returns403with codeaccount_not_active. - A
restrictedaccount can still read with live keys but cannot create new payments. - A
suspendedaccount gets403for everything.
Keeping keys safe
- Revoke a key in the dashboard the moment you think it leaked; it stops working at once.
- Use one key per server or service, with a label, so you can revoke one without touching the others.
- The dashboard shows when each key was last used.
[!NOTE] An invalid, missing or revoked key returns
401 unauthorized. See Errors.