Skip to main content

API Keys API

Manage API keys for programmatic access to PortaAIM.

note

Creating and revoking a key require an admin login (email/password → JWT Authorization: Bearer token), never an X-API-Key — a key that could create another key would defeat key expiration. Listing keys also accepts an admin-role key, because the list withholds every key value. See Authentication.

Create API Key​

POST /api/v1/api-keys

Request:

{
"name": "Production Backend"
}

Response:

{
"id": "3f9c2a6e-8b1d-4c7a-9e2f-5a0b1c2d3e4f",
"api_key": "sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"name": "Production Backend",
"key_prefix": "sk_live_xxxxxxxx",
"roles": ["charging"],
"expires_at": null,
"status": "active"
}
caution

The full api_key value is only returned at creation time. Store it securely immediately.

List API Keys​

GET /api/v1/api-keys

Returns all keys for the current tenant and environment. The full key is not shown — only its leading characters, which include the environment marker (sk_live_ or sk_test_).

Response:

{
"api_keys": [
{
"id": "3f9c2a6e-8b1d-4c7a-9e2f-5a0b1c2d3e4f",
"name": "Production Backend",
"key_prefix": "sk_live_xxxxxxxx",
"roles": ["charging"],
"expires_at": null,
"created_at": "2026-03-23T10:00:00Z",
"status": "active"
}
]
}

Revoke API Key​

DELETE /api/v1/api-keys/{key_id}

Soft-deletes the key. It immediately stops accepting requests.