Access keys

An access key is a long-lived credential — an AKIA… id and a secret — that belongs to a user or to a service account. A program signs each request with it (Huudis-HMAC-SHA256); a user's key then acts as that user on the management API, within the user's IAM policies. How signing works, which routes take a key and which never do: API authentication.

This page covers creating, listing, revoking and deleting keys.

The secret is returned exactly once, on create. Huudis stores it encrypted and never shows it again. If you lose it, revoke the key and create a new one.

Endpoints

Method Path Purpose
POST /api/v1/iam/access-keys Create a key for yourself or a service account
GET /api/v1/iam/access-keys?principalType=&principalId= List one principal's keys
POST /api/v1/iam/access-keys/:id/revoke Disable a key (the row stays, for the audit trail)
DELETE /api/v1/iam/access-keys/:id Delete a key

You manage keys for yourself and for your workspace's service accounts — never for another person, since the key would act as them. Creating, revoking and deleting keys takes a signed-in person: an access key is refused (PERSON_ONLY). A key may list keys when its user's policies allow huudis:ListAccessKeys.

Create an access key

POST /api/v1/iam/access-keys
Field Type Required Description
principalType user | service_account yes Who the key authenticates as.
principalId string yes Your own usr_…, or a svc_… in the active workspace.
label string (max 120) no A hint such as Production CI.
expiresAt ISO 8601 datetime no When the key stops working. Omit for a key that does not expire.

Response — 201 Created

{
  "data": {
    "id": "akid_01KPG30…",
    "accessKeyId": "AKIA0123456789ABCDEF012345",
    "secret": "q3Vb…one-time…=",
    "principalType": "user",
    "principalId": "usr_01KPG30…",
    "label": "Production CI",
    "disabled": false,
    "expiresAt": null,
    "createdAt": "2026-09-30T12:00:00.000Z",
    "lastUsedAt": null
  }
}

Store accessKeyId and secret as HUUDIS_ACCESS_KEY_ID and HUUDIS_SECRET_ACCESS_KEY — the SDKs and the CLI read those.

Status error.code When
400 PRINCIPAL_NOT_FOUND The service account is not in this workspace.
400 PRINCIPAL_DISABLED The service account is disabled.
403 FORBIDDEN principalId is another person.

A new key can do nothing on the management API until a policy attached to its user (or one of the user's groups) allows it — see Policies. For example, read-only access to Huudis is the HuudisReadOnly system policy.

List access keys

GET /api/v1/iam/access-keys?principalType={user|service_account}&principalId={id}

Both query parameters are required. Returns the keys of that principal, newest first, without secrets. lastUsedAt is stamped on every request the key signs; null means never used.

Revoke an access key

POST /api/v1/iam/access-keys/:id/revoke

Disables the key immediately (disabled: true); requests signed with it get 401 INVALID_ACCESS_KEY. The row stays for the audit trail. Returns { id, disabled: true }.

Delete an access key

DELETE /api/v1/iam/access-keys/:id

Deletes the row. 204 No Content. Revoking is usually enough.

The access key object

Field Type Description
id string (akid_…) Row id, for revoke and delete.
accessKeyId string (AKIA…) The public id, sent in every signed request.
principalType string user or service_account.
principalId string The usr_… or svc_… the key belongs to.
label string | null Your hint.
disabled boolean true after revoke.
expiresAt ISO 8601 | null When the key stops working; null for never.
createdAt ISO 8601 When it was created.
lastUsedAt ISO 8601 | null Last signed request.

secret appears only in the create response.

Rotation

  1. Create a new key (optionally with expiresAt).
  2. Put the new id and secret in your program's secret store.
  3. Check it works — GET /api/v1/authz/whoami signed with the new key.
  4. Revoke the old key; delete it later.

Next