Create a new API key
Creates a new API key for programmatic access. The full key is only returned once at creation time - make sure to save it securely! ## Scopes You can specify scopes in two ways: - **Presets**: `read` (viewer access), `write` (editor+builder access), `admin` (all access) - **Granular**: Individual scopes like `tables:query`, `rows:insert`, `apikeys:create` If no scopes are provided, defaults to read-only access (viewer scopes).
Authorization
BearerAuth Security scheme for OpenAPI endpoints. Validates both JWT tokens and API keys.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Request to create a new API key
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/api-keys" \ -H "Content-Type: application/json" \ -d '{ "name": "CI Pipeline Key", "scopes": [ "tables:read", "storage:read" ], "expires_in": "90d", "expires_at": null }'{ "key": "string", "api_key": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string", "key_prefix": "string", "scopes": [ "string" ], "organisation_id": "9ec26450-a51e-40b1-a49f-e04045480fd5", "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9", "expires_at": "string", "last_used_at": "string", "created_at": "string", "is_revoked": true }}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}{ "code": "string", "message": "string", "request_id": "string", "details": [ { "field": "string", "message": "string" } ]}