API Keys
Create API keys to authenticate your requests. You can rename, rotate, and revoke keys at any time.
| Method | Path | Description |
|---|---|---|
GET | /v1/store/keys | List API keys |
POST | /v1/store/keys | Create an API key |
POST | /v1/store/keys/{id}/roll | Roll (rotate) an API key |
POST | /v1/store/keys/{id}/revoke | Revoke an API key |
PATCH | /v1/store/keys/{id}/name | Rename an API key |
PATCH | /v1/store/keys/{id}/permissions | Update API key permissions |
List API keys
GET /v1/store/keysReturns all API keys for the store, including revoked keys. Never returns plaintext or hashes.
Request
curl https://api.hydrajs.dev/v1/store/keys \
-H "Authorization: Bearer sk_YOUR_KEY"Response 200
{
"data": []
}Create an API key
POST /v1/store/keysCreates a new API key. Optionally restrict permissions to specific resources. The plaintext key is returned once in the response and cannot be retrieved again.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Values: secret, publishable |
name | string | No | |
permissions | object | null | No | Resource permissions. Null or omitted = full access (unrestricted). |
Request
curl -X POST https://api.hydrajs.dev/v1/store/keys \
-H "Authorization: Bearer sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "secret"
}'Response 201
{
"data": {}
}Rename an API key
PATCH /v1/store/keys/{id}/nameUpdates the display name of an active API key. Pass null to clear the name.
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | null | Yes | Display name for the key. Null to clear. |
Request
curl -X PATCH https://api.hydrajs.dev/v1/store/keys/:id/name \
-H "Authorization: Bearer sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Storefront"
}'Response 200
{
"data": {}
}Update API key permissions
PATCH /v1/store/keys/{id}/permissionsSets the resource permissions for an API key. Pass null to grant full access (unrestricted). Only active keys can be updated.
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
permissions | object | null | Yes | Resource permissions. Null = full access (unrestricted). |
Request
curl -X PATCH https://api.hydrajs.dev/v1/store/keys/:id/permissions \
-H "Authorization: Bearer sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"permissions": "string_value"
}'Response 200
{
"data": {}
}Roll (rotate) an API key
POST /v1/store/keys/{id}/rollDeactivates the target key and generates a new key with the same type and mode. Optionally keeps the old key active for a grace period (0–168 hours). The new plaintext key is returned once.
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
grace_period_hours | integer | No | Hours to keep old key active (0–168). Defaults to 0 (immediate deactivation). |
permissions | object | null | No | Permissions for the new key. Omit to inherit from the old key. |
Request
curl -X POST https://api.hydrajs.dev/v1/store/keys/:id/roll \
-H "Authorization: Bearer sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"grace_period_hours": 24,
"permissions": "string_value"
}'Response 201
{
"data": {}
}Revoke an API key
POST /v1/store/keys/{id}/revokePermanently deactivates an API key. The key row is preserved for audit trail.
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string |
Request
curl -X POST https://api.hydrajs.dev/v1/store/keys/:id/revoke \
-H "Authorization: Bearer sk_YOUR_KEY"Response 200
{
"data": {}
}