ApiKeyWorkspaceConnectorLink

ApiKeyWorkspaceConnectorLink is a junction table that binds a Well API key to exactly one workspace connector per direction (INPUT or OUTPUT), enforcing the rule that each API key governs at most two connectors: one data-source connector and one data-distribution connector. It is written exclusively by the api-key.service.ts system path during API-key onboarding (find-or-create a WorkspaceConnector, then persist this link) and is never edited after creation. The two CASCADE constraints mean the link is automatically removed when either the parent API key or the parent workspace connector is deleted, keeping the junction self-cleaning with no soft-delete column.

NamingValue
ObjectApiKeyWorkspaceConnectorLink
Resource type (JSON:API type)api_key_workspace_connector_link
Collection / records rootโ€” (not a records root)
REST base/v1/api-key-workspace-connector-links
Entity classMigration20260109123000

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-workspace-connector-links๐ŸŸก Planned
RetrieveGET /v1/api-key-workspace-connector-links/{id}๐ŸŸก Planned
CreatePOST /v1/api-key-workspace-connector-links๐ŸŸก Planned
UpdatePATCH /v1/api-key-workspace-connector-links/{id}๐ŸŸก Planned
DeleteDELETE /v1/api-key-workspace-connector-links/{id}๐ŸŸก Planned

Data model

Attributes

FieldTypeRequiredConstraintsAllowed valuesDescription
api_key_iduuidโœ… YesNOT NULL; FK โ†’ core_api.api_keys(api_key_id) ON DELETE CASCADE ON UPDATE CASCADE; composite UNIQUE (api_key_id, direction); indexedAny valid UUID referencing an existing ApiKeyPublic UUID of the parent API key that owns this connector link. Together with direction forms a unique pair, guaranteeing at most one connector per direction per key.
workspace_connector_pkintegerโœ… YesNOT NULL; FK โ†’ core_api.workspace_connectors(pk) ON DELETE CASCADE ON UPDATE CASCADE; UNIQUE (workspace_connector_pk); indexedAny integer referencing an existing WorkspaceConnectorInternal PK of the workspace connector that this link points to. The unique constraint enforces that a given workspace connector belongs to at most one API key.
direction๐Ÿ”’ system enum โ€” direction_enum (native Postgres enum)โœ… YesNOT NULL; part of composite UNIQUE (api_key_id, direction)input | outputSemantic role of the linked connector for this API key. input = data-source / ingestion connector; output = data-distribution / routing connector. At most one link per direction per API key.
created_at๐Ÿ”’ system timestamptzโœ… YesNOT NULL; DEFAULT now(); set once on INSERT via MikroORM onCreate hookโ€”UTC timestamp at which the link was created. Set automatically on first persist; never updated (no updated_at column on this entity).

System-computed

  • api_key_id is written by api-key.service.ts during API-key onboarding โ€” never by the user directly
  • workspace_connector_pk resolved via find-or-create logic in api-key.service.ts before persist
  • direction copied from the parent Connector.direction at link-creation time
  • created_at set once via MikroORM @Property({ onCreate: () => new Date() })
  • No updated_at column โ€” the record is immutable after creation
  • No deleted_at column โ€” hard-deleted via CASCADE when the parent ApiKey or WorkspaceConnector is removed
  • Idempotency guard: service checks for an existing link with the same (api_key_id, direction) pair before inserting; duplicate creation is silently skipped

Example

{
  "data": {
    "type": "api_key_workspace_connector_link",
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "attributes": {
      "api_key_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "workspace_connector_pk": 1042,
      "direction": "input",
      "created_at": "2026-01-09T12:30:00.000Z"
    }
  }
}
Source: apps/api/src/database/entities/ApiKeyWorkspaceConnectorLink.ts + apps/api/src/database/migrations/Migration20260109123000.ts ยท domain: ingestion ยท tier: Infrastructure