API
API keys
List, create and revoke the public API keys of your organization.
On this page
The examples use the two shell variables from Authentication:
export FENVIX_API=https://api.fenvix.dev/v1/public
export FENVIX_KEY="$(read_from_your_secret_store)" # never written in a commandList API keys#
GET /api-keys
Needs an admin key. A signed-in console session of an owner or admin also works, with X-Fenvix-Workspace: <organization id>.
curl -sS "$FENVIX_API/api-keys" \
-H "Authorization: Bearer $FENVIX_KEY"Parameters#
| Name | In | Required | Type | Notes |
|---|---|---|---|---|
cursor |
query | no | string | The nextCursor of the previous page. |
limit |
query | no | integer | Default 20. |
Answers#
| Status | Body | Meaning |
|---|---|---|
200 |
object |
A page of keys, newest first. Never the key itself. |
401 |
Error |
No key, or the key is not valid, has expired or has been revoked. |
403 |
Error |
The key is read only. |
429 |
Error |
Too many requests. Wait for the number of seconds in Retry-After. |
Create an API key#
POST /api-keys
Needs an admin key. A signed-in console session of an owner or admin also works, with X-Fenvix-Workspace: <organization id>. Accepts Idempotency-Key.
The key (token) is in this answer only; store it now. Repeating the request with the same Idempotency-Key answers 409. At most 100 active keys per organization (409). Only a dashboard session creates admin keys; a key creates read_only keys that expire no later than itself (and must expire if it does), and that are revoked when it is. A session must send X-Fenvix-Workspace.
curl -sS -X POST "$FENVIX_API/api-keys" \
-H "Authorization: Bearer $FENVIX_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"ci deploys","role":"read_only"}'Parameters#
| Name | In | Required | Type | Notes |
|---|---|---|---|---|
Idempotency-Key |
header | no | string | Repeat a request safely for 24 hours. See the Idempotency section. |
Request body#
| Field | Required | Type | Notes |
|---|---|---|---|
name |
yes | string | — |
role |
yes | string (admin, read_only) |
— |
expiresAt |
no | string or null | — |
Answers#
| Status | Body | Meaning |
|---|---|---|
201 |
object |
Created. |
400 |
Error |
The request is not valid; field names the part that is not. |
401 |
Error |
No key, or the key is not valid, has expired or has been revoked. |
403 |
Error |
The key is read only. |
409 |
Error |
Conflict: the name is taken, the database is busy, or the Idempotency-Key was used for another request. |
429 |
Error |
Too many requests. Wait for the number of seconds in Retry-After. |
Revoke an API key#
DELETE /api-keys/{id}
Needs an admin key. A signed-in console session of an owner or admin also works, with X-Fenvix-Workspace: <organization id>. Accepts Idempotency-Key.
curl -sS -X DELETE "$FENVIX_API/api-keys/$KEY_ID" \
-H "Authorization: Bearer $FENVIX_KEY"Parameters#
| Name | In | Required | Type | Notes |
|---|---|---|---|---|
id |
path | yes | string | — |
Idempotency-Key |
header | no | string | Repeat a request safely for 24 hours. See the Idempotency section. |
Answers#
| Status | Body | Meaning |
|---|---|---|
200 |
ApiKey |
Revoked (repeating it changes nothing). |
400 |
Error |
The request is not valid; field names the part that is not. |
401 |
Error |
No key, or the key is not valid, has expired or has been revoked. |
403 |
Error |
The key is read only. |
404 |
Error |
No such key in this organization. |
409 |
Error |
Conflict: the name is taken, the database is busy, or the Idempotency-Key was used for another request. |
429 |
Error |
Too many requests. Wait for the number of seconds in Retry-After. |