Authentication & keys

Every request is authenticated with an API key in the Authorization header.

curl https://sandbox-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

PrefixKindModeCan do
kp_test_…SecretTestEverything, against the sandbox
kp_live_…SecretLiveEverything, real money
rk_test_…RestrictedTestOnly its permissions
rk_live_…RestrictedLiveOnly 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.

PermissionAllows
payments:readList and retrieve payments
payments:writeCreate and cancel payments
refunds:readList and retrieve refunds
refunds:writeCreate refunds
payment_links:readList and retrieve payment links
payment_links:writeCreate and deactivate payment links
events:readList and retrieve events
balance:readRetrieve the balance
payouts:readList and retrieve payouts
webhook_endpoints:readList webhook endpoints
webhook_endpoints:writeCreate 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 returns 403 with code account_not_active.
  • A restricted account can still read with live keys but cannot create new payments.
  • A suspended account gets 403 for 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.
An invalid, missing or revoked key returns 401 unauthorized. See Errors.