Skip to main content
POST
/
api-keys
Create API key
curl --request POST \
  --url http://localhost:5001/api-keys \
  --header 'X-blnk-key: <api-key>'
Use blnk.ApiKeys.create to create a scoped API key.
blnk.ApiKeys.create
const response = await blnk.ApiKeys.create({
  name: 'Service Account',
  owner: 'merchant_a',
  scopes: ['ledgers:read', 'balances:write'],
  expires_at: '2026-12-31T23:59:59Z',
});
FieldDescription
nameDescriptive name for the key or service account.
ownerOwner identifier you assign, such as a team, service, or user ID.
scopesList of permissions in resource:action format (for example ledgers:read).
expires_atExpiration timestamp (ISO 8601, for example 2026-12-31T23:59:59Z).

Response shape

201 Created
{
  "api_key_id": "api_key_879f0ecb-e29f-4137-801b-1048366381db",
  "key": "YVLIhuIplUzLRCcT9r7DQ_jsGKCXAn39JQ3n_o-Ll2Q=",
  "name": "Service Account",
  "owner_id": "owner_id",
  "scopes": ["ledgers:read", "balances:write"],
  "expires_at": "2026-03-11T00:00:00Z",
  "created_at": "2025-11-18T13:39:50.390457762Z",
  "last_used_at": "0001-01-01T00:00:00Z",
  "is_revoked": false
}
FieldDescription
api_key_idUnique ID for the key. Use it to revoke the key.
keyPlaintext secret. Store it now — it is only returned at creation.
scopesPermissions granted to the key.
expires_atDate and time the key expires.
is_revokedWhether the key has been revoked.

How API keys work

Scopes, the master key, and the auth model.

Create API key

HTTP request and response schema.

Need help?

We are very happy to help you make the most of Blnk, regardless of whether it is your first time or you are switching from another tool. To ask questions or discuss issues, please contact us or join our Discord community.