CORTEX

Configuration

Organization-wide setup: profile, branding, directory, AI model selections and prompts, plus the channels and connectors that wire Cortex into the rest of the stack.

Common responses

These responses apply across endpoints in this section unless an endpoint documents an additional response.

StatusMeaningBody
200Request succeeded.Endpoint response object.
201Resource created.Created resource object.
400Invalid request.Error envelope.
401Missing or invalid bearer token.Error envelope.
404Resource not found or not visible to the current organization.Error envelope.

Profile

Get organization profile

Get the current organization's profile. Returns the enriched `OrganizationRow` shape including live subscription plan details and user count.

GET/v1/organization
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "Acme Corp",
  "is_system": false,
  "is_suspended": false,
  "plan_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
  "plan_name": "Growth",
  "subscription_id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
  "subscription_status": "active",
  "policy_overrides": {
    "artifact_generation_mode": "generators"
  },
  "industry": "Technology",
  "primary_language": "en",
  "primary_timezone": "America/New_York",
  "user_count": 12,
  "created_at": "2024-03-15T09:00:00.000Z",
  "updated_at": "2025-01-20T14:30:00.000Z",
  "deleted_at": null
}

Update organization profile

Update the current organization's profile. All fields are optional; omit a field to leave it unchanged.

PATCH/v1/organization

Request body

NameTypeRequiredDescription
namestringOptionalOrganization display name. 1–255 characters.
industrystringOptionalIndustry descriptor. Pass `null` to clear. Max 200 characters.
primaryLanguagestringOptionalBCP-47 language tag (e.g. `"en"`, `"fr"`). Min 2, max 20 characters.
primaryTimezonestringOptionalIANA timezone name (e.g. `"America/New_York"`). Max 100 characters.
policyOverridesobjectOptionalOrganization runtime policy overrides. `artifact_generation_mode` may be `"generators"` or `"sandbox"`.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization \
  -X PATCH \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"name":"Sales assistant","industry":"saas","primary_language":"en","primary_timezone":"America/New_York","policy_overrides":{"artifact_generation_mode":"sandbox"}}'

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "Acme Corp",
  "is_system": false,
  "is_suspended": false,
  "plan_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
  "plan_name": "Growth",
  "subscription_id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
  "subscription_status": "active",
  "policy_overrides": {
    "artifact_generation_mode": "sandbox"
  },
  "industry": "Technology",
  "primary_language": "en",
  "primary_timezone": "America/Chicago",
  "user_count": 12,
  "created_at": "2024-03-15T09:00:00.000Z",
  "updated_at": "2025-05-21T11:00:00.000Z",
  "deleted_at": null
}

Branding

Get branding

Get the organization's branding profile. Returns color values, brand guidelines text, and presigned read URLs for each asset slot (`logo_light`, `logo_dark`, `brand_book`). A slot is `null` when no asset has been uploaded to it.

GET/v1/organization/branding
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/branding \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "branding": {
    "organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "logo_light": {
      "storage_key": "org-branding/a1b2c3d4-e5f6-7890-abcd-ef1234567890/logo_light/d4e5f6a7-b8c9-0123-defa-234567890123.png",
      "filename": "acme-logo-light.png",
      "mime_type": "image/png",
      "size_bytes": 45312,
      "get_url": "https://storage.example.com/org-branding/...?sig=..."
    },
    "logo_dark": null,
    "brand_book": null,
    "color_primary": "#1a2b3c",
    "color_secondary": "#4d5e6f",
    "color_accent": "#ff6600",
    "guidelines_text": "Always use the primary color on white backgrounds.",
    "updated_at": "2025-04-10T08:00:00.000Z"
  }
}

Update branding

Update the organization's color palette and brand guidelines text. Pass an empty string for a color field to clear it. Asset slots (logos, brand book) are managed via the upload and confirm endpoints — they cannot be set here.

PATCH/v1/organization/branding

Request body

NameTypeRequiredDescription
colorPrimarystringOptionalPrimary brand color as `#RRGGBB`. Pass `""` to clear.
colorSecondarystringOptionalSecondary brand color as `#RRGGBB`. Pass `""` to clear.
colorAccentstringOptionalAccent brand color as `#RRGGBB`. Pass `""` to clear.
guidelinesTextstringOptionalPlain-text brand guidelines. Max 8000 characters. Pass `""` to clear.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/branding \
  -X PATCH \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"color_primary":"example","color_secondary":"example","color_accent":"example","guidelines_text":"example"}'

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "branding": {
    "organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "logo_light": {
      "storage_key": "org-branding/a1b2c3d4-e5f6-7890-abcd-ef1234567890/logo_light/d4e5f6a7-b8c9-0123-defa-234567890123.png",
      "filename": "acme-logo-light.png",
      "mime_type": "image/png",
      "size_bytes": 45312,
      "get_url": "https://storage.example.com/org-branding/...?sig=..."
    },
    "logo_dark": null,
    "brand_book": null,
    "color_primary": "#1a2b3c",
    "color_secondary": "#4d5e6f",
    "color_accent": "#ff6600",
    "guidelines_text": "Always use the primary color on white backgrounds.",
    "updated_at": "2025-05-21T11:05:00.000Z"
  }
}

Request branding upload URL

Request a presigned PUT URL to upload a branding asset directly to blob storage. After uploading to `uploadUrl`, call `PUT /organization/branding/assets/:slot` with the returned `storageKey` to confirm the asset. The URL expires in 300 seconds.

POST/v1/organization/branding/uploads

Request body

NameTypeRequiredDescription
slotstringRequiredAsset slot to upload to. One of `"logo_light"`, `"logo_dark"`, or `"brand_book"`.
mimeTypestringRequiredMIME type of the file being uploaded. Logos accept `image/png`, `image/svg+xml`, `image/jpeg`, `image/webp` (max 5 MB). Brand books accept `application/pdf` (max 25 MB).
sizeBytesnumberRequiredExact byte size of the file. Used to enforce per-slot size limits before issuing the upload URL.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/branding/uploads \
  -X POST \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"slot":"logo_light","mime_type":"application/pdf","size_bytes":1024}'

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
201 Createdjson
{
  "upload_url": "https://storage.example.com/org-branding/a1b2c3d4-e5f6-7890-abcd-ef1234567890/logo_light/d4e5f6a7-b8c9-0123-defa-234567890123.png?sig=...",
  "storage_key": "org-branding/a1b2c3d4-e5f6-7890-abcd-ef1234567890/logo_light/d4e5f6a7-b8c9-0123-defa-234567890123.png",
  "expires_in_seconds": 300
}

Confirm branding asset

Confirm a branding asset after uploading the file to the presigned URL. The `storageKey` must match the key returned by `POST /organization/branding/uploads` for this org and slot. Returns the full updated branding profile.

PUT/v1/organization/branding/assets/:slot

Path parameters

NameTypeRequiredDescription
slotstringRequiredAsset slot being confirmed. One of `logo_light`, `logo_dark`, or `brand_book`.

Request body

NameTypeRequiredDescription
storageKeystringRequiredThe `storageKey` returned by the upload request. Max 1000 characters.
filenamestringRequiredOriginal filename (plain basename, no path separators). Max 255 characters.
mimeTypestringRequiredMIME type of the uploaded file. Must match the slot's allowed types.
sizeBytesnumberRequiredExact byte size of the uploaded file.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/branding/assets/logo_light \
  -X PUT \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"storage_key":"example","filename":"report.pdf","mime_type":"application/pdf","size_bytes":1024}'

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "branding": {
    "organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "logo_light": {
      "storage_key": "org-branding/a1b2c3d4-e5f6-7890-abcd-ef1234567890/logo_light/d4e5f6a7-b8c9-0123-defa-234567890123.png",
      "filename": "acme-logo-light.png",
      "mime_type": "image/png",
      "size_bytes": 45312,
      "get_url": "https://storage.example.com/org-branding/...?sig=..."
    },
    "logo_dark": null,
    "brand_book": null,
    "color_primary": "#1a2b3c",
    "color_secondary": "#4d5e6f",
    "color_accent": "#ff6600",
    "guidelines_text": "Always use the primary color on white backgrounds.",
    "updated_at": "2025-05-21T11:10:00.000Z"
  }
}

Clear branding asset

Remove a branding asset from the given slot and delete the underlying blob from storage. Returns 204 on success.

DELETE/v1/organization/branding/assets/:slot

Path parameters

NameTypeRequiredDescription
slotstringRequiredAsset slot to clear. One of `logo_light`, `logo_dark`, or `brand_book`.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/branding/assets/logo_light \
  -X DELETE \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
204 No Contenttext

Departments

List departments

List all departments in the organization, ordered by name. The `parentDepartmentId` field enables a tree structure — `null` denotes a top-level department.

GET/v1/organization/departments
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/departments \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "data": [
    {
      "id": "a7b8c9d0-e1f2-3456-abcd-567890123456",
      "organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "parent_department_id": null,
      "name": "Engineering",
      "description": "Product and platform engineering.",
      "created_at": "2024-03-20T08:00:00.000Z",
      "updated_at": "2024-03-20T08:00:00.000Z"
    },
    {
      "id": "b8c9d0e1-f2a3-4567-bcde-678901234567",
      "organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "parent_department_id": "a7b8c9d0-e1f2-3456-abcd-567890123456",
      "name": "Platform",
      "description": "Infrastructure and developer tooling.",
      "created_at": "2024-04-01T08:00:00.000Z",
      "updated_at": "2024-04-01T08:00:00.000Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Create department

Create a new department. Optionally nest it under a parent department by providing `parentDepartmentId`. Returns 400 if the specified parent does not exist in this organization.

POST/v1/organization/departments

Request body

NameTypeRequiredDescription
namestringRequiredDepartment name. 1–200 characters.
descriptionstringOptionalOptional description. Max 2000 characters.
parentDepartmentIdstringOptionalUUID of the parent department for nesting. Pass `null` for a top-level department.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/departments \
  -X POST \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"name":"Sales assistant"}'

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
201 Createdjson
{
  "id": "c9d0e1f2-a3b4-5678-cdef-789012345678",
  "organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "parent_department_id": "a7b8c9d0-e1f2-3456-abcd-567890123456",
  "name": "Security",
  "description": "Application and infrastructure security.",
  "created_at": "2025-05-21T11:25:00.000Z",
  "updated_at": "2025-05-21T11:25:00.000Z"
}

Update department

Update a department's name, description, or parent. Returns 400 if a cycle would be formed by the new parent assignment.

PATCH/v1/organization/departments/:departmentId

Path parameters

NameTypeRequiredDescription
departmentIdstringRequiredUUID of the department to update.

Request body

NameTypeRequiredDescription
namestringOptionalDepartment name. 1–200 characters.
descriptionstringOptionalOptional description. Max 2000 characters.
parentDepartmentIdstringOptionalUUID of the new parent department. Pass `null` to promote to top-level.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/departments/b2c8d3a1-4567-89ab-cdef-012345678901 \
  -X PATCH \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"name":"Sales assistant","description":"Created via the docs example.","parent_department_id":"example"}'

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "id": "c9d0e1f2-a3b4-5678-cdef-789012345678",
  "organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "parent_department_id": null,
  "name": "Security",
  "description": "Application and infrastructure security.",
  "created_at": "2025-05-21T11:25:00.000Z",
  "updated_at": "2025-05-21T11:30:00.000Z"
}

Delete department

Delete a department. Returns 409 if the department has child departments or if usage events reference it.

DELETE/v1/organization/departments/:departmentId

Path parameters

NameTypeRequiredDescription
departmentIdstringRequiredUUID of the department to delete.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/departments/b2c8d3a1-4567-89ab-cdef-012345678901 \
  -X DELETE \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
204 No Contenttext

Data leakage protection

List DLP rules

List the organization's data-leakage-protection content rules. Rules are regular expressions evaluated against every user message BEFORE it is stored or dispatched to a model: a matching active `allow` rule is an exception that always permits; otherwise a matching active `deny` rule blocks the message (the create-message endpoint returns 422 with code `dlp_blocked`).

GET/v1/organization/dlp-rules
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/dlp-rules \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Create DLP rule

Create a content rule. `pattern` (max 300 chars) must compile as a JavaScript regular expression — invalid patterns are rejected with 400, never stored. `action` is `deny` (block matching messages) or `allow` (exception that always permits). Rules default to active.

POST/v1/organization/dlp-rules

Request body

NameTypeRequiredDescription
namestringRequiredDisplay name, max 100 characters.
patternstringRequiredRegular expression, max 300 characters. Matched case-insensitively.
actionstringRequired`deny` or `allow`.
is_activebooleanOptionalDefaults to true; inactive rules are not enforced.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/dlp-rules \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "<name>",
  "pattern": "<pattern>",
  "action": "<action>",
  "is_active": false
}'

Update DLP rule

Partially update a rule. Same validation as create; at least one field is required.

PATCH/v1/organization/dlp-rules/{ruleId}
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/dlp-rules/{ruleId} \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Delete DLP rule

Delete a rule. Enforcement stops immediately; returns 204.

DELETE/v1/organization/dlp-rules/{ruleId}
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/dlp-rules/{ruleId} \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Feature flags

List feature flags

Every platform feature flag resolved for the caller's organization — an org override shadows the platform default, and a flag with no row resolves `false`. Read-only: toggling is a platform-operator action in the console. Clients read this once per session to drive flag-gated UI (run progress presentation, intermediary file visibility).

GET/v1/feature-flags
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/feature-flags \
  -H "Authorization: Bearer $CORTEX_TOKEN"
200 OKjson
{
  "flags": {
    "generator_native_presentations": false,
    "run_progress_chip": false,
    "show_intermediary_files": false
  }
}

Themes

List themes

List the organization's custom themes. Built-in themes (`cortex`, `solid-slate`) are code-defined and never appear here. Each theme carries a `palette_id` (`custom-<id>`) — the value used in `allowed_themes`, `default_theme`, and the `data-theme` attribute.

GET/v1/organization/themes
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/themes \
  -H "Authorization: Bearer $CORTEX_TOKEN"
200 OKjson
{
  "themes": [
    {
      "id": "9f1c7e2a-0b34-4f88-a1d2-3c4b5a697788",
      "palette_id": "custom-9f1c7e2a-0b34-4f88-a1d2-3c4b5a697788",
      "name": "Ocean",
      "surface": "glass",
      "light_enabled": true,
      "dark_enabled": true,
      "light_tokens": {
        "--primary": "221 83% 53%"
      },
      "dark_tokens": {
        "--primary": "213 93% 68%"
      },
      "background_light_asset_id": null,
      "background_dark_asset_id": null,
      "brand_inputs": {
        "brief": "calm, professional",
        "attachments": [
          {
            "kind": "site",
            "label": "acme.com",
            "url": "https://acme.com/",
            "detail": "Home page and stylesheets",
            "brand_name": "Acme",
            "colors": [
              "#0e7c66"
            ],
            "neutrals": [
              "#f4f6f8"
            ],
            "guidelines": null
          }
        ]
      },
      "created_at": "2026-08-23T10:00:00.000Z",
      "updated_at": "2026-08-23T10:00:00.000Z"
    }
  ]
}

Create theme

Create a custom theme. Token maps are flat objects of CSS custom property name (`--kebab-case`, max 64 chars) to value. Values are strictly validated — `{ } ; @`, `url(`, and comment/tag sequences are rejected — because they compile verbatim into the public stylesheet. At least one variant (light or dark) must stay enabled.

POST/v1/organization/themes

Request body

NameTypeRequiredDescription
namestringRequiredDisplay name, 1–80 characters.
surfacestringOptional`glass` or `flat`. Default `glass`.
light_enabledbooleanOptionalWhether the light variant is available. Default `true`.
dark_enabledbooleanOptionalWhether the dark variant is available. Default `true`.
light_tokensobjectOptionalCSS custom properties for the light variant.
dark_tokensobjectOptionalCSS custom properties for the dark variant.
brand_inputsobjectOptionalWhat the theme studio's composer held: `{ brief, attachments: [{ kind: "site" | "book", label, url?, detail?, brand_name?, colors, neutrals, guidelines? }] }`. A brand book is stored as its extraction (name, size, colours, excerpt), never the PDF. Restored when the theme is reopened; `null` to clear.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/themes \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "<name>",
  "surface": "<surface>",
  "light_enabled": false,
  "dark_enabled": false,
  "light_tokens": {},
  "dark_tokens": {},
  "brand_inputs": {}
}'

Get theme

Fetch one custom theme by id (the raw uuid, not the `custom-` palette id).

GET/v1/organization/themes/{themeId}
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/themes/{themeId} \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Update theme

Partially update a theme. Same validation rules as create; token maps replace the stored map for that variant wholesale.

PATCH/v1/organization/themes/{themeId}

Request body

NameTypeRequiredDescription
namestringOptionalDisplay name, 1–80 characters.
surfacestringOptional`glass` or `flat`.
light_enabledbooleanOptionalDisabling both variants is rejected.
dark_enabledbooleanOptionalDisabling both variants is rejected.
light_tokensobjectOptionalReplacement token map for the light variant.
dark_tokensobjectOptionalReplacement token map for the dark variant.
brand_inputsobjectOptionalReplacement composer inputs (same shape as on create); `null` clears them.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/themes/{themeId} \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "<name>",
  "surface": "<surface>",
  "light_enabled": false,
  "dark_enabled": false,
  "light_tokens": {},
  "dark_tokens": {},
  "brand_inputs": {}
}'

Delete theme

Delete a custom theme. The theme is also scrubbed from the organization's `allowed_themes` (falling back to the built-ins when the list would become empty) and cleared as `default_theme` if it was the default. Returns `204 No Content`.

DELETE/v1/organization/themes/{themeId}
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/themes/{themeId} \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Get theme stylesheet (public)

Compiled CSS for a custom theme. Public by design — stylesheet `<link>` tags cannot carry credentials; the unguessable uuid is the capability, and the response contains only design-token values. Supports `ETag`/`If-None-Match` revalidation and omits disabled variants.

GET/v1/public/themes/{themeId}/styles.css
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/public/themes/{themeId}/styles.css \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Request background upload

Request a presigned upload for a per-variant backdrop photo. Returns `upload_url` (PUT the file there with `x-ms-blob-type: BlockBlob`) and `asset_id`. Allowed types: png, jpeg, webp, avif; max 8 MB.

POST/v1/organization/themes/{themeId}/background

Request body

NameTypeRequiredDescription
variantstringRequired`light` or `dark`.
mimeTypestringRequiredImage content type.
sizeBytesnumberRequiredFile size in bytes.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/themes/{themeId}/background \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "variant": "<variant>",
  "mimeType": "<mimeType>",
  "sizeBytes": 0
}'

Confirm background

Attach an uploaded asset as the variant's backdrop. Fails if the blob was never uploaded. Replacing a backdrop deletes the previous blob; the compiled stylesheet gains `--app-backdrop: url(...)` for that variant.

PUT/v1/organization/themes/{themeId}/background

Request body

NameTypeRequiredDescription
variantstringRequired`light` or `dark`.
assetIdstringRequiredAsset id from the upload request.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/themes/{themeId}/background \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "variant": "<variant>",
  "assetId": "<assetId>"
}'

Remove background

Clear the variant's backdrop and delete its blob (best effort).

DELETE/v1/organization/themes/{themeId}/background/{variant}
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/themes/{themeId}/background/{variant} \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Suggest theme colors (AI)

Ask the organization's base model for a coordinated light + dark palette. Any combination of a free-text brief, the brand's name, anchor colors (from a brand book, a website, or the theme being refined) and an excerpt of written guidelines can be sent; at least one of `brief` (3+ characters), `colors` or `guidelines` (20+ characters) is required. The model only proposes the design intent: `--primary`, the page, card, popover and sidebar surfaces, the body text and the four status hues. With `scope: "full"` the API derives everything else deterministically on top — hover, muted and secondary fills, borders and rings as low-chroma steps off their own surface, every text-on-fill colour by WCAG contrast, brand and status colours nudged until they read on their surface, plus gradients, glass tints and chrome — so a brand colour can never land in a hover fill and the result always passes stylesheet validation.

POST/v1/organization/themes/suggest-colors

Request body

NameTypeRequiredDescription
briefstringOptionalFree-text direction, up to 2000 characters, e.g. `"warmer, less contrast in dark mode"`.
brand_namestringOptionalThe brand the theme is for, up to 120 characters.
colorsstring[]OptionalUp to 12 anchor colors as `#rrggbb`. The most prominent saturated one becomes `--primary`.
guidelinesstringOptionalWritten brand guidance for the model, up to 8000 characters (typically the `excerpt` from the brand-book endpoint).
scopestringOptional`"colors"` (default) returns the intent tokens the model chose; `"full"` expands them into a complete, contrast-checked theme.
surfacestringOptional`"glass"` (default) or `"flat"`. Used by `scope: "full"` to derive the matching chrome.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/themes/suggest-colors \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"brand_name": "Acme Robotics", "colors": ["#0e7c66", "#f4b942"], "brief": "professional and calm", "scope": "full", "surface": "glass"}'

Response codes

StatusMeaningBody
200OK`{ light_tokens, dark_tokens }` — token name → HSL triple (or full CSS values under `scope: "full"`)
400Nothing to work from, malformed colors, or no base model configured for the organization`{ error }`
502The model call failed or returned an unusable response`{ error }`
200 OKjson
{
  "light_tokens": {
    "--primary": "165 80% 27%",
    "--background": "40 20% 98%",
    "--foreground": "160 30% 10%"
  },
  "dark_tokens": {
    "--primary": "165 60% 62%",
    "--background": "165 25% 8%",
    "--foreground": "40 20% 94%"
  }
}

Derive theme tokens and run checks

The theme engine behind generation, exposed for editors; pure and fast, no model call. Send a theme's token maps and get back two things. First, when `changed` names the Palette swatch that was just edited, the tokens that follow it for that variant — text on primary, the focus ring and the sidebar's active colour for a new brand colour; hover, muted and secondary fills, borders and panels for a new page colour; the whole sidebar family for a new rail colour — re-derived from the theme's core palette. Second, for each variant, the readability checks: text/surface pairs under 4.5:1, emphasis colours under 3:1 on their surface, structural fills that look like a brand colour or sit far from their surface, and panels far from the page. Each issue carries a `fix` map holding the values generation would have produced.

POST/v1/organization/themes/derive

Request body

NameTypeRequiredDescription
surfacestringRequired`"glass"` or `"flat"`.
light_tokensobjectOptionalThe light variant's tokens, name → value. Omit a variant to skip it.
dark_tokensobjectOptionalThe dark variant's tokens.
changedobjectOptionalOptional `{ variant, token, previous? }`: the Palette swatch just edited (`--primary`, `--background`, `--foreground`, `--sidebar-background` or `--accent-gradient`) and its value before the edit. With `--primary`, `previous` lets the action gradient follow while it is still the derived one.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/themes/derive \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"surface": "flat", "light_tokens": {"--primary": "9 100% 51%", "--background": "0 0% 98%", "--foreground": "0 0% 12%", "--accent": "11 95% 55%"}, "changed": {"variant": "light", "token": "--primary", "previous": "221 83% 53%"}}'

Response codes

StatusMeaningBody
200OK`{ light_tokens, dark_tokens, light_issues, dark_issues }` — the dependent tokens for the changed variant (empty without `changed`) and `{ code, message, tokens, fix }` issues per variant
400Malformed body, or a token map that fails stylesheet validation`{ error }`
200 OKjson
{
  "light_tokens": {
    "--primary-foreground": "9 30% 10%",
    "--ring": "9 100% 51%",
    "--sidebar-primary": "9 100% 51%"
  },
  "dark_tokens": {},
  "light_issues": [
    {
      "code": "loud:--accent",
      "message": "The hover fill looks like a brand colour; fills stay near-neutral.",
      "tokens": [
        "--accent"
      ],
      "fix": {
        "--accent": "0 0% 93%",
        "--accent-foreground": "0 0% 12%"
      }
    }
  ],
  "dark_issues": []
}

Extract brand colors (AI assist)

Fetch a public web page (plus a few of its same-origin stylesheets) and mine its most brand-looking colors — the page's `theme-color` meta always leads. Only public http(s) hosts are allowed (SSRF-guarded); responses are size- and time-capped. Returns `host`, ranked `colors` (hex), and `theme_color`.

POST/v1/organization/themes/extract-colors

Request body

NameTypeRequiredDescription
urlstringRequiredPublic page URL.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/themes/extract-colors \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "<url>"
}'

Read a brand book

Read a brand-guidelines PDF and return what the theme studio needs to generate a theme from it: the colors the document names (hex, `rgb()`, RGB/CMYK listings and `HEX` labels are all recognised), a title, and a short excerpt of the text for the model. Only the first 80 pages are read. The file is processed in memory and never stored. Send `multipart/form-data` with the PDF in the `file` field (up to 20 MB). Scanned PDFs without a text layer return 422.

POST/v1/organization/themes/extract-brand-book

Request body

NameTypeRequiredDescription
filefileRequiredThe brand book as a PDF, up to 20 MB. Multipart field name `file`.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/themes/extract-brand-book \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -F "file=@acme-brand-guidelines.pdf"

Response codes

StatusMeaningBody
200OK`{ filename, page_count, title, colors, neutrals, excerpt }`
400Missing file, not a PDF, or larger than 20 MB`{ error }`
422The PDF has no readable text (scanned document)`{ error }`
200 OKjson
{
  "filename": "acme-brand-guidelines.pdf",
  "page_count": 24,
  "title": "Acme Robotics — Brand guidelines",
  "colors": [
    "#0e7c66",
    "#f4b942",
    "#0b3b2e"
  ],
  "neutrals": [
    "#f5f3ee",
    "#2b2b2b"
  ],
  "excerpt": "Our primary green #0E7C66 carries every action. Amber #F4B942 is reserved for highlights…"
}

Generate background (AI)

Generate a backdrop photo from a prompt using the organization's image model (OpenAI-backed models currently), store it as the variant's background asset, and return the updated theme. Replaces (and deletes) any previous backdrop for that variant.

POST/v1/organization/themes/{themeId}/generate-background

Request body

NameTypeRequiredDescription
variantstringRequired`light` or `dark`.
promptstringRequiredImage prompt, 3-4000 characters.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/themes/{themeId}/generate-background \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "variant": "<variant>",
  "prompt": "<prompt>"
}'

Get theme asset (public)

Streams a theme background image. Public by design — CSS `url()` cannot carry credentials; the unguessable asset uuid is the capability. Asset ids are immutable, so responses cache long (`max-age=86400, immutable`).

GET/v1/public/themes/assets/{assetId}
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/public/themes/assets/{assetId} \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Appearance

Get appearance settings

The organization's theme policy: which themes members may pick (`allowed_themes`) and which one seeds members who never picked (`default_theme`, `null` = platform default). Ids are built-in slugs or `custom-<uuid>` values.

GET/v1/organization/appearance
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/appearance \
  -H "Authorization: Bearer $CORTEX_TOKEN"
200 OKjson
{
  "default_theme": "custom-9f1c7e2a-0b34-4f88-a1d2-3c4b5a697788",
  "allowed_themes": [
    "cortex",
    "custom-9f1c7e2a-0b34-4f88-a1d2-3c4b5a697788"
  ]
}

Update appearance settings

Replace the theme policy. Every id must be a built-in or one of the organization's custom themes, and `defaultTheme` (when non-null) must be in `allowedThemes`.

PUT/v1/organization/appearance

Request body

NameTypeRequiredDescription
defaultThemestring | nullRequiredTheme id that seeds members without a preference, or `null`.
allowedThemesstring[]Required1–50 theme ids members may pick.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/appearance \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "defaultTheme": "<defaultTheme>",
  "allowedThemes": "<allowedThemes>"
}'

Models

Get model catalog

Get the full AI model catalog. Returns all configured providers grouped with their models (families), each with the versions an organization may select, plus a reference ranking sourced from the Arena.ai leaderboard. A family's `display_name` is the model name; `versions` lists every **active** version of the family — active is what makes a version selectable, and each is offered on its own (`is_latest` marks the family's current `latest_version_id`). A version's `display_name` is the provider's own name for it (e.g. `Claude Opus 4.5`, or a readable form of the id when the provider publishes none) — the label to show when offering the choice. Inactive versions, inactive families and versions with no usable output are omitted. The `selectable` flag on a provider, family or version indicates whether the org can pin it via the model-selections endpoint: a provider is selectable when it has a runtime adapter in the worker AND has a stored API key configured. Providers without a runtime adapter (e.g. Google) are never selectable, and a provider with a runtime adapter but no stored key shows as unselectable until a key is added.

GET/v1/organization/model-catalog
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/model-catalog \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "activities": [
    "base",
    "assistant_text",
    "thinking",
    "voice",
    "image",
    "presentation",
    "spreadsheet_analysis"
  ],
  "providers": [
    {
      "provider_id": "d4e5f6a7-0001-4000-b000-000000000001",
      "provider_name": "Anthropic",
      "provider_slug": "anthropic",
      "selectable": true,
      "families": [
        {
          "family_id": "f1a2b3c4-0001-4000-c000-000000000001",
          "family_name": "Claude Sonnet",
          "display_name": "Claude Sonnet",
          "description": "Best combination of speed and intelligence for high-throughput tasks.",
          "selectable": true,
          "activities": [
            "base",
            "assistant_text",
            "thinking",
            "presentation",
            "spreadsheet_analysis"
          ],
          "latest_version_id": "v1a2b3c4-0001-4000-d000-000000000001",
          "versions": [
            {
              "id": "v1a2b3c4-0001-4000-d000-000000000001",
              "version": "claude-sonnet-4-6",
              "display_name": "Claude Sonnet 4.6",
              "is_latest": true,
              "selectable": true,
              "activities": [
                "base",
                "assistant_text",
                "presentation",
                "title_generation",
                "spreadsheet_analysis",
                "thinking"
              ],
              "supports_thinking": true,
              "supports_tool_use": true,
              "supports_structured_output": true,
              "input_modalities": [
                "text",
                "image"
              ],
              "output_modalities": [
                "text"
              ],
              "context_window": 200000,
              "max_output_tokens": 64000,
              "input_cost_per1m": "3.00",
              "output_cost_per1m": "15.00"
            },
            {
              "id": "v1a2b3c4-0001-4000-d000-000000000003",
              "version": "claude-sonnet-4-5",
              "display_name": "Claude Sonnet 4.5",
              "is_latest": false,
              "selectable": true,
              "activities": [
                "base",
                "assistant_text",
                "presentation",
                "title_generation",
                "spreadsheet_analysis",
                "thinking"
              ],
              "supports_thinking": true,
              "supports_tool_use": true,
              "supports_structured_output": true,
              "input_modalities": [
                "text",
                "image"
              ],
              "output_modalities": [
                "text"
              ],
              "context_window": 200000,
              "max_output_tokens": 64000,
              "input_cost_per1m": "3.00",
              "output_cost_per1m": "15.00"
            }
          ]
        }
      ]
    },
    {
      "provider_id": "d4e5f6a7-0002-4000-b000-000000000001",
      "provider_name": "OpenAI",
      "provider_slug": "openai",
      "selectable": true,
      "families": [
        {
          "family_id": "f1a2b3c4-0002-4000-c000-000000000001",
          "family_name": "GPT",
          "display_name": "GPT",
          "description": "Main frontier GPT model.",
          "selectable": true,
          "activities": [
            "base",
            "assistant_text",
            "thinking",
            "presentation",
            "spreadsheet_analysis"
          ],
          "latest_version_id": "v1a2b3c4-0002-4000-d000-000000000001",
          "versions": [
            {
              "id": "v1a2b3c4-0002-4000-d000-000000000001",
              "version": "gpt-5.5",
              "display_name": "GPT 5.5",
              "is_latest": true,
              "selectable": true,
              "activities": [
                "base",
                "assistant_text",
                "presentation",
                "title_generation",
                "spreadsheet_analysis",
                "thinking"
              ],
              "supports_thinking": true,
              "supports_tool_use": true,
              "supports_structured_output": true,
              "input_modalities": [
                "text",
                "image",
                "documents"
              ],
              "output_modalities": [
                "text"
              ],
              "context_window": 1050000,
              "max_output_tokens": 128000,
              "input_cost_per1m": "0.50",
              "output_cost_per1m": "3.00"
            }
          ]
        }
      ]
    }
  ],
  "arena_providers": [
    {
      "rank": 1,
      "name": "Anthropic",
      "slug": "anthropic",
      "configured": true,
      "selectable": true
    },
    {
      "rank": 2,
      "name": "OpenAI",
      "slug": "openai",
      "configured": true,
      "selectable": true
    },
    {
      "rank": 3,
      "name": "Groq",
      "slug": "groq",
      "configured": false,
      "selectable": false
    },
    {
      "rank": 4,
      "name": "Google",
      "slug": "google",
      "configured": true,
      "selectable": false
    }
  ],
  "source": {
    "name": "Arena.ai Leaderboard",
    "url": "https://arena.ai/leaderboard"
  }
}

List model selections

List the model version the organization has pinned for each activity. `version_id` and `version` are the exact version that runs (its `display_name` is the provider's own name for it); `family_id` and `family_name` name the model it belongs to. Selections made before versions could be pinned resolve to their model's latest version. Activities without an explicit selection are omitted.

GET/v1/organization/model-selections
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/model-selections \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "data": [
    {
      "activity": "assistant_text",
      "family_id": "f1a2b3c4-0001-4000-c000-000000000001",
      "family_name": "Claude Sonnet",
      "display_name": "Claude Sonnet",
      "provider_id": "d4e5f6a7-0001-4000-b000-000000000001",
      "provider_name": "Anthropic",
      "provider_slug": "anthropic",
      "enabled": true,
      "version_id": "v1a2b3c4-0001-4000-d000-000000000001",
      "version": {
        "id": "v1a2b3c4-0001-4000-d000-000000000001",
        "version": "claude-sonnet-4-6",
        "display_name": "Claude Sonnet 4.6"
      }
    },
    {
      "activity": "base",
      "family_id": "f1a2b3c4-0001-4000-c000-000000000002",
      "family_name": "Claude Haiku",
      "display_name": "Claude Haiku",
      "provider_id": "d4e5f6a7-0001-4000-b000-000000000001",
      "provider_name": "Anthropic",
      "provider_slug": "anthropic",
      "enabled": true,
      "version_id": "v1a2b3c4-0001-4000-d000-000000000002",
      "version": {
        "id": "v1a2b3c4-0001-4000-d000-000000000002",
        "version": "claude-haiku-4-5",
        "display_name": "Claude Haiku 4.5"
      }
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Set model selection

Pin an exact model version for a specific activity; the worker runs that version until the selection changes. The activity must be one of the values returned by `get-model-catalog` (`base`, `assistant_text`, `thinking`, `voice`, `image`, `presentation`, `spreadsheet_analysis`, `title_generation`, `embedding`). The version must be active (active is what makes it selectable), belong to an active model of a selectable provider, and support the activity. Returns the updated selection with `version_id` and `version` (the pinned version, with the provider's `display_name` for it) and the `family_id`/`family_name` of the model it belongs to.

PUT/v1/organization/model-selections/:activity

Path parameters

NameTypeRequiredDescription
activitystringRequiredActivity to configure. One of `base`, `assistant_text`, `thinking`, `voice`, `image`, `presentation`, `spreadsheet_analysis`.

Request body

NameTypeRequiredDescription
versionIdstringRequiredUUID of the model version to pin for this activity — one of the `versions[].id` values from `get-model-catalog`.
enabledbooleanOptionalWhether this selection is active. Defaults to `true`.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/model-selections/assistant_text \
  -X PUT \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"version_id":"v1a2b3c4-0001-4000-d000-000000000001"}'

Response codes

StatusMeaningBody
400`VersionNotFound`, `ProviderNotConfigured` (no runtime adapter or stored key), `VersionNotActive` (version or its model inactive), or `VersionDoesNotSupportActivity`.`{ error, code, request_id }`
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "activity": "assistant_text",
  "family_id": "f1a2b3c4-0001-4000-c000-000000000001",
  "family_name": "Claude Sonnet",
  "display_name": "Claude Sonnet",
  "provider_id": "d4e5f6a7-0001-4000-b000-000000000001",
  "provider_name": "Anthropic",
  "provider_slug": "anthropic",
  "enabled": true,
  "version_id": "v1a2b3c4-0001-4000-d000-000000000001",
  "version": {
    "id": "v1a2b3c4-0001-4000-d000-000000000001",
    "version": "claude-sonnet-4-6",
    "display_name": "Claude Sonnet 4.6"
  }
}

System prompts

List system prompts

List every system prompt configured at any scope level (company or department). Each item includes a `scope` discriminator describing where the prompt applies.

GET/v1/organization/system-prompts
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/system-prompts \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "data": [
    {
      "scope": {
        "type": "company"
      },
      "prompt_text": "You are a helpful assistant for Acme Corp. Always respond professionally and concisely.",
      "updated_at": "2026-03-10T09:00:00.000Z"
    },
    {
      "scope": {
        "type": "department",
        "id": "dept-0001-4000-a000-000000000001"
      },
      "prompt_text": "You assist the Sales team. Prioritize lead qualification and pipeline updates.",
      "updated_at": "2026-04-01T11:30:00.000Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Upsert company prompt

Set or replace the company-wide system prompt. Passing an empty string for `promptText` deletes the prompt and returns 204. Otherwise returns the saved prompt.

PUT/v1/organization/system-prompts/company

Request body

NameTypeRequiredDescription
promptTextstringRequiredPrompt text. Max 8000 characters. Pass an empty string to delete the company prompt.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/system-prompts/company \
  -X PUT \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"prompt_text":"example"}'

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "scope": {
    "type": "company"
  },
  "prompt_text": "You are a helpful assistant for Acme Corp. Always respond professionally and concisely.",
  "updated_at": "2026-05-21T10:00:00.000Z"
}

Delete company prompt

Remove the company-level system prompt. Returns 204 whether or not a prompt existed.

DELETE/v1/organization/system-prompts/company
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/system-prompts/company \
  -X DELETE \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
204 No Contenttext

Upsert department prompt

Set or replace a per-department system prompt override. Passing an empty string for `promptText` deletes the override and returns 204. Otherwise returns the saved prompt.

PUT/v1/organization/system-prompts/department/:departmentId

Path parameters

NameTypeRequiredDescription
departmentIdstringRequiredUUID of the department to set the prompt for.

Request body

NameTypeRequiredDescription
promptTextstringRequiredPrompt text. Max 8000 characters. Pass an empty string to delete the department's prompt override.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/system-prompts/department/b2c8d3a1-4567-89ab-cdef-012345678901 \
  -X PUT \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"prompt_text":"example"}'

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "scope": {
    "type": "department",
    "id": "dept-0001-4000-a000-000000000001"
  },
  "prompt_text": "You assist the Sales team. Prioritize lead qualification and pipeline updates.",
  "updated_at": "2026-05-21T10:10:00.000Z"
}

Delete department prompt

Remove a per-department system prompt override. Returns 204 whether or not a prompt existed for this department.

DELETE/v1/organization/system-prompts/department/:departmentId

Path parameters

NameTypeRequiredDescription
departmentIdstringRequiredUUID of the department whose prompt override should be removed.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/system-prompts/department/b2c8d3a1-4567-89ab-cdef-012345678901 \
  -X DELETE \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
204 No Contenttext

Connectors

List connectors

List outbound connectors configured for the organization. Pass `?type=m365` to filter to a single connector type. Secrets are never returned — only public-safe fields are included in each object.

GET/v1/organization/integrations

Query parameters

NameTypeRequiredDescription
typestringOptionalFilter by integration type. Currently supported connector types: `m365`.
Example requestbash
curl "https://api.cortex.cognit-dx.com/v1/organization/integrations?type=example" \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "data": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "organization_id": "f1ba15e0-ebe8-4187-afe6-03ccb25b8815",
      "type": "m365",
      "display_name": "Acme M365",
      "config": {
        "tenant_id": "9188040d-6c67-4c5b-b112-36a304b66dad",
        "client_id": "04b07795-8ddb-461a-bbee-02f9e1bf7b46"
      },
      "status": "connected",
      "last_validated_at": "2026-05-20T09:15:00.000Z",
      "last_error": null,
      "created_at": "2026-03-10T08:00:00.000Z",
      "updated_at": "2026-05-20T09:15:00.000Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Create connector

Connect a new outbound integration. The `config` and `secrets` fields are validated and probed against the external service before the record is saved. Secrets are encrypted at rest and never returned in responses. Returns 201 on success.

POST/v1/organization/integrations

Request body

NameTypeRequiredDescription
typestringRequiredIntegration type. One of: `m365`.
displayNamestringRequiredHuman-readable label for this connector (1–200 characters).
configobjectRequiredKind-specific non-secret configuration. For `m365`: `{ tenantId, clientId }`.
secretsobjectRequiredKind-specific secrets. For `m365`: `{ clientSecret }`. Encrypted at rest; never echoed back.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/integrations \
  -X POST \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"type":"cron","display_name":"Jane Cole","config":{},"secrets":{}}'

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
201 Createdjson
{
  "integration": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "organization_id": "f1ba15e0-ebe8-4187-afe6-03ccb25b8815",
    "type": "m365",
    "display_name": "Acme M365",
    "config": {
      "tenant_id": "9188040d-6c67-4c5b-b112-36a304b66dad",
      "client_id": "04b07795-8ddb-461a-bbee-02f9e1bf7b46"
    },
    "status": "connected",
    "last_validated_at": "2026-05-20T09:15:00.000Z",
    "last_error": null,
    "created_at": "2026-03-10T08:00:00.000Z",
    "updated_at": "2026-05-20T09:15:00.000Z"
  }
}

Get connector

Get a connector by ID. Returns the full integration record minus secrets.

GET/v1/organization/integrations/:integrationId

Path parameters

NameTypeRequiredDescription
integrationIdstringRequiredThe integrationId value from the endpoint path.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/integrations/d4e5f6a7-8901-2345-6789-abcdef012345 \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "integration": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "organization_id": "f1ba15e0-ebe8-4187-afe6-03ccb25b8815",
    "type": "m365",
    "display_name": "Acme M365",
    "config": {
      "tenant_id": "9188040d-6c67-4c5b-b112-36a304b66dad",
      "client_id": "04b07795-8ddb-461a-bbee-02f9e1bf7b46"
    },
    "status": "connected",
    "last_validated_at": "2026-05-20T09:15:00.000Z",
    "last_error": null,
    "created_at": "2026-03-10T08:00:00.000Z",
    "updated_at": "2026-05-20T09:15:00.000Z"
  }
}

Update connector

Update a connector's display name, config, or secrets. All fields are optional; only provided fields are changed. If `config` or `secrets` change, the integration is re-validated and re-probed before saving.

PATCH/v1/organization/integrations/:integrationId

Path parameters

NameTypeRequiredDescription
integrationIdstringRequiredThe integrationId value from the endpoint path.

Request body

NameTypeRequiredDescription
displayNamestringOptionalNew display name (1–200 characters).
configobjectOptionalPartial config update. Merged with existing config.
secretsobjectOptionalPartial secrets update. Merged with existing secrets, re-encrypted.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/integrations/d4e5f6a7-8901-2345-6789-abcdef012345 \
  -X PATCH \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"display_name":"Jane Cole","config":{},"secrets":{}}'

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "integration": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "organization_id": "f1ba15e0-ebe8-4187-afe6-03ccb25b8815",
    "type": "m365",
    "display_name": "Acme M365",
    "config": {
      "tenant_id": "9188040d-6c67-4c5b-b112-36a304b66dad",
      "client_id": "04b07795-8ddb-461a-bbee-02f9e1bf7b46"
    },
    "status": "connected",
    "last_validated_at": "2026-05-20T09:15:00.000Z",
    "last_error": null,
    "created_at": "2026-03-10T08:00:00.000Z",
    "updated_at": "2026-05-20T09:15:00.000Z"
  }
}

Delete connector

Disconnect a connector. Returns 409 if any usage events still reference it. Returns 204 on success.

DELETE/v1/organization/integrations/:integrationId

Path parameters

NameTypeRequiredDescription
integrationIdstringRequiredThe integrationId value from the endpoint path.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/integrations/d4e5f6a7-8901-2345-6789-abcdef012345 \
  -X DELETE \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
204 No Contenttext

Test connector

Re-validate and re-probe a connector's stored credentials against the external service. On success the integration's `status` is set to `connected` and `lastValidatedAt` is refreshed. On probe failure the `status` is set to `error` and `lastError` is populated — the updated record is returned either way.

POST/v1/organization/integrations/:integrationId/test

Path parameters

NameTypeRequiredDescription
integrationIdstringRequiredThe integrationId value from the endpoint path.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/integrations/d4e5f6a7-8901-2345-6789-abcdef012345/test \
  -X POST \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "integration": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "organization_id": "f1ba15e0-ebe8-4187-afe6-03ccb25b8815",
    "type": "m365",
    "display_name": "Acme M365",
    "config": {
      "tenant_id": "9188040d-6c67-4c5b-b112-36a304b66dad",
      "client_id": "04b07795-8ddb-461a-bbee-02f9e1bf7b46"
    },
    "status": "connected",
    "last_validated_at": "2026-05-20T09:15:00.000Z",
    "last_error": null,
    "created_at": "2026-03-10T08:00:00.000Z",
    "updated_at": "2026-05-20T09:15:00.000Z"
  }
}

List connectors

List outbound connectors configured for the caller's organization. Connectors are external services Cortex calls on the org's behalf (e.g. Microsoft 365). Only `id`, `type`, `displayName`, `status`, `lastValidatedAt`, and timestamps are returned — secrets and operator-only config are excluded. Full management lives under Organizations > Integrations.

GET/v1/connectors
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/connectors \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
200 OKjson
{
  "data": [
    {
      "id": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8091",
      "type": "m365",
      "display_name": "Acme Microsoft 365",
      "status": "active",
      "last_validated_at": "2026-05-21T06:00:00.000Z",
      "created_at": "2026-02-14T09:00:00.000Z",
      "updated_at": "2026-05-21T06:00:00.000Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Channels

List channels

List inbound channels configured for the organization. Pass `?type=telegram` to filter to a single channel type. Secrets are never returned — only public-safe fields are included in each object.

GET/v1/organization/integrations

Query parameters

NameTypeRequiredDescription
typestringOptionalFilter by integration type. Currently supported channel types: `telegram`.
Example requestbash
curl "https://api.cortex.cognit-dx.com/v1/organization/integrations?type=example" \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "data": [
    {
      "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "organization_id": "f1ba15e0-ebe8-4187-afe6-03ccb25b8815",
      "type": "telegram",
      "display_name": "Cortex support bot",
      "config": {
        "bot_username": "cortex_support_bot"
      },
      "status": "connected",
      "last_validated_at": "2026-05-20T08:00:00.000Z",
      "last_error": null,
      "created_at": "2026-04-01T12:00:00.000Z",
      "updated_at": "2026-05-20T08:00:00.000Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Create channel

Connect a new inbound channel. The bot token (secret) is validated against Telegram's `getMe` API before the record is saved. On success the `botUsername` is stored in `config`. Secrets are encrypted at rest and never returned. Returns 201 on success.

POST/v1/organization/integrations

Request body

NameTypeRequiredDescription
typestringRequiredIntegration type. One of: `telegram`.
displayNamestringRequiredHuman-readable label for this channel (1–200 characters).
configobjectRequiredKind-specific non-secret configuration. For `telegram`: `{}` (Telegram has no non-secret config fields at creation time; `botUsername` is populated automatically from the probe).
secretsobjectRequiredKind-specific secrets. For `telegram`: `{ botToken }`. Encrypted at rest; never echoed back.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/integrations \
  -X POST \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"type":"cron","display_name":"Jane Cole","config":{},"secrets":{}}'

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
201 Createdjson
{
  "integration": {
    "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "organization_id": "f1ba15e0-ebe8-4187-afe6-03ccb25b8815",
    "type": "telegram",
    "display_name": "Cortex support bot",
    "config": {
      "bot_username": "cortex_support_bot"
    },
    "status": "connected",
    "last_validated_at": "2026-05-20T08:00:00.000Z",
    "last_error": null,
    "created_at": "2026-04-01T12:00:00.000Z",
    "updated_at": "2026-05-20T08:00:00.000Z"
  }
}

Get channel

Get a channel by ID. Returns the full integration record minus secrets.

GET/v1/organization/integrations/:integrationId

Path parameters

NameTypeRequiredDescription
integrationIdstringRequiredThe integrationId value from the endpoint path.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/integrations/d4e5f6a7-8901-2345-6789-abcdef012345 \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "integration": {
    "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "organization_id": "f1ba15e0-ebe8-4187-afe6-03ccb25b8815",
    "type": "telegram",
    "display_name": "Cortex support bot",
    "config": {
      "bot_username": "cortex_support_bot"
    },
    "status": "connected",
    "last_validated_at": "2026-05-20T08:00:00.000Z",
    "last_error": null,
    "created_at": "2026-04-01T12:00:00.000Z",
    "updated_at": "2026-05-20T08:00:00.000Z"
  }
}

Update channel

Update a channel's display name, config, or bot token. All fields are optional; only provided fields are changed. If `secrets` changes, the new bot token is validated against Telegram before saving.

PATCH/v1/organization/integrations/:integrationId

Path parameters

NameTypeRequiredDescription
integrationIdstringRequiredThe integrationId value from the endpoint path.

Request body

NameTypeRequiredDescription
displayNamestringOptionalNew display name (1–200 characters).
configobjectOptionalPartial config update. Merged with existing config.
secretsobjectOptionalPartial secrets update. For `telegram`: `{ botToken }`. Merged with existing secrets, re-encrypted.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/integrations/d4e5f6a7-8901-2345-6789-abcdef012345 \
  -X PATCH \
  -H "Authorization: Bearer $CORTEX_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"display_name":"Jane Cole","config":{},"secrets":{}}'

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "integration": {
    "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "organization_id": "f1ba15e0-ebe8-4187-afe6-03ccb25b8815",
    "type": "telegram",
    "display_name": "Cortex support bot",
    "config": {
      "bot_username": "cortex_support_bot"
    },
    "status": "connected",
    "last_validated_at": "2026-05-20T08:00:00.000Z",
    "last_error": null,
    "created_at": "2026-04-01T12:00:00.000Z",
    "updated_at": "2026-05-20T08:00:00.000Z"
  }
}

Delete channel

Disconnect a channel. Returns 409 if any usage events still reference it. Returns 204 on success.

DELETE/v1/organization/integrations/:integrationId

Path parameters

NameTypeRequiredDescription
integrationIdstringRequiredThe integrationId value from the endpoint path.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/integrations/d4e5f6a7-8901-2345-6789-abcdef012345 \
  -X DELETE \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
204 No Contenttext

Test channel

Re-validate and re-probe a channel's stored bot token against Telegram's `getMe` API. On success the `status` is set to `connected`, `lastValidatedAt` is refreshed, and `config.botUsername` is updated if the bot username changed. On probe failure the `status` is set to `error` and `lastError` is populated — the updated record is returned either way.

POST/v1/organization/integrations/:integrationId/test

Path parameters

NameTypeRequiredDescription
integrationIdstringRequiredThe integrationId value from the endpoint path.
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/organization/integrations/d4e5f6a7-8901-2345-6789-abcdef012345/test \
  -X POST \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
404Resource not found in the caller's organization.`{ error, code, request_id }`
422Request body failed validation.`{ error, code, request_id }`
403Forbidden — caller must be an organization admin.`{ error, code, request_id }`
200 OKjson
{
  "integration": {
    "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "organization_id": "f1ba15e0-ebe8-4187-afe6-03ccb25b8815",
    "type": "telegram",
    "display_name": "Cortex support bot",
    "config": {
      "bot_username": "cortex_support_bot"
    },
    "status": "connected",
    "last_validated_at": "2026-05-20T08:00:00.000Z",
    "last_error": null,
    "created_at": "2026-04-01T12:00:00.000Z",
    "updated_at": "2026-05-20T08:00:00.000Z"
  }
}

List channels

List inbound channels configured for the caller's organization. Channels are surfaces through which end users reach Cortex (e.g. Telegram). Only `id`, `type`, `displayName`, `status`, `lastValidatedAt`, and timestamps are returned — secrets and operator-only config are excluded. Full management lives under Organizations > Integrations.

GET/v1/channels
Example requestbash
curl https://api.cortex.cognit-dx.com/v1/channels \
  -H "Authorization: Bearer $CORTEX_TOKEN"

Response codes

StatusMeaningBody
401Missing or invalid credential.`{ error, code, request_id }`
200 OKjson
{
  "data": [
    {
      "id": "c1a2b3c4-d5e6-4f7a-8b9c-0d1e2f3a4b5c",
      "type": "telegram",
      "display_name": "Cortex support bot",
      "status": "active",
      "last_validated_at": "2026-05-20T08:00:00.000Z",
      "created_at": "2026-03-01T12:00:00.000Z",
      "updated_at": "2026-05-20T08:00:00.000Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}