API Keys
Each API key is a publishable and secret pair. This page covers formats, allowed origins and the key lifecycle.
Every key is a pair: a publishable key and a secret key. Both credit calls to your company and apply your fee. They differ only in where they're safe to use.
| Publishable | Secret | |
|---|---|---|
| Format | hk_pk_live_ + 64 hex characters | hk_sk_live_ + 64 hex characters |
| Use it in | Browser code | Your servers only. Keep it in a secrets manager. |
| Origin check | The request's Origin must exactly match one on the key's list | None |
| Effect | Attribution and your fee | Attribution and your fee |
Every key is live. There's no test mode or sandbox key, so use a separate key per environment.
Create a key
Owners, Admins and Developers can create keys from API Keys or the Dashboard. Creating or changing a key needs a recent sign-in.
- Choose New API key and give it a name of up to 50 characters, such as
Production backendorWeb app. - The API key created screen shows both full keys. It closes only when you choose Done.
- Put the secret key in your secrets manager.
Use one key per app or environment. Analytics breaks volume down by key, so that's how you tell them apart later.
Copy a key again
- Publishable key: anyone on the team can copy it from the key list.
- Secret key: Owners, Admins and Developers can copy it again after a recent sign-in.
Turn off, rename or revoke
- Turn off with the Active switch. Requests that send it then fail with
401 Invalid API key(see Errors and Limits). Switch it back on any time. - Rename from the key list. The new name shows in Analytics and in new CSV exports.
- Revoke permanently disables both halves of the pair, and the key leaves the list. Its past volume stays in Analytics and CSV exports under its old name. Stuck funds of transfer addresses the key created through
/partner/transfer-addresscan only be listed and recovered with that key, so don't revoke it while they still have any. See Partner Transfer Address.
Revoking can't be undone. Apps still sending the key start getting 401 within a minute.
Limits
- 10 keys per company. Keys that are turned off still count. Revoked keys don't.
- 10 allowed origins per key.
Allowed origins
A publishable key only works from the origins on its list. New keys start with an empty list, so a publishable key returns 403 until you add one. Secret keys ignore the list.
Add origins on the API Keys page, one at a time. Each one is reduced to scheme, host and port:
| You enter | Saved as |
|---|---|
app.example.com | https://app.example.com |
https://app.example.com/checkout | https://app.example.com |
http://localhost:3000 | http://localhost:3000. Plain HTTP works for localhost, 127.0.0.1 and [::1] only. |
http://app.example.com | Rejected. Use HTTPS. |
https://*.example.com | Rejected. Wildcards aren't supported. |
The match is exact. https://example.com, https://www.example.com and https://app.example.com:8443 are three different origins, and so are http://localhost:3000 and http://localhost:5173. Add each one you serve from, including staging and preview domains.
Server-side calls usually send no Origin header, so a publishable key fails there with 403. Use the secret key on servers.
When changes reach the API
The API caches each key for up to 60 seconds. Turning a key off or on, revoking it, editing its origins, changing your fee and a change to your Hinkal fee can take that long to apply.
Partner key
The Partner key is separate from your API keys. Once Hinkal approves a discount for your company, it gives your Hinkal fee in Hinkal Pay to whoever enters it.
| API keys | Partner key | |
|---|---|---|
| Format | hk_pk_live_… / hk_sk_live_… | hk_partner_ + 64 hex characters |
| Used in | The x-api-key header on Hinkal API calls | Hinkal Pay, entered by a person |
| Effect | Attribution, your fee and your Hinkal fee | Your Hinkal fee in Pay only |
| How many | Up to 10 | One per company |
Don't send the Partner key in x-api-key. The API rejects it with 401 Invalid API key.
Find it on the Dashboard, at the bottom of the Fees card. Until your company has a Pay discount, the card says the key has no discount yet.
Request a discount: new companies start without a Pay discount. An Owner or Admin chooses Request discount under the Partner key in the Fees card, and the card shows the request as pending until Hinkal reviews it. Once approved, the key works in Pay at your Hinkal fee. If the request is declined, you can request again. Until then, Pay rejects the key with This key has no Pay discount yet.
Use it in Hinkal Pay:
- Open Hinkal Pay and select the Hinkal logo in the top left.
- Choose Partner Key.
- Paste the key and choose Apply.
Pay remembers the key in that browser until it's removed or replaced. Every Pay transaction from that browser then uses your Hinkal fee, whichever wallet is connected.
Pay transactions made with the Partner key don't add your fee, don't earn commission and don't show in your volume. See Fees and Revenue Share.
Keep it private. Anyone who has the key gets your rate in Pay, and it isn't limited to certain websites. You can't revoke or replace it from the portal. If it leaks, contact Hinkal to issue a new one. The old key stops working, and anyone using it in Pay goes back to the standard fee once they reload Pay. A change to your Hinkal fee keeps the same key and shows in Pay after a reload.