Skip to content

API Keys

Endpoints


POST /api/v1/projects/{projectId}/api-keys

Generate a new API key for a project

Authentication

Requires Bearer token. See Authentication.

Path Parameters

ParameterTypeDescription
projectIdstring

Request Body

FieldTypeRequiredDescription
labelstringNo
permissions"read" | "write"[]NoDefault: ["read","write"]
expires_atstringNoISO 8601 expiry date. Format: date-time

Response (201)

FieldTypeRequiredDescription
idstringYesFormat: uuid
keystringYesFull API key — shown only once
key_prefixstringYes
labelstring,nullYes
permissions"read" | "write"[]Yes
expires_atstring,nullYes
created_atstringYes

Error Responses

StatusDescription
401Unauthorized
403Forbidden

Example

Request:

bash
curl -s \
  -X POST \
  "http://localhost:3000/api/v1/projects/$PROJECT_ID/api-keys" \
  -H "Authorization: Bearer $NEXGRAPH_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "label": "ci-read-only",
  "permissions": [
    "read"
  ],
  "expires_at": "2026-01-15T10:30:00.000Z"
}'

Response:

json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "key": "string",
  "key_prefix": "string",
  "label": null,
  "permissions": [
    "read"
  ],
  "expires_at": null,
  "created_at": "string"
}

GET /api/v1/projects/{projectId}/api-keys

List API keys for a project (prefix only, never full key)

Authentication

Requires Bearer token. See Authentication.

Path Parameters

ParameterTypeDescription
projectIdstring

Response (200)

FieldTypeRequiredDescription
api_keysobject[]Yes

Error Responses

StatusDescription
401Unauthorized
403Forbidden

Example

Request:

bash
curl -s \
  "http://localhost:3000/api/v1/projects/$PROJECT_ID/api-keys" \
  -H "Authorization: Bearer $NEXGRAPH_KEY"

Response:

json
{
  "api_keys": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "key_prefix": "string",
      "label": null,
      "permissions": [
        "read"
      ],
      "revoked": true,
      "expires_at": null,
      "created_at": "string"
    }
  ]
}

DELETE /api/v1/projects/{projectId}/api-keys/{keyId}

Revoke an API key

Authentication

Requires Bearer token. See Authentication.

Path Parameters

ParameterTypeDescription
projectIdstring
keyIdstring

Error Responses

StatusDescription
401Unauthorized
403Forbidden
404API key not found

Example

Request:

bash
curl -s \
  -X DELETE \
  "http://localhost:3000/api/v1/projects/$PROJECT_ID/api-keys/$KEY_ID" \
  -H "Authorization: Bearer $NEXGRAPH_KEY"

Released under the MIT License.