/dapi/v1 and signs the payments that leave your own integrator account. It never
signs for a client: a client’s holder approves their own payouts in the
sign-in window.
Create it in the app
Keys are created in the HEVN app —https://sandbox.gethevn.com, or
https://app.gethevn.com in production — under Settings → Partner
program → Developer. Nothing in this API creates one. The key opens a session that reaches every
client linked to you, and it authorizes money from your own wallet, so creating it takes a browser session of your own,
never a token this API minted.
Creation asks for one thing, the IP allowlist: the source addresses the key may be used from, 1
to 64 IPv4 addresses, IPv6 addresses or CIDR networks. It is frozen the moment the key exists. There
is no edit and no PATCH; a new egress range means a new key.
The browser generates the keypair and shows you the private half once. Save it then: HEVN never
holds it and cannot show it again. Write it to a file with mode 0600 on the machine that will use
it, out of images, repositories and logs.
The app adds the public half to your own account’s signer in the same action, so there is nothing
else to wire up. One key covers every client linked to you, because what it does for a client is
authenticate your backend, not sign. An account can hold up to five keys at once, which is what
makes a rotation possible without downtime.
What the key is
What a session from the key may do
Every/dapi/v1 route is open to a session from any of your keys. What the key may sign is
narrower, and it is fixed by whose wallet it is:
A confirm that would have your key sign for a client’s wallet answers
403 account_not_controlled.
Nothing is prepared and nothing is signed.
The IP allowlist
The allowlist is the set of source addresses the key may be used from. HEVN canonicalises every entry and drops duplicates, so203.0.113.10 is stored as 203.0.113.10/32.
Every request re-checks it. A call from an address outside the list is 403, and so is a call whose
source address HEVN cannot determine — on a read as on a payment.
Your edge must strip caller-supplied X-Forwarded-For, X-Real-IP and CF-Connecting-IP before
they reach HEVN, or the allowlist is checking a header the caller controls.
Load it in your server
Every example on these pages reads the key fromHEVN_KEY_PEM — the file you saved when the app
showed you the private half.
POST /dapi/v1/auth/challenge is the proof the key is live and the allowlist covers this
host. See Sessions.
When a key is refused
Login answers the same refusal for every key problem — an unknown email, a key that no longer exists, a call from an address outside the allowlist, a signer that is not attached, a bad signature — so an attacker learns nothing from probing:
Once you are authenticated the refusals are specific, because by then HEVN knows who you are:
The full list is in Errors.
Rotate a key
Keys are immutable and additive, so a rotation is a roll rather than an edit, and both keys work while both are live.1
Create the second key
In the app, with an allowlist covering the hosts that will use it. Save the private half. Nothing changes for running code.
2
Switch your servers
Deploy the new key file. Payments start carrying the new
publicKey. An approval is bound to your
signer rather than to one key, so anything prepared just before the switch can still be confirmed
with either key while both are live.3
Delete the old key
In the app. The old key stops logging in and stops authorizing money on the next request that
uses it.
Habits worth keeping
- Keep the private key in a secret manager and mount it at runtime; keep it out of images, repositories and logs.
- One key per environment, and one per deployment if you can — the
publicKeyon each payment tells you which one signed. - Give each key the narrowest allowlist its job allows, and create the replacement before you move traffic to a new range.
- Never sign in a browser. The key can spend your own balance and act on every client linked to you; a browser is the wrong place for it. The browser’s part is the sign-in window, which needs no key at all.
- Rehearse the roll before you need it. A rotation you have never run is not a control.
Next: Sessions
Two calls to log in, and one header to act as any of your clients.