Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.wellapp.ai/llms.txt

Use this file to discover all available pages before exploring further.

ApiKey represents a long-lived programmatic credential scoped to a workspace (and optionally to a specific person/member) that authenticates API requests via the ApiKeyStrategy in the auth chain. It is created by workspace members through the POST /v1/api-keys endpoint and revoked via DELETE /v1/api-keys/:id; no PATCH route exists. Each key is linked to one or more workspace connectors via a separate api_key_workspace_connector_links join table, and those connectors are cleaned up automatically on revocation. The value field is the raw bearer secret โ€” it is only surfaced once at creation; all subsequent list responses return a masked_key derived from it.
NamingValue
ObjectApiKey
Resource type (JSON:API type)api_key
Collection / records rootโ€” (not a records root)
REST base/v1/api-key
Entity classApiKey
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.

API operations

OperationMethod & pathStatus
ListGET /v1/api-key๐ŸŸก Planned
RetrieveGET /v1/api-key/{id}๐ŸŸก Planned
CreatePOST /v1/api-key๐ŸŸก Planned
UpdatePATCH /v1/api-key/{id}๐ŸŸก Planned
DeleteDELETE /v1/api-key/{id}๐ŸŸก Planned

Data model

Attributes

FieldTypeRequiredConstraintsAllowed valuesDescription
api_key_idstring (UUID) โ€” ๐Ÿ”’ systemโœ… Yesunique; defaultRaw: gen_random_uuid()โ€”Public stable identifier for the API key. Used as the JSON:API id and in all API routes (:id param). Generated by the database on INSERT.
valuestring โ€” ๐Ÿ”’ systemโœ… Yesunique; varchar(255)โ€”The raw bearer secret. Generated server-side by ApiKeyService at creation; never surfaced again after the creation response. List and GET responses return masked_key instead.
namestringโœ… Yesvarchar(255); not nullโ€”Human-readable label for the key, supplied by the caller at creation (e.g. โ€˜CI Pipeline Keyโ€™).
created_atdatetime โ€” ๐Ÿ”’ systemโœ… Yestimestamptz; not null; set on INSERT via onCreate hookโ€”Timestamp of key creation, set automatically by the MikroORM onCreate lifecycle hook.
updated_atdatetime โ€” ๐Ÿ”’ systemโšช Notimestamptz; nullable; set on INSERT and UPDATE via onCreate/onUpdate hooksโ€”Timestamp of last modification, managed by MikroORM lifecycle hooks.
last_used_atdatetime โ€” ๐Ÿ”’ systemโšช Notimestamptz; nullableโ€”Timestamp of the last successful authentication using this key, stamped by ApiKeyStrategy at each successful auth pass.
expiration_datedatetimeโšช Notimestamptz; nullableโ€”Optional expiry date-time after which the key should be considered invalid. Supplied as expiration_at in the creation payload. No server-side expiry enforcement beyond this stored value.
is_activebooleanโœ… Yesnot null; default truetrue, falseSoft-disable flag. Set to false by ApiKeyService.revokeApiKey() on DELETE. Keys with is_active=false are rejected by ApiKeyStrategy.

Relationships

NameTypeRequiredDescription
workspaceto-one (ManyToOne)No (nullable: true)The workspace this API key is scoped to. Set at creation; required at the business-logic level (controller throws 400 if absent). Target: Workspace.
peopleto-one (ManyToOne)No (nullable: true)The person (workspace member) who created the key, resolved from the Firebase membership at creation time. Null for system-created keys. Target: People.

System-computed

  • api_key_id โ€” generated via gen_random_uuid() defaultRaw on INSERT
  • created_at โ€” set by MikroORM onCreate hook, never writable
  • updated_at โ€” set by MikroORM onCreate + onUpdate hooks, never writable
  • value โ€” generated server-side by ApiKeyService (random secure secret); returned once at creation, never again
  • last_used_at โ€” stamped by ApiKeyStrategy on each successful auth pass, not user-writable
  • is_active โ€” defaults to true on INSERT; set to false by ApiKeyService.revokeApiKey() on DELETE, not directly patchable

Example

{
  "data": {
    "type": "api_key",
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "attributes": {
      "name": "CI Pipeline Key",
      "is_active": true,
      "created_at": "2026-01-15T09:00:00.000Z",
      "last_used_at": "2026-05-28T14:32:11.000Z",
      "expiration_at": "2027-01-15T09:00:00.000Z",
      "masked_key": "sk_live_ab...ef12"
    }
  }
}
Source: apps/api/src/database/entities/ApiKey.ts ยท domain: platform ยท tier: Platform