POST /dapi/v1/auth/challenge and POST /dapi/v1/auth/token.
Before you start
- Sign up at
https://sandbox.gethevn.com. - Open Settings → Partner program → Developer and create a developer key. Set its IP allowlist to your machine’s egress address.
- Save the private key to
$HEVN_KEY_PEMwith mode0600. - Ask HEVN to enable client creation for your sandbox account.
- Create a wallet on Base Sepolia whose key you hold. It stands in for your customer’s wallet. Export its address as
HEVN_WALLET. - Set the environment and install the dependencies.
Developer keys, clients and tokens are per environment.
The examples read these variables:
The sandbox runs on Base Sepolia with testnet tokens. A payout, escrow or payin is capped at
1, and a faucet credit at 5 to a wallet holding less than 1. The sandbox money routes take 60 calls per account per hour. See Sandbox limits.Steps
1
Log in
Run the login code in Sessions. Export
accessToken as HEVN_ACCESS_TOKEN. The Python, Node and Go tabs use the reference client.2
Create the client
Call Export the id as
POST /dapi/v1/clients with the company’s legal name and email. Do not send X-Hevn-Account.Response 202
HEVN_CLIENT_ID. A retry with the same Idempotency-Key returns the same client. Fields: Create a client.3
Register the address
Call While HEVN reviews the client request, the call returns
POST /dapi/v1/client/accounts with the client id in X-Hevn-Account.Response 201
404 account_not_found. Repeat it with the same body. Rules and refusals are in External accounts.4
Wait for the client
Poll The statuses are in Statuses.
GET /dapi/v1/client every two seconds until status is ready.Response
5
Verify the client
Write the KYB document with In production HEVN reviews the application (Track the application).
PUT /dapi/v1/client/kyb as in Write the document. When it returns ready: true, call POST /dapi/v1/client/kyb/complete, then approve the application with POST /dapi/v1/sandbox/kyb/status.6
Request a virtual account
Call While
POST /dapi/v1/banks with a product and the accountId, then poll GET /dapi/v1/banks/{product} with the same accountId until status is active.Response
status is preparing, read blockers[] (What still blocks it). A product that cannot deliver to the address returns 409 account_destination_unsupported.7
Emulate a bank payin
Call On
POST /dapi/v1/sandbox/deposits with the bankId. Do not send accountId or token.Response: 200
202, repeat the request with the same Idempotency-Key. The testnet USDC is sent to $HEVN_WALLET.8
Read the ledger and balance
Call
GET /dapi/v1/transactions with accountId, then GET /dapi/v1/client/accounts/{accountId}.balance is refreshed when the stored value is older than a minute. GET /dapi/v1/client/balance has no row for the account.