<!-- © 2026 Evntx FZCO, Dubai, UAE. All rights reserved. -->

# AANCER Developer Reference

Every format, field, limit, API call and error. Copy of aancer.ai/developers

AANCER 1.0.0-rc2.3 · 30 November 2026 · Draft


## Build on AANCER

AANCER is an all-in-one platform for agentic AI that customers run in the cloud or on their own infrastructure. You can extend it without touching its code. Every extension is plain data in a signed file, called a pack. This section shows every format, with JSON Schemas, full examples, the install steps and the errors you may see. It is written so that a developer, or an AI assistant such as ChatGPT, Claude or Gemini, can produce a valid extension from it.

## What you can build

| Build | What it is | Page |
|---|---|---|
| Workflow templates | reusable workflows with typed parameters, deployed from the template gallery | [Templates](/developers/templates) |
| Agents | AI assistants with instructions, tools and limits, shipped as agent blueprints | [Agents](/developers/agents) |
| Skills | reusable instructions that shape how chat and agents work | [Skills](/developers/skills) |
| Themes | colours, fonts, logos, login page and UI wording | [Themes](/developers/themes) |
| Connectors | integrations with external systems, certified and signed by AANCER | [Connectors](/developers/connectors) |
| Dashboards | datasets, semantic models, charts, KPIs, tables and forms | [Dashboards](/developers/dashboards) |
| Hooks | start a workflow or agent when a platform event happens | [Hooks](/developers/hooks) |
| Embedded apps | your own web application inside AANCER, with single sign-on and data access | [Embedded apps](/developers/apps) |
| API and MCP | REST endpoints, and the MCP server for external AI clients | [REST API and MCP](/developers/api) |

## The pack model in one minute

- A **pack** is a ZIP file with the extension `.ancpack`. It holds `MANIFEST.json`, a signature `MANIFEST.sig`, and content files under `content/`.
- The manifest lists **items**. Each item has a `kind` (such as `template`, `skill` or `app`), a `schemaVersion`, an `id` and a `spec`.
- **Parameters** make a pack portable. Write `{{param.target_workspace}}` in a spec, and the administrator picks the workspace when activating the pack.
- You **sign** the pack with your own key using the `aancer-pack` CLI. An administrator adds your public key as a trust key once.
- Installing has three steps: **import** (checks everything, changes nothing), **activate** (installs the items), **retire** (removes them).
- A pack id plus version never changes. To ship a fix, bump the version.

```json
{
  "v": 2,
  "kind": "bundle",
  "id": "acme.business-skills",
  "version": "1.0.0",
  "title": "Acme business skills",
  "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
  "items": [
    { "kind": "skill", "schemaVersion": 1, "id": "vendor-review", "scope": "install", "spec": { "$ref": "content/vendor-review.json" } }
  ]
}
```

Read [Packs](/developers/packs) for the full format.

## Build with your AI assistant

**Ready to use:** open the [AANCER Builder Gem in Gemini](https://gemini.google.com/gem/1-QrMUAZtHW0-ooIxLo6OXNqbvnTuxO0C?usp=sharing). It already knows the developer docs and every schema. Tell it what you want to build.

In Claude, ChatGPT, Cursor or VS Code, connect the [AANCER Builder MCP server](#connect-the-aancer-builder-mcp-server). Or copy this prompt into ChatGPT, Claude or Gemini. Replace the last paragraph with what you want to build.

```text
You are helping me build an extension for the AANCER platform.

Before you write anything:
1. Read https://aancer.ai/dev/llms.txt. It lists every AANCER developer page and schema.
2. Read https://aancer.ai/developers-packs and https://aancer.ai/dev/schemas/pack-manifest.schema.json.
3. Read the page and the JSON Schema for the extension type I need, for example
   https://aancer.ai/developers-templates and https://aancer.ai/dev/schemas/template.schema.json.

Rules:
- Use only fields that appear in the schema. Do not invent fields. Unknown fields are refused.
- Output a folder: manifest.json plus content/<file>.json for each item spec.
- Use "v": 2, "kind": "bundle", a pack id like "<publisher>.<name>", and a strict semver version.
- Never put real ids of an installation (connections, knowledge sets, workspaces, approvers) into a spec.
  Use pack parameters ({{param.<id>}}) or template parameters with bindings instead.
- Never put keys, tokens or passwords into any file.
- Check every limit in the field tables (lengths, counts, allowed values).
- After the files, list the commands to sign the pack with the aancer-pack CLI and the steps to
  import and activate it in a test installation.

What I want to build:
<describe it here, for example: "A workflow template that takes a support e-mail, classifies it
with a local model, asks a team lead to approve the reply, then sends it.">
```

Tips for good results:

- Name the extension type. "A workflow template", "an agent blueprint" and "an embedded app" lead to different formats.
- Paste back the exact import error if there is one. Every page has a "Common errors" table the assistant can use.
- Ask the assistant to validate each file against the JSON Schema before it answers.

## Connect the AANCER Builder MCP server

Your assistant can also use AANCER's public builder server directly. It reads the docs, the schemas and the examples, and it checks a pack before you sign it. It is read-only and needs no account.

- Endpoint: `https://aancer.ai/mcp` (Streamable HTTP, no authentication)
- Tools: `list_extension_types`, `get_docs`, `get_schema`, `get_example`, `validate_pack`, `search_docs`
- Prompt: `build_extension` walks the assistant through docs, schema, example, files and validation

| Client | How to connect |
|---|---|
| Claude (web and desktop) | Settings, Connectors, add a custom connector with the URL `https://aancer.ai/mcp` |
| Claude Code | `claude mcp add --transport http aancer-builder https://aancer.ai/mcp` |
| ChatGPT | Turn on developer mode for connectors, then create a connector with the URL `https://aancer.ai/mcp` and no authentication |
| Gemini CLI | Add `"aancer-builder": {"httpUrl": "https://aancer.ai/mcp"}` under `mcpServers` in `~/.gemini/settings.json` |
| Cursor, VS Code and other MCP clients | Add an HTTP server named `aancer-builder` with the URL `https://aancer.ai/mcp` |

Then ask, for example: "Use the AANCER builder tools to make a workflow template that triages supplier invoices with a human approval, and validate it."

`validate_pack` checks the published schemas and the pack structure. Your installation runs further checks on import: the signature, licence features and references to items that exist there.

## JSON Schemas

| Schema | Covers |
|---|---|
| [pack-manifest.schema.json](https://aancer.ai/dev/schemas/pack-manifest.schema.json) | the pack manifest |
| [template.schema.json](https://aancer.ai/dev/schemas/template.schema.json) | `template` item spec |
| [agent.schema.json](https://aancer.ai/dev/schemas/agent.schema.json) | `agent-blueprint` item spec, plus the REST agent configuration |
| [skill.schema.json](https://aancer.ai/dev/schemas/skill.schema.json) | `skill` item spec |
| [theme.schema.json](https://aancer.ai/dev/schemas/theme.schema.json) | `theme` item spec, plus `locale` |
| [connector.schema.json](https://aancer.ai/dev/schemas/connector.schema.json) | `connector` item spec |
| [dashboard.schema.json](https://aancer.ai/dev/schemas/dashboard.schema.json) | `dataset`, `model`, `widget` and `dashboard` item specs |
| [hook.schema.json](https://aancer.ai/dev/schemas/hook.schema.json) | `hook` item spec |
| [app.schema.json](https://aancer.ai/dev/schemas/app.schema.json) | `app` item spec, plus `link` and `card` |

All schemas use JSON Schema draft 2020-12.

## Examples

The [AANCER developers repository on GitHub](https://github.com/Aancer-ai/aancer-developers) holds a complete, valid pack for every type: two workflow templates, two agent blueprints, a skill, a theme, a connector source folder, a sales dashboard, a hook and two embedded apps with working app code. The examples and schemas are MIT licensed. The AANCER platform itself is proprietary.

## Developer edition

The developer edition is AANCER for building and testing on your own machine. It installs with one command, runs in a slim profile on a laptop with 16 GB of memory, and is ready on first run: the APIs answer without any click-through first.

```bash
bash install.sh --dev     # Docker Compose; add --dev-model 1.5b, 3b or 7b to pick the built-in model
bash setup.sh --dev       # Kubernetes
```

Coming in this release:

- `bash install.sh --dev --full` (Kubernetes: `bash setup.sh --dev --full`) also turns on the safety scanner and context compression. It needs the standard package, because the developer package leaves those images out, and about 8.4 GB of memory, so plan for 16 GB.
- `bash install.sh --dev --llm-url <address> [--llm-model <id>]` chats on your own OpenAI-compatible model server instead of the built-in model, which is then not downloaded. The address must be http or https, without credentials, on your own machine or private network, and the server must answer `<address>/models`. A cloud model or a server that needs an API key goes under **Admin > Models** instead. On Kubernetes, use an address the cluster can reach, not localhost.

### Developer licence

Without a licence the developer edition runs for one user. Activate the free developer licence for up to 3 users: it unlocks every feature for 90 days, and it is renewed free of charge. It runs on the developer edition only, and every screen shows a "not for production" banner. Seats are counted as on every other licence.

1. Copy your installation's fingerprint from the licence page and [ask for a developer licence](/developers-licence) for it.
2. Activate it on the licence page.
3. Give the automation runner the same licence: `AANCER_DEV_LICENSE` in `.env` on Docker, `--set devLicense=...` on Kubernetes.

### Your own signed connectors

On the developer edition you sign connector packs with your own developer key. Add its public key under **Extensions > Trust keys** and tick **developer key**, or let `aancer-pack dev --trust-key-on-target` do it. They install only on your installation: the pack is bound to its install id, and both the gateway and the connector runner check it. Remove the key and those connectors stop. Every other edition installs only connector packs signed by AANCER. See [Connectors](/developers/connectors).

## Tools

- **aancer-pack CLI**: a compiled binary for Linux, macOS and Windows that scaffolds, lints, signs and test-runs packs, and gives every pack a unique build id. Available to partners and builders on request: [contact us](https://aancer.ai/contact). Coming in this release: `aancer-pack login --browser` for signing in through your installation's sign-in page, including single sign-on, and `aancer-pack doctor`, which checks the container runtime, memory, disk, port and model and prints one `fix:` line per problem. See [Packs](/developers/packs#the-aancer-pack-cli).
- **AANCER Builder MCP server** at `https://aancer.ai/mcp`: `validate_pack` checks a pack against the schemas before you sign it. See [Connect the AANCER Builder MCP server](#connect-the-aancer-builder-mcp-server).
- **A developer installation**: run the developer edition on your laptop (see [Developer edition](#developer-edition)), or import your pack into an EVAL or test installation. Import checks everything and installs nothing until you activate. [Start a free EVAL](https://aancer.ai/contact?intent=eval).

## Start here

1. Read [Packs](/developers/packs).
2. Pick your type from the table above and copy its Quick start.
3. Sign with `aancer-pack`, import into a test installation, read the summary, activate.
4. Partners who want to publish in the certified catalog add `listing` and `declarations` and run `aancer-pack lint`. See the [partner programme](https://aancer.ai/partners).

## Limits and editions

Each page lists the limits for its type and any licence feature it needs, such as Embedded apps, Certified Agents or the MCP server. Check your edition on [aancer.ai/pricing](https://aancer.ai/pricing).



## Developer licence

The developer licence is free. It unlocks every feature for 3 users for 90 days and is renewed free of charge. It runs on the developer edition only, and every screen shows a "not for production" banner.

## Before you ask

1. Install the developer edition: `bash install.sh --dev` (Kubernetes: `bash setup.sh --dev`). See [Developer edition](/developers#developer-edition).
2. Open the licence page of your installation and copy its **fingerprint**. The licence is issued for that installation.

## After you receive it

1. Activate the licence on the licence page.
2. Give the automation runner the same licence: `AANCER_DEV_LICENSE` in `.env` on Docker, `--set devLicense=...` on Kubernetes.

For a production licence or a free EVAL of the full platform, use the [contact page](https://aancer.ai/contact) instead.

## Request form



## Extension packs

Every AANCER extension travels in one file format: the signed extension pack, file extension `.ancpack`. A pack is a ZIP archive with a manifest, a signature and optional content files. One pack can carry one item or many: templates, agents, skills, themes, dashboards, hooks, embedded apps, links and more. The installation checks the signature and the hash of every file before it trusts anything. A pack then goes through three steps: **import** (verify and stage), **activate** (bind parameters and install the items) and **retire** (uninstall). The same file works for an upload in the admin screen, the REST API, an offline server folder and the certified catalog.

## Quick start

The smallest useful pack holds one skill.

```text
my-pack/
  manifest.json
  content/
    vendor-review.json
```

`manifest.json`:

```json
{
  "v": 2,
  "kind": "bundle",
  "id": "acme.business-skills",
  "version": "1.0.0",
  "title": "Acme business skills",
  "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
  "requires": { "platform": ">=1.0.0" },
  "items": [
    {
      "kind": "skill",
      "schemaVersion": 1,
      "id": "vendor-review",
      "scope": "install",
      "spec": { "$ref": "content/vendor-review.json" }
    }
  ]
}
```

`content/vendor-review.json` is a skill spec (see [Skills](/developers/skills)). Sign it and import it:

```bash
aancer-pack keygen --out acme.key
aancer-pack sign manifest.json content/ -o acme.business-skills-1.0.0.ancpack --key acme.key
aancer-pack verify acme.business-skills-1.0.0.ancpack --pubkey acme.pub
```

Then an administrator adds your public key under **Platform Settings > Extensions > Trust keys** and imports the file with **Import pack**.

## File layout

What you write (the input to `aancer-pack sign`):

```text
my-pack/
  manifest.json            # the manifest; items point at content files with {"$ref": "content/<file>.json"}
  content/
    <item>.json            # one JSON object per item spec (or put the spec inline in manifest.json)
    logos/logo.png         # binary assets, only the allowed media types
```

What the installation reads (the signed archive):

```text
MANIFEST.json   # your manifest in signing form: every $ref gets a "$hash", binaries are listed in "assets"
MANIFEST.sig    # base64url Ed25519 signature over the canonical JSON of MANIFEST.json
content/...     # every file must be referenced by an item ($ref) or listed in assets
```

Rules for the archive:

- `MANIFEST.json` must be at the root.
- `MANIFEST.sig` must be present and not empty.
- Every other file must live under `content/`. No `..`, no backslashes in names.
- Every file under `content/` must be referenced by an item `$ref` or listed in `assets`. An extra file makes the whole pack fail the signature check.
- A `$ref` file must contain a JSON object.
- Use stored or deflate compression only. No encrypted entries.

## Field reference

JSON Schema: [pack-manifest.schema.json](https://aancer.ai/dev/schemas/pack-manifest.schema.json)

### Manifest

| Field | Type | Required | Rules |
|---|---|---|---|
| `v` | integer | yes | must be `2` |
| `kind` | string | yes | must be `"bundle"` |
| `id` | string | yes | `^[a-z0-9][a-z0-9._-]{2,63}$`. Use `<publisher>.<name>`, for example `acme.invoice-desk` |
| `version` | string | yes | strict semver: `MAJOR.MINOR.PATCH`, optional `-pre`. No `+build` part |
| `title` | string | no | shown in the admin screen. Required (1 to 120 characters) when `listing` is present |
| `publisher` | object | no | `{ "name": "...", "keyId": "..." }`. `keyId` names the key that signed the pack |
| `requires.platform` | string | no | `>=X.Y.Z`, optionally followed by ` <X.Y.Z` |
| `requires.points` | object | no | map of kind to schema version, for example `{"skill": "1"}`. Informational |
| `parameters` | array | no | values the administrator fills in at activation. See Parameters |
| `assets` | array | no | binary files with their hashes. `aancer-pack sign` writes this for you |
| `items` | array | yes | 1 to 256 items. See Items |
| `listing` | object | no | catalog listing. Needed for a certified catalog submission |
| `declarations` | object | no | licence, data flows, network access, AI use. Needed for a certified catalog submission |
| `certification` | object | no | added by AANCER certification. Never write it yourself |

### Items

| Field | Type | Required | Rules |
|---|---|---|---|
| `kind` | string | yes | one of `theme`, `locale`, `dataset`, `model`, `widget`, `dashboard`, `hook`, `app`, `link`, `card`, `skill`, `connector`, `template`, `agent-blueprint` |
| `schemaVersion` | integer | yes | the item format version. See the table below |
| `id` | string | yes | `^[a-z0-9][a-z0-9._-]{0,63}$`, unique within the pack |
| `scope` | string | no | `install` (default) or `workspace`. `agent-blueprint` and `connector` must be `install` |
| `workspace` | string | if scope is `workspace` | a workspace id or `{{param.<id>}}`. Not allowed with `install` scope |
| `spec` | object | yes | the item spec inline, or `{"$ref": "content/<file>.json"}` |

Supported schema versions:

| Kind | Versions | Page |
|---|---|---|
| `template` | 1 | [Templates](/developers/templates) |
| `agent-blueprint` | 1 | [Agents](/developers/agents) |
| `skill` | 1 | [Skills](/developers/skills) |
| `theme` | 2 (1 for simple branding) | [Themes](/developers/themes) |
| `locale` | 1 | [Themes](/developers/themes) |
| `connector` | 1 | [Connectors](/developers/connectors) |
| `dataset`, `model`, `widget`, `dashboard` | 1 | [Dashboards](/developers/dashboards) |
| `hook` | 1 | [Hooks](/developers/hooks) |
| `app` | 2 | [Embedded apps](/developers/apps) |
| `link`, `card` | 1 | [Embedded apps](/developers/apps) |

An item with a schema version that the installation does not support is staged as `unsupported`. It is not an error, but nothing is installed. `GET /api/extensions/schemas` returns the table for a given installation.

### Parameters

Parameters let one pack work in any installation. The administrator binds them at activation.

| Field | Type | Required | Rules |
|---|---|---|---|
| `id` | string | yes | `^[a-z][a-z0-9_]{0,63}$`, unique |
| `type` | string | yes | `connection`, `workspace`, `dataset`, `string`, `secret`, `workflow`, `agent` |
| `label` | string | no | shown in the activation dialog |
| `required` | boolean | no | default `true` |
| `connector` | string | no | for `connection`: the connector the connection must belong to |
| `default` | any | no | used when no value is sent and none was bound before |

Reference a parameter as the whole string `{{param.<id>}}` anywhere in a spec or in an item's `workspace`. Every referenced parameter must be declared. At activation every value is a string. A `workspace` value must name an existing workspace. A `connection` value must name an existing connection. A `secret` is stored encrypted.

### Assets

| Field | Type | Rules |
|---|---|---|
| `path` | string | starts with `content/`, no `..` |
| `sha256` | string | 64 lower-case hex characters |
| `contentType` | string | `font/woff2`, `image/png`, `image/svg+xml`, `image/jpeg`, `image/x-icon`. `application/x-tar` only as the `archive` of a connector item |

`aancer-pack sign` lists every binary file for you. Each asset is at most 4 MiB. A connector archive is at most 96 MiB.

### Catalog blocks

You only need `listing` and `declarations` to submit a pack to the certified catalog. When they are present they are checked strictly and unknown fields are refused.

`listing`:

| Field | Rules |
|---|---|
| `v` | `1` |
| `summary` | required, 1 to 280 characters |
| `description` | plain text, at most 4000 characters |
| `category` | required. One of `operations`, `finance`, `hr`, `legal`, `sales`, `marketing`, `customer-service`, `it`, `devops`, `security`, `compliance`, `procurement`, `manufacturing`, `healthcare`, `retail`, `education`, `public-sector`, `productivity`, `analytics`, `other` |
| `tags` | at most 8, each `^[a-z0-9][a-z0-9-]{0,31}$` |
| `icon` | path of an image listed in `assets` |
| `screenshots` | at most 5 image paths listed in `assets` |
| `releaseNotes` | at most 4000 characters |
| `supportUrl` | https URL, at most 300 characters, no credentials |
| `locales` | keys `en`, `de`, `es`, `ar`; each `{ title?, summary?, description? }` |

`declarations`:

| Field | Rules |
|---|---|
| `v` | `1` |
| `licence` | one of `0BSD`, `AGPL-3.0-only`, `AGPL-3.0-or-later`, `Apache-2.0`, `BSD-2-Clause`, `BSD-3-Clause`, `BSL-1.0`, `CC-BY-4.0`, `CC-BY-SA-4.0`, `CC0-1.0`, `EPL-2.0`, `EUPL-1.2`, `GPL-2.0-only`, `GPL-2.0-or-later`, `GPL-3.0-only`, `GPL-3.0-or-later`, `ISC`, `LGPL-2.1-only`, `LGPL-2.1-or-later`, `LGPL-3.0-only`, `LGPL-3.0-or-later`, `MIT`, `MIT-0`, `MPL-2.0`, `OFL-1.1`, `Unlicense`, `Zlib`, or `LicenseRef-<name>` (`<name>`: 1 to 64 letters, digits, `.` or `-`) |
| `thirdParty` | at most 256 of `{ name, licence }`. `licence` follows the same rule |
| `egress` | at most 64 of `{ host, port, purpose }`. `host` is a lower-case DNS name, no wildcard, no IP address |
| `dataFlows` | at most 32 of `{ purpose, data[], personalData, destination, host? }`. `destination` is `installation`, `external` or `web-search`. An `external` flow names a `host` that is also listed in `egress` |
| `aiUse` | `{ intendedPurpose (1 to 500), annexIII (boolean), humanOversight (1 to 120) }` |
| `attestations` | `{ "ownsRights": true, "noProhibitedPractice": true }`. Both must be `true` |

### Pack id rules for the catalog

A catalog pack id is `<publisherId>.<name>`. `publisherId` matches `^[a-z0-9][a-z0-9-]{2,31}$`. These prefixes are reserved and cannot be used: anything starting with `aancer`, plus `platform`, `system`, `test`, `install`, `inst`, `pack`, `v1`, `template`, `solution`, `dashboard`, `export`, `conn`.

## Full examples

### A pack for the certified catalog

```json
{
  "v": 2,
  "kind": "bundle",
  "id": "acme.invoice-triage",
  "version": "1.0.0",
  "title": "Invoice triage",
  "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
  "requires": { "platform": ">=1.0.0" },
  "listing": {
    "v": 1,
    "summary": "Sorts incoming invoices and drafts the booking proposal.",
    "description": "Plain text, up to 4000 characters.",
    "category": "finance",
    "tags": ["invoices", "accounts-payable"],
    "icon": "content/listing/icon.png",
    "releaseNotes": "First release.",
    "supportUrl": "https://support.example.com/invoice-triage",
    "locales": {
      "de": { "title": "Rechnungssortierung", "summary": "Sortiert eingehende Rechnungen und entwirft den Buchungsvorschlag." }
    }
  },
  "declarations": {
    "v": 1,
    "licence": "LicenseRef-Acme-Commercial",
    "thirdParty": [{ "name": "amount-parser", "licence": "MIT" }],
    "dataFlows": [
      { "purpose": "Read invoice documents to extract amounts", "data": ["invoice-documents"], "personalData": true, "destination": "installation" },
      { "purpose": "Open the help page in the browser", "data": ["none"], "personalData": false, "destination": "external", "host": "support.example.com" }
    ],
    "egress": [{ "host": "support.example.com", "port": 443, "purpose": "Help page opened by the user" }],
    "aiUse": { "intendedPurpose": "Drafts a booking proposal a person approves", "annexIII": false, "humanOversight": "approval-step" },
    "attestations": { "ownsRights": true, "noProhibitedPractice": true }
  },
  "items": [
    { "kind": "skill", "schemaVersion": 1, "id": "invoice-triage", "scope": "install", "spec": { "$ref": "content/skill.json" } },
    { "kind": "link", "schemaVersion": 1, "id": "triage-help", "scope": "install",
      "spec": { "id": "triage-help", "label": "Invoice triage help", "url": "https://support.example.com/invoice-triage", "icon": "ExternalLink", "order": 90, "openIn": "new-tab" } }
  ]
}
```

`content/listing/icon.png` must be in the folder you sign. The signer adds it to `assets`.

### A workspace pack with parameters

```json
{
  "v": 2,
  "kind": "bundle",
  "id": "acme.sales-dashboard",
  "version": "1.2.0",
  "title": "Sales overview",
  "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
  "requires": { "platform": ">=1.0.0" },
  "parameters": [
    { "id": "target_workspace", "type": "workspace", "label": "Workspace", "required": true }
  ],
  "items": [
    { "kind": "dataset", "schemaVersion": 1, "id": "sales_orders", "scope": "workspace",
      "workspace": "{{param.target_workspace}}", "spec": { "$ref": "content/dataset.sales_orders.json" } },
    { "kind": "dashboard", "schemaVersion": 1, "id": "sales-overview", "scope": "workspace",
      "workspace": "{{param.target_workspace}}", "spec": { "$ref": "content/dashboard.sales-overview.json" } }
  ]
}
```

## Signing

### The aancer-pack CLI

The `aancer-pack` CLI is a compiled binary for Linux (x64, arm64), macOS (Apple silicon, Intel) and Windows (x64). It needs no other runtime. Each download comes with its licence notices, SHA256 checksums and a signature. It is available to partners and builders on request: [contact us](https://aancer.ai/contact).

| Command | What it does |
|---|---|
| `aancer-pack init <kind> [dir] [--id <pack id>] [--publisher <name>]` | scaffolds a new pack. Kinds: `skill`, `agent-blueprint`, `template`, `connector` |
| `aancer-pack keygen --out acme.key` | makes an Ed25519 key pair (`acme.key`, `acme.pub`) and prints your key id `pub-<12 hex>`. Never overwrites a key |
| `aancer-pack lint manifest.json content/` or `aancer-pack lint <file>.ancpack` | checks catalog readiness, prints one `<path>: <what to change>` line per problem. Add `--json` for machine-readable output |
| `aancer-pack sign manifest.json content/ -o <file>.ancpack --key acme.key` | builds the signing form, zips and signs. This is the step that makes the `.ancpack`, with a unique build id |
| `aancer-pack verify <file>.ancpack --pubkey acme.pub [--publisher-pubkey acme.pub]` | checks the signature, prints OK. `--publisher-pubkey` also checks the publisher signature of a certified pack |
| `aancer-pack inspect <file>.ancpack` | shows id, version, items and content hash |
| `aancer-pack validate <file>.ancpack --remote <url>` (coming in this release) | runs your installation's import checks without installing, using your `aancer-pack login` session. Exit `0` valid, `2` refused |
| `aancer-pack connector check [dir] [--json]` | checks a connector project |
| `aancer-pack connector run <action or trigger> [dir] [--props <file>] [--auth <file>] [--payload <file>]` | runs one action or trigger of your connector locally |
| `aancer-pack login --target <url> [--email <address>]` | signs in to your installation with a password |
| `aancer-pack login --target <url> --browser` (or `--sso`; coming in this release) | signs in through your installation's own sign-in page in the browser, including single sign-on. Prints the address if no browser opens; times out after 5 minutes. The session lasts at most 1 hour and is kept in the macOS keychain or the Linux secret service, otherwise in a file only you can read |
| `aancer-pack dev [dir] --target <url> [--params <file.json>] [--watch] [--trust-key-on-target]` | signs with your developer key and installs on your developer edition, again on every save with `--watch` |
| `aancer-pack trust-key --print` | prints your developer public key, to add under **Extensions > Trust keys** |
| `aancer-pack telemetry status` | shows the CLI's developer-tool telemetry setting. Telemetry covers the CLI only |
| `aancer-pack --version` | prints the version |

Coming in this release: `aancer-pack doctor [--json]` checks the container runtime, memory (8 GB, or 12 GB with `--full`), free disk (10 GB), the port and the model. It prints one `fix:` line per problem and exits `1` if it finds any.

Exit codes: `0` ok, `2` invalid input or usage, `3` signature or verification refused.

`lint` also demands `publisher.name` (1 to the name limit) and a `publisher.keyId` in one of the forms `pub-<12 hex>`, `inst-<12 hex>` or `install`.

Put the `pub-<12 hex>` id that `keygen` prints into `publisher.keyId`. Keep the `.key` file private. Share only the `.pub` file.

### What gets signed

You do not need this if you use the CLI. It is here so you can check a pack by hand.

1. Start from `manifest.json`.
2. Replace every `{"$ref": "content/x.json"}` with `{"$ref": "content/x.json", "$hash": "sha256:<hex of the file bytes>"}`.
3. Add `assets` with the sha256 of every binary file under `content/`.
4. Remove any `sig` or `signature` field.
5. Serialise as canonical JSON: object keys sorted at every level, compact separators, arrays in order, no non-finite numbers.
6. Sign those bytes with Ed25519. Write the base64url signature to `MANIFEST.sig`, and the signing form to `MANIFEST.json`.

### Who may sign

An installation accepts a pack when one of these keys verifies it:

1. the AANCER platform key;
2. the installation's own export key (`inst-<12 hex>`), for templates, agents and dashboards exported from that installation;
3. a partner key that an administrator added under **Platform Settings > Extensions > Trust keys**. The manifest's `publisher.keyId` must equal the key id the administrator entered.

A pack signed by the installation's own key always verifies with that key and is not affected by catalog withdrawals. A pack whose signer is known but whose signature does not match is refused with `PACK_SIGNATURE_INVALID`.

Connector packs are accepted only with the AANCER platform key. Partners submit connectors for certification and AANCER signs them. See [Connectors](/developers/connectors).

## Install and test

To test a pack, import it into an EVAL or test installation. Import is installation-wide: it checks everything and installs nothing. Only activation changes the installation. A pack that contains workflow templates also passes the template permission check on activate and rollback.

### In the UI

1. **Platform Settings > Extensions > Trust keys > Add trust key**. Paste your public key. Use your `publisher.keyId` as the key id.
2. **Import pack**. The summary lists items, parameters and warnings.
3. **Activate**. Fill in the parameters.
4. Later: **Roll back** to an older version, or **Retire** to uninstall.

Importing needs the `extensions.manage` permission. Activating a pack whose items are all workspace-scoped and target workspaces you manage also works with `extensions.manage_own`.

### With the REST API

```bash
# 1. add the trust key (once per publisher)
curl -X POST https://aancer.example.com/api/extensions/trust-keys \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"keyId":"pub-0123456789ab","label":"Acme Example Ltd","publicKeyPem":"-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"}'

# 2. import (raw bytes as the body)
curl -X POST https://aancer.example.com/api/extensions/packs/import \
  -H "Authorization: Bearer $TOKEN" \
  --data-binary @acme.sales-dashboard-1.2.0.ancpack

# 3. activate with parameter values
curl -X POST https://aancer.example.com/api/extensions/packs/acme.sales-dashboard/activate \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"version":"1.2.0","parameters":{"target_workspace":"ws-sales"}}'
```

| Call | What it does |
|---|---|
| `POST /api/extensions/packs/import` | raw `.ancpack` bytes, optionally `?activate=1`. Returns `201` (new) or `200` with a summary: items, parameters, warnings, `upgradeFrom`, and when relevant `certification`, `revocation`, `keptBehind` |
| `POST /api/extensions/packs/{packId}/activate` | `{ "version": "...", "parameters": { "<id>": "<value>" } }`. A `null` value unbinds an optional parameter |
| `POST /api/extensions/packs/{packId}/rollback` | `{ "version": "..." }` |
| `POST /api/extensions/packs/{packId}/retire` | uninstall |
| `GET /api/extensions/packs`, `GET /api/extensions/packs/{packId}` | list and detail |
| `GET /api/extensions/objects` | installed objects, filter by `kind`, `workspaceId`, `state`, `packId` |
| `GET /api/extensions/schemas` | supported kinds and schema versions |
| `GET /api/extensions/trust-keys` | list trust keys |
| `POST /api/extensions/trust-keys` | add a key, answers `201` |
| `DELETE /api/extensions/trust-keys/{keyId}` | remove a key, answers `204` |

### The certified catalog in your installation

Certified packs are listed in the installation's catalog. An administrator opens a listing and chooses **Get** to import it; a newer certified version shows **Update available**. The installation receives the catalog over its catalog channel. Installations without direct internet access upload the signed catalog file (`catalog-snapshot.json`) by hand, or point the channel at a mirror in their own network.

| Call | Permission | What it does |
|---|---|---|
| `GET /api/marketplace/certified/status` | `marketplace.view` | channel status and last refresh |
| `PUT /api/marketplace/certified/settings` | `extensions.manage` | catalog channel settings |
| `POST /api/marketplace/certified/refresh` | `extensions.manage` | fetch the catalog now |
| `POST /api/marketplace/certified/snapshot` | `extensions.manage` | upload a catalog file (raw body, up to 8 MiB) |
| `GET /api/marketplace/certified/items`, `/items/{packId}`, `/facets` | `marketplace.view` | browse listings, kinds and available updates |
| `POST /api/marketplace/certified/items/{packId}/get` | `marketplace.import_pack` | import a listed pack |

### Withdrawn versions

AANCER can withdraw a certified pack version, for example after a security finding, and names the version that fixes it. A withdrawn version is no longer imported (`PACK_REVOKED`). For a critical withdrawal the installation stops the installed version (a forced stop); otherwise the version is flagged for the administrator. Where the installation allows it, an administrator can record a decision to keep a withdrawn version running, with a reason, and end that decision later:

| Call | Body |
|---|---|
| `POST /api/extensions/packs/{packId}/revocation-override` | `{ version, reason }` |
| `DELETE /api/extensions/packs/{packId}/revocation-override` | `{ version }` |

Both need `extensions.manage`. Activating a newer version ends the decision for older ones.

### Offline install

An operator can drop `.ancpack` files into the installation's packs folder. Every file is imported at start. A pack is activated when every required parameter has a value in `packs.env`, written as `PACK_<pack id with non-alphanumerics as _>__<param>=value`. For example `PACK_acme_sales_dashboard__target_workspace=ws-sales`. Administrators can rescan the folder with **Scan server folder**.

### Versions

A pack id plus version is permanent. Importing the same version again with the same content does nothing. Importing it with different content fails: bump the version. Activating a newer version replaces the older one. With equal `MAJOR.MINOR.PATCH`, a pre-release such as `1.2.0-rc1` is older than `1.2.0`.

## Common errors

| Code | Status | Message | Fix |
|---|---|---|---|
| `PACK_UNSIGNED` | 422 | This pack is not signed (MANIFEST.sig is missing). | Sign it with `aancer-pack sign` |
| `PACK_MALFORMED` | 400 | The pack could not be read. / MANIFEST.json is missing | Rebuild the ZIP with the CLI |
| `PACK_SIGNATURE_INVALID` | 400 | This pack could not be verified, the signature is invalid. | A file changed after signing, a file under `content/` is not referenced or listed, or `publisher.keyId` names another key. Re-sign after every change |
| `PACK_SIGNER_UNKNOWN` | 422 | This pack was signed by an unknown key (pub-...). Add the publisher's key under Extensions > Trust keys first. | The administrator adds your public key with the same key id |
| `PACK_SIGNER_NOT_ALLOWED` | 403 | Connector packs must be signed by the platform key. | Submit connectors for certification |
| `PACK_SCHEMA_INVALID` | 422 | The pack failed validation: `<path>: <message>` | Fix the field at the path. Item errors use `/items/<itemId>/spec/...` |
| `PACK_SCHEMA_INVALID` | 422 | `/parameters: parameter 'x' is referenced but not declared` | Declare it in `parameters` |
| `PACK_SCHEMA_INVALID` | 422 | `/items/0/scope: agent-blueprint items are install-scoped` | Use `"scope": "install"` |
| `PACK_SCHEMA_INVALID` | 422 | `/items/0/workspace: required for workspace scope` | Add `workspace` or use install scope |
| `PACK_SCHEMA_INVALID` | 422 | `/version: must be strict semver` | Use `1.0.0`, not `1.0` or `v1.0.0` |
| `PACK_SCHEMA_INVALID` | 422 | the unzipped content is larger than the limit | Keep the unzipped content under 32 MiB (128 MiB for a connector pack) |
| `EXTENSION_KIND_UNKNOWN` | 422 | This platform does not know the extension kind '...'. | Use a kind from the table above |
| `PACK_PLATFORM_INCOMPATIBLE` | 422 | This pack needs platform version ...; this installation runs ... | Lower `requires.platform`, or the installation upgrades |
| `PACK_VERSION_CONFLICT` | 409 | Pack ... is already imported with different content. Bump the version. | Bump `version` |
| `PACK_TOO_LARGE` | 413 | This file is larger than the ... MB limit for one pack on this installation. | Applies to the file size only: keep the file under 64 MiB |
| `PACK_PARAMETER_MISSING` | 422 | Required parameters are missing: ... | Send them at activation, or set `"required": false` |
| `PACK_PARAMETER_INVALID` | 422 | Parameter values are invalid: ... | Send existing ids as strings |
| `EXTENSION_REFERENCED` | 409 | Other active extensions still reference objects in this pack: ... | Remove the dependants first |
| `PACK_REVOKED` | 403 | This pack version was withdrawn by the platform (...). | Install the version named in the message |
| `PACK_LICENCE_REQUIRED` | 403 | This connector pack needs an active licence. | Activate the licence, then import again |
| `PACK_LICENCE_MISMATCH` | 403 | This connector pack was issued for a different licence. | Ask for a pack issued to this installation |
| `PACK_CONTENT_FORBIDDEN` | 422 | The connector archive contains forbidden content: ... | Remove the named files |
| `PACK_PIECE_NAME_TAKEN` | 409 | A connector named ... is already installed on this platform. | Use another package name |
| `EXTENSION_NOT_FOUND` | 404 | ... not found. | Check the pack id or object id |
| `PACK_NOT_REVOKED` | 409 | This pack version is not withdrawn with a forced stop, so there is nothing to keep running. | Only for versions stopped by a withdrawal |
| `PACK_REVOCATION_OVERRIDE_FORBIDDEN` | 403 | This installation does not allow a withdrawn pack to keep running. | Install the fixed version |

`aancer-pack lint` adds catalog checks, for example "a submission needs a listing block", "a submission must not carry a certification block" and "pack id must be '<publisher id>.<name>'".

## Limits and editions

- Pack file: 64 MiB by default. The operator can change it.
- Unzipped content: 32 MiB per pack, 128 MiB for a pack with a connector. Each asset: 4 MiB; a connector archive (`application/x-tar`): 96 MiB. Items: 256 per pack.
- Importing and activating packs is controlled by permissions (`extensions.manage`, `extensions.manage_own`).
- Some item kinds need a licence feature: embedded apps, certified agents and licensed connectors. Each page says so.
- Check your edition on [aancer.ai/pricing](https://aancer.ai/pricing).



## Skills

A skill is a named block of instructions, with optional reference files and preferred connectors, that changes how the AI works in chat and in agents. For example, a "Vendor review" skill lays down the method, scoring and output format for a supplier review. Skills live in the skills library of a workspace. In chat, the model sees an index of enabled skills (name and description) and loads the one it needs. An administrator can also **mandate** a skill in a workspace, so its instructions apply to every chat there. Agents can attach skills that always load for that agent.

Skills come from three places: users (a form or a SKILL.md upload), skill ZIP files, and signed packs. Skills from a pack arrive switched off in every workspace until an administrator enables or mandates them.

## Quick start

Write a `SKILL.md` file and upload it under **Library > Skills**.

```markdown
---
name: Vendor review
description: Structured review of a new supplier: risk, contract terms, data protection.
connectors: [google-drive]
---
# Vendor review

1. Identify the vendor and the service.
2. Score financial, operational and data-protection risk (low, medium, high) with one reason each.
3. List contract terms to negotiate.
4. End with a recommendation: proceed, proceed with conditions, or stop.
```

To ship the same skill in a pack, use this item:

```json
{
  "kind": "skill",
  "schemaVersion": 1,
  "id": "vendor-review",
  "scope": "install",
  "spec": {
    "id": "vendor-review",
    "name": "Vendor review",
    "description": "Structured review of a new supplier: risk, contract terms, data protection.",
    "instructions": "# Vendor review\n\n1. Identify the vendor and the service.\n2. Score financial, operational and data-protection risk (low, medium, high) with one reason each.\n3. List contract terms to negotiate.\n4. End with a recommendation: proceed, proceed with conditions, or stop.",
    "connectors": ["google-drive"],
    "triggers": ["vendor review", "new supplier"]
  }
}
```

## File layout

### SKILL.md

```text
---
name: <one line, at most 120 characters>
description: <one line, at most 1000 characters>
connectors: [<name>, <name>]        # optional, inline list or "- item" list, at most 20
---
<markdown body: the instructions, at most 20,000 characters>
```

- The file starts with a `---` front matter block.
- `name` and `description` are single lines. Multi-line values (`|` or `>`) are refused.
- Values may be in double or single quotes.
- Other keys in the front matter are ignored on upload.

### Skill ZIP

`SKILL.md` at the root, or inside one top-level folder, plus reference files next to it.

```text
vendor-review.zip
  vendor-review/
    SKILL.md
    scorecard-template.xlsx
    checklist.md
```

Allowed file types: `md`, `txt`, `csv`, `json`, `pdf`, `png`, `jpg`, `jpeg`, `docx`, `xlsx`. Every file is scanned for malware.

### Skill pack

```text
acme-business-skills/
  manifest.json
  content/
    vendor-review.json        # skill spec
    contract-check.json       # another skill spec
```

Pack skills cannot carry reference files. Put everything the model needs into `instructions`.

## Field reference

JSON Schema: [skill.schema.json](https://aancer.ai/dev/schemas/skill.schema.json)

### Skill spec (pack item)

| Field | Type | Required | Rules |
|---|---|---|---|
| `id` | string | yes | `^[a-z0-9][a-z0-9._-]{0,63}$`. Use the same value as the item id |
| `name` | string | yes | 1 to 120 characters, not blank |
| `description` | string | yes | 1 to 1000 characters, not blank. The model reads it to decide when to load the skill |
| `instructions` | string | yes | 1 to 20,000 characters, Markdown |
| `connectors` | string[] | no | at most 20 connector names, each `^[a-z0-9@][a-z0-9@/._-]{0,99}$` |
| `triggers` | string[] | no | at most 10 phrases, each 1 to 80 characters |
| `workspace` | string | no | a workspace id or `{{param.<id>}}` |

No other fields are allowed.

At install, `triggers` are added to the description as ` Use when: a; b; c.` Keep `description` plus the `Use when:` text under 1000 characters in total, or that skill will not install.

`connectors` are a hint. They tell the model which connectors suit the skill. They grant no access.

### JSON body for the REST API

`POST /api/skills?workspaceId=<ws>` with `{ name, description, instructions, connectors?, scope? }`. `scope` is `private` (default) or `workspace`.

## Full examples

### A complete SKILL.md

```markdown
---
name: Vendor review
description: Runs a structured due-diligence review of a supplier or software vendor, tiered by how critical it is, with a weighted scorecard across security, privacy, financial health, contract, service and exit risk.
---
# Vendor review

## Purpose
Help a buyer decide whether a vendor is fit to rely on, and on what terms, with effort proportional to the risk.

## Inputs to ask for
1. The vendor, the product or service, and what it will be used for.
2. Spend per year, contract length and how many users or processes depend on it.

## Method
1. **Tier the vendor** (tier 1 critical, tier 2 important, tier 3 low).
2. **Review each area** and score it 1 to 5 with the evidence.
3. **Weight the areas** by tier and compute the weighted score out of 5.
4. **Recommend** approve, approve with conditions, or reject.

## Output format
1. **Recommendation** with tier and weighted score.
2. **Scorecard:** Area, Weight, Score, Evidence, Gaps.

## Limits
The review relies on what the vendor and the user provide; it does not verify claims independently.
```

### The same skill as a pack

`manifest.json`:

```json
{
  "v": 2,
  "kind": "bundle",
  "id": "acme.business-skills",
  "version": "1.0.0",
  "title": "Acme business skills",
  "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
  "requires": { "platform": ">=1.0.0" },
  "items": [
    { "kind": "skill", "schemaVersion": 1, "id": "vendor-review", "scope": "install", "spec": { "$ref": "content/vendor-review.json" } }
  ]
}
```

`content/vendor-review.json`:

```json
{
  "id": "vendor-review",
  "name": "Vendor review",
  "description": "Runs a structured due-diligence review of a supplier or software vendor, tiered by how critical it is, with a weighted scorecard across security, privacy, financial health, contract, service and exit risk.",
  "instructions": "# Vendor review\n\n## Purpose\nHelp a buyer decide whether a vendor is fit to rely on, and on what terms, with effort proportional to the risk.\n\n## Method\n1. **Tier the vendor**.\n2. **Review each area** and score it 1 to 5 with the evidence.\n3. **Recommend** approve, approve with conditions, or reject.\n\n## Output format\n1. **Recommendation** with tier and weighted score.\n2. **Scorecard:** Area, Weight, Score, Evidence, Gaps.",
  "triggers": ["vendor review", "supplier due diligence", "should we use this vendor", "third-party risk", "vendor scorecard", "compare these suppliers"]
}
```

## Install and test

### User skills

| Action | API | Permission |
|---|---|---|
| Create from JSON | `POST /api/skills?workspaceId=<ws>` with the JSON body, returns 201 | `skills.manage_own` |
| Upload SKILL.md or ZIP | `POST /api/skills?workspaceId=<ws>` as multipart: one file, optional field `scope=workspace`, at most 20 MB | `skills.manage_own` |
| List | `GET /api/skills?workspaceId=<ws>` returns items with `enabled`, `mandated`, `locked`. Admins add `&all=1` to see pack skills that are off | `chat.use` |
| Edit, delete | `PUT /api/skills/{id}`, `DELETE /api/skills/{id}` | `skills.manage_own` |
| Export | `GET /api/skills/{id}/export.zip?workspaceId=<ws>` | `chat.use` |
| Switch on or off for me | `PUT /api/me/skills/{id} {enabled, workspaceId}` | `chat.use` |

UI: **Library > Skills**.

```bash
curl -X POST "https://aancer.example.com/api/skills?workspaceId=ws-procurement" \
  -H "Authorization: Bearer $TOKEN" \
  -F "file=@SKILL.md" -F "scope=workspace"
```

### Pack skills

1. Sign, import and activate the pack. See [Packs](/developers/packs).
2. Enable the skill per workspace: `PUT /api/skills/{id}/workspaces {"workspaces": ["ws-procurement"]}`. The installed skill id is `pack:<packId>:<itemId>`.
3. Or mandate it: `PUT /api/skills/{id}/mandate {"workspaces": ["ws-procurement"], "alsoInAgents": true}`. A mandated skill applies to every chat in that workspace, and to agents when `alsoInAgents` is true.

Both need `skills.mandate` and admin rights in every changed workspace. Users cannot edit pack skills. A new pack version updates the content and keeps the enable and mandate choices. Retiring the pack removes the skill.

### Test it

Open a chat in the workspace and ask something that matches the description or a trigger phrase. If the answer does not follow the skill, make the description say more clearly when the skill applies, or mandate the skill in a test workspace to check the instructions on their own.

## Common errors

| Code | Message | Fix |
|---|---|---|
| `SKILL_INVALID` | the skill needs a name / the name is longer than 120 characters | |
| `SKILL_INVALID` | the skill needs a description / the description is longer than 1000 characters | For pack skills, count the `Use when:` text too |
| `SKILL_INVALID` | the skill has no instructions / the instructions are longer than 20000 characters | |
| `SKILL_INVALID` | invalid connector name: "..." / at most 20 connectors | Lower-case connector names, for example `google-drive` |
| `SKILL_INVALID` | SKILL.md must start with a front matter block between --- lines | |
| `SKILL_INVALID` | multi-line name is not supported; keep it on one line | |
| `SKILL_INVALID` | the ZIP has no SKILL.md at its root / file type not allowed / the ZIP is larger than 20 MB / the ZIP holds more than 200 files | |
| `SKILL_INVALID` | the skill was refused by content screening | Remove text that tries to override system rules or hide instructions |
| `SKILL_INVALID` | a workspace skill needs a workspace | Pass `workspaceId` |
| `SKILL_INVALID` | only skills installed from a pack are enabled per workspace | Use mandate, or ship the skill in a pack |
| `SKILL_NAME_TAKEN` | a skill named "..." already exists in this workspace | Names are unique per scope, ignoring case |
| `SKILL_MANDATE_LIMIT` | workspace ... already has 8 mandated skills | Remove a mandate first |
| `FORBIDDEN` | this skill is mandated in this workspace and cannot be switched off | |
| Pack import | `/items/<id>/spec: must NOT have additional properties` | Only the six fields in the table. There is no `files` field |

## Limits and editions

- Name 120 characters, description 1000, instructions 20,000. Up to 20 connectors and 10 triggers.
- ZIP upload: at most 20 MB and 200 files.
- The chat index shows up to 30 enabled skills. Up to 8 skills can be mandated per workspace.
- Skills are controlled by permissions: `skills.manage_own`, `skills.mandate`, `chat.use`.
- Check your edition on [aancer.ai/pricing](https://aancer.ai/pricing).



## Workflow templates

A workflow in AANCER is a graph of steps: a trigger, AI calls, knowledge lookups, agents, connector actions, human approvals, conditions, loops and more. A **workflow template** is a reusable, reviewed copy of a workflow. Everything that names a resource of one installation is taken out and turned into a typed **parameter**: connections, knowledge sets, agents, personas, datasets, approvers and trigger secrets. The person who deploys the template fills these in. Templates travel between installations as a pack item of kind `template`. Inside an installation you can also create templates from an existing workflow, review them and export them as a pack.

## Quick start

A webhook that posts the request to a chat channel. The chat connection is a parameter.

```json
{
  "kind": "template",
  "schemaVersion": 1,
  "id": "request-intake",
  "scope": "install",
  "spec": {
    "id": "tpl-acme-request-intake",
    "version": 1,
    "workspace": "{{param.target_workspace}}",
    "record": {
      "name": "Request intake",
      "description": "Takes a request and posts it to the team.",
      "icon": "🧩",
      "industry": "operations",
      "complexity": "starter",
      "locale": "en",
      "aiAct": { "riskClass": "unclassified", "annexIiiCategory": "none", "intendedPurpose": "", "humanOversight": "", "transparencyNote": "" },
      "compliance": { "dataCategories": [], "dataSubjects": [], "lawfulBasis": "", "retentionDays": null },
      "parameters": [
        { "id": "conn_1", "type": "connection", "label": "Chat connection", "required": true, "connector": "connector-chat" }
      ],
      "bindings": [
        { "parameterId": "conn_1", "stepId": "a", "path": "connectorAuth" }
      ],
      "translations": {},
      "flow": {
        "name": "Request intake",
        "rootStepId": "t",
        "steps": [
          { "id": "t", "type": "trigger", "name": "When called", "position": { "x": 0, "y": 0 }, "triggerType": "webhook", "nextStepId": "a" },
          { "id": "a", "type": "connector", "name": "Post", "position": { "x": 0, "y": 120 }, "connectorPiece": "connector-chat", "connectorAction": "send", "connectorInputs": { "channel": "general" } }
        ]
      },
      "builtAgainst": { "catalogHash": "", "platformVersion": "1.0.0" },
      "createdAt": "2026-11-15T00:00:00.000Z"
    }
  }
}
```

Put this item in a pack manifest and declare the workspace parameter:

```json
"parameters": [ { "id": "target_workspace", "type": "workspace", "label": "Workspace", "required": false } ]
```

`connector-chat` is a placeholder. Use the connector name of a real connector in the target installation.

## File layout

```text
acme-request-intake/
  manifest.json                  # pack manifest, one template item
  content/
    request-intake.json          # the item spec: { id, version, workspace?, record }
```

A template is one pack item. Its `spec` is inline or in `content/<name>.json`. If the administrator should choose the workspace, declare a `workspace` pack parameter (for example `target_workspace`, `required: false`) and set `spec.workspace` to `{{param.target_workspace}}`. If it stays unbound, the template is published for the whole installation.

## Field reference

JSON Schema: [template.schema.json](https://aancer.ai/dev/schemas/template.schema.json)

### Item spec

| Field | Type | Required | Rules |
|---|---|---|---|
| `id` | string | yes | 1 to 64 characters. The installation computes its own row id on import |
| `version` | integer | yes | 1 or higher |
| `workspace` | string | no | exactly `{{param.<id>}}` of a `workspace` pack parameter. A literal workspace id is refused |
| `record` | object | yes | the template record below |

### Template record

| Field | Type | Required | Rules |
|---|---|---|---|
| `name` | string | yes | 1 to 80 characters |
| `description` | string | yes | 1 to 300 characters |
| `longDescription` | string | no | detail text |
| `icon` | string | yes | 1 to 40 characters, usually an emoji |
| `industry` | string | yes | `healthcare`, `legal`, `financial`, `hr`, `manufacturing`, `retail`, `saas`, `marketing`, `operations`, `devops` |
| `industries` | string[] | no | extra tags |
| `complexity` | string | yes | `starter`, `intermediate`, `advanced` |
| `estimatedTimeSaved` | string | no | for example `"3h/week"` |
| `locale` | string | yes | at most 20 characters, for example `en` |
| `dataClassification` | string | no | free text |
| `aiAct` | object | yes | `{ riskClass, annexIiiCategory, intendedPurpose, humanOversight, transparencyNote }`. `riskClass`: `unclassified`, `minimal`, `limited`, `high`, `prohibited` |
| `compliance` | object | yes | `{ dataCategories: string[], dataSubjects: string[], lawfulBasis, retentionDays }`. `lawfulBasis`: `contract`, `consent`, `legitimate-interest`, `legal-obligation` or `""`. `retentionDays`: integer 0 to 36500, or `null` |
| `parameters` | array | yes | at most 50. See Template parameters |
| `bindings` | array | yes | which parameter fills which step field |
| `translations` | object | yes | `{ "<locale>": { name?, description?, longDescription?, parameters?: { "<paramId>": { label?, help? } } } }`. May be `{}` |
| `flow` | object | yes | `{ name, description?, rootStepId, steps }`, 2 to 200 steps |
| `builtAgainst` | object | no | `{ catalogHash, platformVersion }` |
| `createdAt` | string | yes | ISO 8601 date and time, for example `2026-11-20T00:00:00.000Z` |

Do not send `derived`. The installation computes it.

### Template parameters

| Field | Type | Required | Rules |
|---|---|---|---|
| `id` | string | yes | `^[a-z][a-z0-9_]{0,39}$`, unique |
| `type` | string | yes | `connection`, `knowledgeSet`, `agent`, `persona`, `dataset`, `approvers`, `secret`, `string`, `number`, `boolean`, `select` |
| `label` | string | yes | not empty |
| `help` | string | no | |
| `required` | boolean | no | |
| `default` | string, number or boolean | no | must match the type. Not allowed for `connection`, `knowledgeSet`, `agent`, `persona`, `dataset`, `approvers`, `secret` |
| `options` | string[] | for `select` | at least one; a `select` default must be one of them |
| `connector` | string | no | for `connection`: the connector it must belong to |

These template parameters are separate from pack parameters. Pack parameters are bound when the pack is activated. Template parameters are filled each time someone deploys the template.

### Bindings

A binding is `{ "parameterId": "...", "stepId": "...", "path": "..." }`. `path` is dot-separated. A parameter may fill only these fields:

| Path | Parameter type |
|---|---|
| `connectorAuth` | `connection` |
| `knowledgeSetId` | `knowledgeSet` |
| `agentRef`, `agentId` | `agent` |
| `personaId` | `persona` |
| `datasetId` | `dataset` |
| `approvers` | `approvers` |
| `triggerAuthFields.<key>` (trigger step only) | `secret` (a secret fills nothing else) |
| `connectorInputs.<key>` (not `connectorInputs.auth`), `triggerInputs.<key>` | `string`, `number`, `boolean`, `select` |
| `systemPrompt`, `userPromptTemplate`, `routingInstructions`, `agentGoal`, `routerQuestion`, `searchQuery`, `approvalMessage`, `approvalReasoning` | `string`, `select` |

A code step is never a binding target.

**No resource may stay in the steps.** Leave these fields out of every step and bind a parameter instead: `connectorAuth`, `knowledgeSetId`, `agentRef`, `agentId`, `personaId`, `datasetId`, `approvers`, `triggerAuthFields`, `webhookPath`, `agentApprovers`, `capturedOutput`. Text must not contain `{{connections[`.

### Workflow steps

Every step has `id`, `type`, `name` and `position {x, y}`. Optional: `description`, `nextStepId` (the next step), `continueOnFailure`, `retryOnFailure`, `retryCount`, `retryDelayMs`, `fieldModes` (`{ "<field>": "manual" | "auto" | "prompt" | "none" }`).

Exactly one step has `type: "trigger"`, and `flow.rootStepId` points at it. There must be at least one other step. Refer to earlier output with `{{trigger.body.<field>}}`, `{{<stepId>}}` or `{{<stepId>.<field>}}`.

| `type` | Fields (required in bold) |
|---|---|
| `trigger` | **`triggerType`**: `webhook`, `schedule`, `event`, `piece`. `schedule` (cron), `triggerTimezone` (IANA), `triggerAuthType` (`none`, `basic`, `header`, `hmac`), `triggerPiece`, `triggerName`, `triggerInputs`, `triggerPieceVersion` for a connector trigger |
| `aancer-ai` | `modelTier` (`local-standard`, `local-advanced`, `cloud-reasoning`), `dataClassification` (`sovereign`, `internal`, `permitted`), `systemPrompt`, `userPromptTemplate`, `maxTokens` |
| `rag` | as `aancer-ai`, plus a `knowledgeSetId` binding to a `knowledgeSet` parameter |
| `agent` | **`agentGoal`**, `agentToolRefs`, `agentMaxSteps` (1 to 50, default 10), `agentMaxBudgetUsd` (default 1.00), `agentRequireApproval` (default true), `agentOutputFields` |
| `connector` | **`connectorPiece`** (connector name), `connectorAction`, `connectorInputs` |
| `approval` | `approvalMessage`, `approvalReasoning`, `approvalTimeout` (hours, default 24), `approvalOnReject` (`stop`, `continue`), plus an `approvers` binding |
| `condition` | **`conditionExpression`**, **`branches [{id, label, nextStepId}]`** (at least one) |
| `router` | **`routingInstructions`**, **`routerBranches [{id, label, nextStepId, isDefault}]`** with exactly one default |
| `ai-router` | **`routerInput`**, **`routerQuestion`**, **`routerRoutes [{id, label, description}]`** (2 to 12, ids unique and not empty, not `otherwise`; every edge must be a declared route), `routerMode` (`single`, `multi`), `routerConfidenceFloor` (0 to 1) |
| `loop` | **`loopExpression`**, `loopBodyStepId` |
| `code` | `codeLanguage` (`javascript`; `python` with pandas, sandboxed and without network by default, is coming in this release), `codeSource`, `codeInputs {name: "{{ref}}"}` |
| `guardrails` | `guardTarget`, `guardOnFail` (`block`, `annotate`) |
| `file-search` | `searchQuery`, `searchMode` (`hybrid`, `vector`), `searchMaxHits` (1 to 20), plus a `knowledgeSetId` binding |
| `publish` | `publishMode` (`append`, `upsert`, `replace`), `publishRows`, `whenFull` (`remove_oldest`, `fail`), plus a `datasetId` binding |
| `output` | no required fields |

A step with `dataClassification: "sovereign"` cannot use `modelTier: "cloud-reasoning"`.

### AI Act fields

If the template has AI steps (`aancer-ai`, `rag`, `agent`, `router`, `ai-router`), set `aiAct.riskClass` to `minimal`, `limited` or `high` and fill `aiAct.intendedPurpose`.

AANCER treats a template as high risk when `riskClass` is `high`, or when its industry, name or description (including translations) contains one of these terms: `hr` (as a word), `rrhh`, `talent`, `employ`, `hiring`, `recruit`, `candidate`, `screen`, `performance review`, `offboard`, `onboard`, `education`, `edu` (as a word), `proctor`, `grading`, `student`, `exam`. The match is a plain substring test, so words such as "screenshot", "employee" and "example" also count. A high-risk template with AI steps needs `aiAct.annexIiiCategory` (not `none`) and `aiAct.humanOversight`, and should contain an approval step. If the declared `riskClass` is lower than this rule derives, you get the warning `TPL_RISK_DECLARED_BELOW_DERIVED` and the template is treated as high risk.

### What the installation works out for you

Do not send these. AANCER derives them from the steps: which steps run locally, in the cloud, call a connector or wait for approval; whether the template is fully sovereign, mixed or sends data to a connector; the connectors it needs; and the hosts named in connector inputs.

## Full examples

### Local AI summary, human approval, then post

```json
{
  "kind": "template", "schemaVersion": 1, "id": "invoice-summary-approval", "scope": "install",
  "spec": {
    "id": "tpl-acme-invoice-summary",
    "version": 1,
    "workspace": "{{param.target_workspace}}",
    "record": {
      "name": "Invoice summary with approval",
      "description": "Summarises an incoming invoice with a local model, asks a person to approve, then posts the summary to a chat channel.",
      "icon": "🧾", "industry": "financial", "complexity": "intermediate", "locale": "en",
      "aiAct": {
        "riskClass": "limited", "annexIiiCategory": "none",
        "intendedPurpose": "Summarise supplier invoices for a person who approves them.",
        "humanOversight": "A person approves every summary in an approval step before it is posted.",
        "transparencyNote": "The summary is written by an AI model."
      },
      "compliance": { "dataCategories": ["invoice data"], "dataSubjects": [], "lawfulBasis": "contract", "retentionDays": 90 },
      "parameters": [
        { "id": "approvers_1", "type": "approvers", "label": "Who approves the summary", "required": true },
        { "id": "conn_1", "type": "connection", "label": "Chat connection", "required": true, "connector": "connector-chat" },
        { "id": "channel", "type": "string", "label": "Channel to post to", "required": true, "default": "finance" }
      ],
      "bindings": [
        { "parameterId": "approvers_1", "stepId": "approve", "path": "approvers" },
        { "parameterId": "conn_1", "stepId": "post", "path": "connectorAuth" },
        { "parameterId": "channel", "stepId": "post", "path": "connectorInputs.channel" }
      ],
      "translations": {},
      "flow": {
        "name": "Invoice summary with approval",
        "rootStepId": "t",
        "steps": [
          { "id": "t", "type": "trigger", "name": "Invoice received", "position": { "x": 0, "y": 0 }, "triggerType": "webhook", "nextStepId": "sum" },
          { "id": "sum", "type": "aancer-ai", "name": "Summarise", "position": { "x": 0, "y": 120 },
            "modelTier": "local-standard", "dataClassification": "internal",
            "systemPrompt": "You summarise supplier invoices: supplier, amount, due date, cost centre.",
            "userPromptTemplate": "{{trigger.body.text}}", "maxTokens": 600, "nextStepId": "approve" },
          { "id": "approve", "type": "approval", "name": "Approve summary", "position": { "x": 0, "y": 240 },
            "approvalMessage": "Approve this invoice summary?", "approvalReasoning": "{{sum}}", "approvalTimeout": 24, "nextStepId": "post" },
          { "id": "post", "type": "connector", "name": "Post to channel", "position": { "x": 0, "y": 360 },
            "connectorPiece": "connector-chat", "connectorAction": "send", "connectorInputs": { "text": "{{sum}}" } }
        ]
      },
      "builtAgainst": { "catalogHash": "", "platformVersion": "1.0.0" },
      "createdAt": "2026-11-20T00:00:00.000Z"
    }
  }
}
```

### Weekly scheduled answer from a knowledge set, with a German translation

```json
{
  "kind": "template", "schemaVersion": 1, "id": "weekly-policy-digest", "scope": "install",
  "spec": {
    "id": "tpl-acme-weekly-policy-digest",
    "version": 1,
    "record": {
      "name": "Weekly policy digest",
      "description": "Every Monday, answers a fixed question from a knowledge set with a local model and keeps the answer in the run history.",
      "icon": "📚", "industry": "operations", "complexity": "starter", "locale": "en",
      "aiAct": { "riskClass": "minimal", "annexIiiCategory": "none", "intendedPurpose": "Summarise internal policy changes for staff.", "humanOversight": "", "transparencyNote": "" },
      "compliance": { "dataCategories": [], "dataSubjects": [], "lawfulBasis": "", "retentionDays": null },
      "parameters": [
        { "id": "ks_1", "type": "knowledgeSet", "label": "Policy knowledge set", "required": true },
        { "id": "question", "type": "string", "label": "Question to answer each week", "required": true, "default": "What changed in our policies this week?" }
      ],
      "bindings": [
        { "parameterId": "ks_1", "stepId": "ask", "path": "knowledgeSetId" },
        { "parameterId": "question", "stepId": "ask", "path": "userPromptTemplate" }
      ],
      "translations": {
        "de": {
          "name": "Wöchentlicher Richtlinien-Überblick",
          "description": "Beantwortet jeden Montag eine feste Frage aus einer Wissenssammlung.",
          "parameters": { "ks_1": { "label": "Wissenssammlung" }, "question": { "label": "Wöchentliche Frage" } }
        }
      },
      "flow": {
        "name": "Weekly policy digest",
        "rootStepId": "t",
        "steps": [
          { "id": "t", "type": "trigger", "name": "Every Monday 08:00", "position": { "x": 0, "y": 0 },
            "triggerType": "schedule", "schedule": "0 8 * * 1", "triggerTimezone": "Europe/Berlin", "nextStepId": "ask" },
          { "id": "ask", "type": "rag", "name": "Answer from policies", "position": { "x": 0, "y": 120 },
            "modelTier": "local-standard", "dataClassification": "internal",
            "systemPrompt": "Answer only from the retrieved passages. Say when nothing changed.", "maxTokens": 800 }
        ]
      },
      "builtAgainst": { "catalogHash": "", "platformVersion": "1.0.0" },
      "createdAt": "2026-11-20T00:00:00.000Z"
    }
  }
}
```

There is no `workspace` here, so activation publishes it for the whole installation. A translation needs a name, a description and every parameter label, otherwise you get the warning `TPL_TRANSLATION_INCOMPLETE`.

## Install and test

### As a pack

1. Put the item in a pack and sign it. See [Packs](/developers/packs).
2. Import it: **Platform Settings > Extensions > Import pack**, or `POST /api/extensions/packs/import`. Import runs every check on this page. A missing connector is not an import error.
3. Activate it: `POST /api/extensions/packs/{packId}/activate` with `{"version":"1.0.0","parameters":{"target_workspace":"ws-ops"}}`. **Activation is the approval.** The template is published as decided by the person who activates it. That person needs `templates.publish_own` in the bound workspace, or `templates.publish_install` when it is unbound. A template with a code step also needs `automations.use_custom_code`.
4. Deploy it: the template shows in the template gallery. The person deploying it fills in the template parameters. Deploying is refused until every connector it needs is installed.

### Inside an installation

You can also build a workflow in the designer and turn it into a template.

| Step | API | UI |
|---|---|---|
| Create a workflow from JSON | `POST /api/automations` with `{name, workspaceId, status: "draft", rootStepId, steps}` | Automations > Designer |
| Create a template draft from it | `POST /api/automations/templates/authored {workspaceId, fromFlowId, name?, locale?}` | Automations > Templates > New |
| Edit details | `PUT /api/automations/templates/authored/{id} {rev, record?, parameters?, bindings?, translations?, valueChoices?}` | template editor |
| Validate | `POST /api/automations/templates/authored/{id}/validate` returns `{ok, errors[], warnings[]}` | |
| Submit for review | `POST .../{id}/submit {rev, targetScope: "workspace" or "install", note?}` | |
| Approve or reject | `POST .../{id}/approve {rev, note?, riskClassConfirmed?}`, `POST .../{id}/reject {rev, note}` | Automations > Template reviews |
| Export as a pack | `POST .../{id}/export {}` returns a signed `.ancpack` | |

Every write (`PUT`, `submit`, `approve`, `reject`) needs the integer `rev` you last read; a stale or missing `rev` returns `TEMPLATE_REV_CONFLICT`. `riskClassConfirmed: true` is needed on approve only when the template has AI steps. The `validate` call is the quickest way to check a template while you build it. Authors cannot approve their own templates when the target is the whole installation and the installation's second-approver setting is on. Each user can hold at most 100 unpublished drafts per workspace.

An exported pack is signed with the installation's export key. To move it to a second installation, open **Platform Settings > Extensions > Trust keys** on the first one and choose **Show key for another installation**. On the second installation, add a trust key and paste it: the key id is filled in for you.

## Common errors

Pack import errors appear as `PACK_SCHEMA_INVALID` details with the path `/items/<itemId>/spec/record/...` and the code in brackets.

| Code | Message | Fix |
|---|---|---|
| `TPL_FLOW_NO_TRIGGER` | The workflow has no trigger yet. / The workflow has more than one trigger. Keep exactly one. | One `trigger` step, and `rootStepId` points at it |
| `TPL_FLOW_EMPTY` | The workflow only has a trigger. Add at least one step. | Add a step |
| `TPL_FLOW_SERIALIZE` | Connector step is missing connectorPiece. / Agent step is missing agentGoal. / First step must be a trigger. | Fix the step |
| `TPL_FLOW_SERIALIZE` | Sovereignty conflict: classification=sovereign cannot route to cloud-reasoning tier. | Use a local tier or lower the classification |
| `TPL_META_REQUIRED`, `TPL_META_LENGTH`, `TPL_META_ENUM` | Enter a name. / Keep a short description to 300 characters. / Choose an industry from the list. / The creation date is missing. | Use the values and limits above. Always send `createdAt` |
| `TPL_PARAM_INVALID` | This kind of parameter cannot have a default. / A secret cannot have a default value. / The default value does not match the parameter type. | Remove the default or fix its type |
| `TPL_BINDING_ORPHAN` | This value points to a parameter that no longer exists. | Match `parameterId` and `stepId` |
| `TPL_BINDING_PATH_FORBIDDEN` | The parameter "..." cannot fill this field of step "...". | Follow the bindings table |
| `TPL_RESIDUAL_BINDING` | This still points to something of your own installation. | Remove the resource field from the step and add a binding |
| `TPL_SECRET_FOUND` | This looks like a credential. Remove it or make the field a parameter. | No keys or tokens in any text |
| `TPL_AIACT_REQUIRED` | Choose a risk class: this template has AI steps. / State the intended purpose. | Fill `aiAct` |
| `TPL_PROHIBITED` | A template for a prohibited practice cannot be shared. | |
| `TPL_TOO_LARGE` | The template is larger than 1 MB. / at most 200 steps / at most 50 parameters | Split it |
| `TPL_PACK_WORKSPACE` | must be a pack parameter, written as {{param.<id>}} | Use a `workspace` pack parameter |
| `TPL_PACK_WORKSPACE_UNKNOWN` | the workspace it is bound to (...) does not exist here or is archived. | Bind an existing workspace at activation |
| `TPL_PACK_UNREADABLE` | its content could not be read. | Rebuild and re-sign the pack |
| `TPL_PARAM_DUPLICATE` | Two parameters share the id "...". | Make parameter ids unique |
| `TPL_FIELD_MODE` | a step field uses a field mode that is not allowed | Use one of the field modes the designer offers |
| `TPL_GUARD_MODE` | a guardrail or file-search step uses a mode that is not allowed | Use one of the modes the designer offers |
| `TEMPLATE_REV_CONFLICT` | the template changed since you read it | Read it again and send the new `rev` |

Warnings do not block: `TPL_RISK_DECLARED_BELOW_DERIVED` (see the high-risk rule above), `TPL_CATALOG_DRIFT` (the connector catalog changed since the template was built: update it from its workflow), `TPL_PARAM_UNUSED`, `TPL_CODE_STEP_PRESENT` (whoever deploys it runs that code), `TPL_PII_FOUND` (an e-mail address, phone number or IBAN in the text), `TPL_NO_HUMAN_OVERSIGHT_STEP`, `TPL_TRANSLATION_INCOMPLETE`.

## Limits and editions

- At most 200 steps, 50 parameters and 1 MB per template.
- Connector names and their action inputs depend on the connectors installed in the target installation. AANCER offers 750+ connectors.
- Templates are controlled by permissions: `templates.author_own`, `templates.publish_own`, `templates.publish_install`, `automations.use_custom_code`.
- An agent can only use a workflow that starts from a webhook, a schedule or an event if the agent is certified. This needs the Certified Agents licence feature. See [Agents](/developers/agents).
- Check your edition on [aancer.ai/pricing](https://aancer.ai/pricing).



## Agents

An agent in AANCER is a versioned, governed AI assistant that belongs to a workspace. It has instructions, a model tier, tools (connector actions, knowledge sets, workflows, other agents, web search and platform tools), conversation starters, an optional input form, optional structured output, run limits, a write-approval policy and an automated decision disclosure. You edit a **draft** and **publish** numbered versions. Each publish issues a signed passport that binds the version to a hash of its configuration.

To move an agent between installations, or to offer it to customers, you use an **agent blueprint**: a pack item of kind `agent-blueprint`. A blueprint carries content only: instructions, starters, model tier, tool references and skills. Activating a blueprint creates no agent. A person creates an agent from it with one click, and that agent is an ordinary agent of the target installation.

There are two formats on this page:

| Format | Use it for | How you send it |
|---|---|---|
| Agent blueprint | shipping an agent design in a pack | pack item `agent-blueprint`, schema version 1 |
| Agent configuration | creating or editing an agent in one installation | REST: `PUT /api/agents/{id}/draft` |

## Quick start

A blueprint that sorts invoices. It uses a mail connector action and the platform's render tool.

```json
{
  "v": 2,
  "kind": "bundle",
  "id": "acme.invoice-triage",
  "version": "1.0.0",
  "title": "Invoice triage agent",
  "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
  "requires": { "platform": ">=1.0.0" },
  "items": [
    {
      "kind": "agent-blueprint",
      "schemaVersion": 1,
      "id": "invoice-triage",
      "scope": "install",
      "spec": {
        "name": "Invoice triage",
        "description": "Sorts incoming invoices and drafts the booking proposal.",
        "category": "finance",
        "icon": "receipt",
        "instructions": "You sort incoming invoices. For each one, name the supplier, the amount and the cost centre, and draft a booking proposal. Never book anything yourself.",
        "starters": ["Sort today's invoices"],
        "model": { "tier": "local-standard" },
        "tools": [
          { "kind": "connector", "ref": "mail.send_email" },
          { "kind": "frame", "ref": "render" }
        ],
        "skills": [],
        "riskHint": null
      }
    }
  ]
}
```

`mail.send_email` is a placeholder. Use `<connector name>.<action name>` of a connector in the target installation.

## File layout

```text
acme-invoice-desk/
  manifest.json                       # pack manifest
  content/
    invoice-clerk.json                # agent-blueprint spec
    invoice-summary-approval.json     # template spec the blueprint uses as a tool
```

A blueprint item must use `"scope": "install"`.

## Field reference

JSON Schema: [agent.schema.json](https://aancer.ai/dev/schemas/agent.schema.json). The root is the blueprint spec. `$defs/agentConfig` is the REST agent configuration.

### Agent blueprint spec

| Field | Type | Required | Rules |
|---|---|---|---|
| `name` | string | yes | 1 to 120 characters |
| `description` | string | no | at most 2000 characters |
| `category` | string | no | free text, at most 80 characters |
| `icon` | string | no | at most 40 characters, an icon name such as `receipt` |
| `instructions` | string | yes | 1 to 50,000 characters |
| `starters` | string[] | no | at most 12, each 1 to 500 characters |
| `model` | object | yes | exactly `{ "tier": "<tier>" }`. Tier: `local-standard`, `local-advanced`, `cloud-reasoning`. Never a fixed model route |
| `tools` | array | no | at most 64 of `{ kind, ref }`, no duplicates. See Tool references |
| `skills` | string[] | no | at most 32, each 1 to 120 characters |
| `riskHint` | `"high"` or `null` | no | |

No other fields are allowed.

### Tool references in a blueprint

| `kind` | `ref` must be |
|---|---|
| `knowledge` | a pack parameter `{{param.<id>}}`. Never a knowledge set id |
| `workflow` | the item id of a `template` item in the same pack, or a pack parameter |
| `agent` | the item id of another `agent-blueprint` item in the same pack, or a pack parameter |
| `web` | a tool name such as `search`. The pack must declare a data flow with `destination: "web-search"` |
| `connector` | a connector name, optionally with an action: `name` or `name.action`. Letters, digits, `_ . @ / -` |
| `dataset`, `frame` | the platform tool's action name, for example `append` or `render` |
| `fn` | the item id of a `function` item in the same pack |

`code` and `mcp` tools cannot be part of a blueprint.

Pack parameters have no knowledge type. Declare a knowledge parameter as `"type": "string"` and let the administrator enter the knowledge set id.

### What happens on "Create agent"

When a person creates an agent from a blueprint, the new draft takes the blueprint's instructions, starters, model tier, tools and skills. Everything else uses the defaults: limits of 12 steps, 20 tool calls, 1 USD and 300 seconds, write confirmation `always`, no automated decisions. Tool references are resolved in the person's workspace:

- a `workflow` item becomes the newest workflow deployed there from that pack template;
- an `agent` item becomes the newest agent created there from that blueprint;
- a parameter becomes its bound value.

A reference that cannot be filled is left out and listed in `skipped[]` with the reason `parameter_not_set`, `workflow_not_deployed` or `agent_not_created`. Deploy the template first, then create the agent.

### Agent configuration (REST)

Send it with `PUT /api/agents/{id}/draft` as `{ "config": { ... } }`, at most 200,000 bytes. Saving a draft refuses malformed values. Publishing also refuses missing values and tools that are not available.

| Field | Type | Required | Rules | Default |
|---|---|---|---|---|
| `instructions` | string | yes | not empty at publish, at most 50,000 characters | `""` |
| `model` | object | yes | exactly one of `{tier}` or `{route}`. `route` is a fixed model route of the installation | `{tier: "local-advanced"}` |
| `temperature` | number | no | 0 to 2 | |
| `tools` | array | yes | may be empty, no duplicates. See below | `[]` |
| `input` | object | yes | `{kind: "prompt"}` or `{kind: "form", fields: [...]}` with 1 to 40 fields | `{kind: "prompt"}` |
| `starters` | string[] | yes | at most 12, each 1 to 500 characters | `[]` |
| `output` | object | no | `{fields: [...]}`, 1 to 50 fields | |
| `limits` | object | yes | `maxSteps` (at most 200), `maxToolCalls` (at most 500), `maxUsd` (at most 1000), `maxWallMs` (at most 86,400,000). All above 0; all except `maxUsd` are whole numbers | `12, 20, 1, 300000` |
| `approval.confirmWrites` | string | yes | `always` or `workspace_default` | `always` |
| `art22.automatedDecisionMaking` | string | yes | `none`, `assistive`, `decisive` | `none` |
| `art22.humanOversightRequired` | boolean | yes | must be `true` when `decisive` | `true` |
| `personaId` | string or null | no | a persona id of the installation | |
| `memory.perUser` | boolean | no | opt-in memory per user | |
| `skills` | string[] | no | skill ids visible in the workspace, no duplicates, always loaded for this agent | |

Rule: when `automatedDecisionMaking` is not `none`, or `humanOversightRequired` is `true`, `confirmWrites` must be `always`.

Tool entries are `{ kind, id, fields?, connection? }`:

- `kind`: `connector`, `knowledge`, `workflow`, `mcp`, `agent`, `code`, `web`, `frame`, `dataset`, `fn`.
- `id`: for `connector`, `<connector name>` or `<connector name>.<action>`; for `knowledge`, a knowledge set id; for `workflow`, a workflow id; for `agent`, an agent id; for platform tools, the action name. `"*"` (every tool of that kind) is allowed only for `connector`, `knowledge`, `workflow` and `mcp`, and only as the whole id: `slack.*` or `*` for any other kind is refused.
- `fields`: `{ "<input>": { "mode": "fixed" | "preselected", "value": ... } }`. A `fixed` field needs a value.
- `connection`: `{ "mode": "user" }` or `{ "mode": "preselected", "id": "<connection id>" }`.

Form fields: `{ id, type, label, required?, help?, options?, accept?, maxFiles? }`. `id` matches `^[a-z][a-z0-9_]{0,63}$`. `type` is `text`, `multiline`, `number`, `checkbox`, `date`, `email`, `select`, `multiselect` or `file`. `select` and `multiselect` need `options [{value, label}]`. `file` takes `accept` (media types) and `maxFiles` (1 to 10).

Output fields: `{ id, type, description?, values?, required? }`. `type` is `text`, `number`, `boolean`, `enum` or `json`. An `enum` needs `values`. With `output` set, the agent ends each run by returning these fields.

## Full examples

### A blueprint that uses a pack template, a knowledge parameter and web search

```json
{
  "v": 2, "kind": "bundle", "id": "acme.invoice-desk", "version": "1.0.0", "title": "Invoice desk",
  "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
  "requires": { "platform": ">=1.0.0" },
  "parameters": [
    { "id": "target_workspace", "type": "workspace", "label": "Workspace", "required": false },
    { "id": "policies", "type": "string", "label": "Knowledge set with the booking rules", "required": false }
  ],
  "declarations": {
    "v": 1, "licence": "Apache-2.0",
    "dataFlows": [
      { "purpose": "Read invoices the person shares in the conversation", "data": ["invoice documents"], "personalData": true, "destination": "installation" },
      { "purpose": "Look up a supplier on the web when asked", "data": ["supplier names"], "personalData": false, "destination": "web-search" }
    ],
    "egress": [],
    "aiUse": { "intendedPurpose": "Drafts booking proposals that a person checks", "annexIII": false, "humanOversight": "A person confirms every write before it happens" },
    "attestations": { "ownsRights": true, "noProhibitedPractice": true }
  },
  "items": [
    { "kind": "agent-blueprint", "schemaVersion": 1, "id": "invoice-clerk", "scope": "install",
      "spec": { "$ref": "content/invoice-clerk.json" } },
    { "kind": "template", "schemaVersion": 1, "id": "invoice-summary-approval", "scope": "install",
      "spec": { "$ref": "content/invoice-summary-approval.json" } }
  ]
}
```

`content/invoice-clerk.json`:

```json
{
  "name": "Invoice clerk",
  "description": "Reads invoices, names supplier, amount and cost centre, and drafts the booking proposal.",
  "category": "finance",
  "icon": "receipt",
  "instructions": "You help the accounts team. For each invoice, name the supplier, the amount and the cost centre, check them against the booking rules, and draft a booking proposal. Never book anything yourself.",
  "starters": ["Check this invoice", "Draft the booking proposal"],
  "model": { "tier": "local-advanced" },
  "tools": [
    { "kind": "knowledge", "ref": "{{param.policies}}" },
    { "kind": "workflow", "ref": "invoice-summary-approval" },
    { "kind": "web", "ref": "search" },
    { "kind": "frame", "ref": "render" }
  ],
  "skills": [],
  "riskHint": null
}
```

`content/invoice-summary-approval.json` is the template spec from [Templates](/developers/templates). Without the template item in the same pack, import fails. That template starts from a webhook, so the agent can only run it as a certified agent.

### An agent configuration with a form and structured output

```json
{
  "instructions": "You triage incoming support requests. Classify each request, look up the answer in the product handbook, and draft a reply. Ask before sending anything.",
  "model": { "tier": "local-advanced" },
  "temperature": 0.2,
  "tools": [
    { "kind": "knowledge", "id": "ks_handbook" },
    { "kind": "connector", "id": "mail.send_email", "connection": { "mode": "user" } }
  ],
  "input": { "kind": "form", "fields": [
    { "id": "customer", "type": "text", "label": "Customer name", "required": true },
    { "id": "priority", "type": "select", "label": "Priority", "options": [ { "value": "low", "label": "Low" }, { "value": "high", "label": "High" } ] },
    { "id": "attachment", "type": "file", "label": "Ticket export", "accept": ["application/pdf"], "maxFiles": 2 }
  ] },
  "starters": ["Triage this request"],
  "output": { "fields": [
    { "id": "category", "type": "enum", "values": ["billing", "bug", "how_to"], "required": true },
    { "id": "draft_reply", "type": "text", "required": true }
  ] },
  "limits": { "maxSteps": 12, "maxToolCalls": 20, "maxUsd": 1, "maxWallMs": 300000 },
  "approval": { "confirmWrites": "always" },
  "art22": { "automatedDecisionMaking": "assistive", "humanOversightRequired": true },
  "memory": { "perUser": false },
  "skills": []
}
```

`ks_handbook` and `mail.send_email` are placeholders. Tool ids must exist and be enabled in the agent's workspace.

## Install and test

### Blueprint in a pack

1. Sign and import the pack. See [Packs](/developers/packs). Import checks the spec, the same-pack references and the web-search declaration.
2. Activate the pack. If it contains templates, deploy them in the workspace.
3. In **Agents**, choose **Create agent** from the blueprint, or call `POST /api/agents` with `{"workspaceId":"ws-ops","name":"Invoice clerk","blueprintId":"pack:acme.invoice-desk:invoice-clerk"}`. Check `blueprint.skipped[]` in the response.
4. Open the draft, test it, and publish it.

### Agent through the REST API

```bash
# create
curl -X POST https://aancer.example.com/api/agents \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"workspaceId":"ws-support","name":"Support triage","description":"Classifies requests and drafts replies"}'

# save the draft configuration
curl -X PUT https://aancer.example.com/api/agents/$AGENT_ID/draft \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d @agent-config.json      # {"config": {...}}

# preview, then publish
curl https://aancer.example.com/api/agents/$AGENT_ID/publish-preview -H "Authorization: Bearer $TOKEN"
curl -X POST https://aancer.example.com/api/agents/$AGENT_ID/publish \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"changeNote":"First version"}'
```

| Call | Permission | Notes |
|---|---|---|
| `POST /api/agents {workspaceId, name, description?, icon?, blueprintId?}` | `agents.create_own` | `blueprintId` is `pack:<packId>:<itemId>` |
| `PUT /api/agents/{id}/draft {config, ifUpdatedAt?}` | `agents.edit_own` | saves the configuration |
| `PATCH /api/agents/{id}` | `agents.edit_own` | name, description, icon, up to 3 labels |
| `GET /api/agents/{id}/publish-preview` | `agents.publish_own` | shows what publishing would certify |
| `POST /api/agents/{id}/publish {changeNote?, modelEgress?}` | `agents.publish_own` | returns `{version, passportId, configHash, warnings}`. `modelEgress` is `{scope: "in-perimeter"}` or `{scope: "listed", destinations: [<host>...]}` |
| `GET /api/agents/{id}/versions`, `GET /api/agents/{id}/diff?from=&to=` | `agents.edit_own` | versions and differences |
| `POST /api/agents/{id}/versions/{n}/restore {changeNote?, modelEgress?}` | `agents.publish_own` | publishes an older version again |
| `POST /api/agents/{id}/export-for-submission` | `agents.publish_own` and edit access | see below |

### Export an agent as a blueprint pack

`POST /api/agents/{id}/export-for-submission` with `{"packId":"acme.support-triage","licence":"Apache-2.0","ownsRights":true,"noProhibitedPractice":true}` returns a signed one-item blueprint pack, made from the published version. Add `"preview": true` to see the content first. Knowledge, workflow and agent tools become pack parameters. Connections, fixed field values, skills, the form, output, limits, memory and persona are not exported. A tool wildcard, a fixed model route, a code, MCP or `fn` tool, a missing description, empty instructions, or anything that looks like a credential stops the export with `AGENT_EXPORT_REFUSED` and a `reason`.

### Certified agents

Publishing always issues a passport. In addition, an installation can require certification: then a run may only use the tools, model tier ceiling and budgets that the certificate covers. A knowledge set or workflow added after certification shows "Not certified" until you certify again. Workflows that start from a **webhook, schedule or event** run only for certified agents: "Only certified agents can run workflows that start from a web call, a schedule or an event." Workflows with a Manual or Form start work for every agent.

Certificates are issued by the installation. You cannot write or edit one.

## Common errors

Blueprint import errors appear as `PACK_SCHEMA_INVALID` details with the path `/items/<itemId>/spec/...`.

| Code | Message | Fix |
|---|---|---|
| `AGENT_BLUEPRINT_MODEL` | must be a model tier, written as { "tier": "<name>" }. A blueprint never names a model route | Use `{"tier": "local-advanced"}` |
| `AGENT_BLUEPRINT_TOOL_KIND` | a blueprint cannot carry a tool of kind "code" | Remove `code` and `mcp` tools |
| `AGENT_BLUEPRINT_TOOL_DUPLICATE` | this tool is listed twice | Remove the duplicate |
| `AGENT_BLUEPRINT_REF` | must be a pack parameter, written as {{param.<id>}} | Knowledge tools always use a parameter |
| `AGENT_BLUEPRINT_REF` | names the template "...", which is not an item of this pack | Add the template item, or use a parameter |
| `AGENT_BLUEPRINT_WEB_UNDECLARED` | web search needs a declared data flow with the destination "web-search" | Add the data flow to `declarations` |
| (shape) | must NOT have additional properties / must NOT have more than 12 items | Fix shape errors first; the other checks run after them |
| `AGENT_BLUEPRINT_NOT_AVAILABLE` | This blueprint is no longer available: its pack was retired or withdrawn. | Activate the pack again |
| `AGENT_BLUEPRINT_INVALID` (422) | blueprintId must name a blueprint of an installed pack. | Use `pack:<packId>:<itemId>` of an active pack |
| `AGENT_EXPORT_REFUSED` (422, 403, 503) | The agent cannot be exported: ... | Fix what `reason` names; 403 means you need edit access to the agent |
| `COMPLIANCE_RULE_FAILED` (422) | Compliance rule failed: ... | Change the configuration so the installation's compliance rule passes |
| `AGENT_DRAFT_INVALID` | Duplicate skill. / ... must be a whole number. / Draft exceeds 200000 bytes | Fix the configuration |
| `AGENT_DRAFT_INVALID` | Instructions are required. / Choose exactly one of a model tier or a route. | Fix the configuration |
| `AGENT_DRAFT_INVALID` | A wildcard is only allowed for all connectors, knowledge, workflows or MCP tools. | Name the tool |
| `AGENT_DRAFT_INVALID` | This agent makes automated decisions or requires human oversight, so writes must be confirmed by a person. Set write confirmation to always. | `"confirmWrites": "always"` |
| `AGENT_DRAFT_INVALID` | Decisive automated decisions require human oversight. | `"humanOversightRequired": true` |
| `AGENT_TOOL_UNAVAILABLE` | This tool is not available to you in this workspace. | Enable the connector or knowledge set in that workspace |
| `AGENT_VERSION_CONFLICT` | (409) | Reload and retry with the new `ifUpdatedAt` |
| `CLOUD_TIER_NOT_ALLOWED` | | The workspace policy refuses `cloud-reasoning`; use a local tier |

## Limits and editions

- Up to 64 tools and 12 starters per blueprint. Up to 50,000 characters of instructions.
- Certified agents need the Certified Agents licence feature. Without it, agents still publish with a passport, but they cannot use webhook, schedule or event workflows as tools.
- The `cloud-reasoning` tier can be switched off by workspace policy.
- Check your edition on [aancer.ai/pricing](https://aancer.ai/pricing).



## Dashboards

An AANCER dashboard is data, not code. It is built from four object kinds that stack:

1. a **dataset**: a typed table stored in the installation;
2. a **model**: the semantic layer with entities, dimensions, measures, named filters, variables and joins;
3. a **widget**: a table, a chart, a KPI, Markdown text or a form, bound to a model query;
4. a **dashboard**: a 12-column grid of widgets plus global filters.

Charts are declarative chart specifications (JSON) without data: the platform runs the query and injects the result. Dashboards are versioned. You save a draft, then publish version N, with rollback and retire. You can build them in the UI under **Work > Dashboards**, through the REST API, or ship them in a signed pack with items of kind `dataset`, `model`, `widget` and `dashboard`. Every published dashboard also gets a 2D and 3D view switch, which needs no authoring.

## Quick start

One dataset, one model, one chart, one dashboard, as pack item specs.

```json
{ "id": "sales_orders", "title": "Sales orders",
  "columns": [
    { "id": "date", "type": "date", "required": true },
    { "id": "region", "type": "string", "required": true },
    { "id": "amount", "type": "number", "min": 0 }
  ],
  "retention": { "maxAgeDays": 730 } }
```

```json
{ "id": "sales",
  "entities": { "orders": { "dataset": "sales_orders" } },
  "dimensions": { "region": { "entity": "orders", "column": "region", "label": "Region" } },
  "measures": { "revenue": { "entity": "orders", "agg": "sum", "column": "amount", "label": "Revenue", "format": "currency" } } }
```

```json
{ "id": "revenue_by_region", "type": "chart", "title": "Revenue by region",
  "source": { "model": "sales", "query": { "measures": ["revenue"], "dimensions": ["region"] } },
  "chart": { "mark": "bar", "encoding": {
    "x": { "field": "region", "type": "nominal" },
    "y": { "field": "revenue", "type": "quantitative" } } } }
```

```json
{ "id": "sales-overview", "title": "Sales overview", "icon": "BarChart3",
  "layout": [ { "widget": "revenue_by_region", "x": 0, "y": 0, "w": 12, "h": 8 } ] }
```

## File layout

```text
acme-sales-dashboard/
  manifest.json                         # items: dataset, model, widget(s), dashboard
  content/
    dataset.sales_orders.json
    model.sales.json
    widget.revenue_by_region.json
    dashboard.sales-overview.json
```

Each item uses `"schemaVersion": 1` and `"scope": "workspace"` with `"workspace": "{{param.target_workspace}}"`. Declare `target_workspace` as a `workspace` pack parameter.

## Field reference

JSON Schema: [dashboard.schema.json](https://aancer.ai/dev/schemas/dashboard.schema.json). It has one definition per kind: `dataset`, `model`, `widget`, `dashboard`. Ids match `^[a-z0-9][a-z0-9._-]{0,63}$`; dataset column ids match `^[a-z][a-z0-9_]{0,63}$`.

### Dataset

| Field | Type | Required | Rules |
|---|---|---|---|
| `id` | string | yes | id pattern |
| `title` | string | no | at most 120 characters |
| `columns` | array | yes | 1 to 200 of `{ id, type, label?, required?, min?, max?, maxLength? }`. Column `id` matches `^[a-z][a-z0-9_]{0,63}$`, unique. `type`: `string`, `number`, `integer`, `boolean`, `date`, `datetime`, `json` |
| `key` | string[] | no | up to 8 columns used for upserts |
| `retention` | object | yes | at least one of `maxAgeDays` (1 to 3650) and `maxRows` (1 to 5,000,000) |
| `personalData` | object | no | `{ classes: string[], subjectColumn?: string or null }`. With classes, `subjectColumn` names a declared column and `seedRows` are not used |
| `source` | string | no | `workflow`, `agent`, `chat`, `import`, `pack`, `manual` |
| `seedRows` | object[] | no | up to 5000 initial rows |

Workflows fill datasets with a Publish step, agents with the dataset tool, and embedded apps through the bridge.

### Model

| Field | Type | Required | Rules |
|---|---|---|---|
| `id` | string | yes | id pattern |
| `title` | string | no | at most 120 characters |
| `entities` | object | yes | 1 to 3. Each has exactly one of `dataset` (a dataset id) or `connection` (a connection id or `{{param.x}}`). A connection entity needs `query`: one saved SQL statement (no `;`, `--` or `/*`) of at most 4000 characters with `:param` binds, and `params {name: {type: string, number or date, default?}}` |
| `dimensions` | object | yes | up to 100 of `{ entity, column, label?, granularity? }`. `granularity`: list of `day`, `week`, `month`, `quarter`, `year` |
| `measures` | object | yes | 1 to 100 of `{ entity, agg, column?, label?, format? }`. `agg`: `count`, `sum`, `avg`, `min`, `max`, `distinct`. `format`: `number`, `integer`, `percent`, `currency` |
| `filters` | object | no | up to 100 of `{ dimension, op, value?, param?, label? }`. `op`: `eq`, `neq`, `in`, `gt`, `gte`, `lt`, `lte`, `between`, `in_period`, `contains`. Example: `{"dimension": "date", "op": "in_period", "value": "current_month"}` |
| `variables` | object | no | up to 50 of `{ type, default?, label? }`. `type`: `string`, `number`, `date` |
| `joins` | array | no | up to 3 of `{ id, left: {entity, column}, right: {entity, column}, type }`. `type`: `inner` or `left`. Dataset entities only |

Every dataset also gets an automatic model `m-<datasetId>` with every column as a dimension, `count`, and `sum_<col>` and `avg_<col>` for numeric columns.

### Widget

| Field | Type | Required | Rules |
|---|---|---|---|
| `id` | string | yes | id pattern |
| `type` | string | yes | `table`, `chart`, `kpi`, `markdown`, `form` |
| `title` | string | yes | at most 120 characters |
| `source` | object | for table, chart, kpi | `{ model, query }`. See Model query |
| `table` | object | no | `{ columns?: [{ field, label?, width?, format? }] (up to 50), pageSize?: 1 to 200 }` |
| `chart` | object | for chart | a declarative chart specification (JSON). See Chart rules |
| `kpi` | object | for kpi | `{ measure, compare?: { filter, label? }, format?, label? }` |
| `markdown` | object | for markdown | `{ text }`, at most 20,000 characters, no scripts |
| `form` | object | for form | `{ card, target, onSuccess?: { message? }, personalData?: { classes } }`. See Form widgets |
| `interactions` | object | no | cross-filtering: `{ emit?: { dimension }, listen?: boolean }` |
| `actions` | array | no | up to 5 buttons. See Widget actions |

### Model query

| Field | Rules |
|---|---|
| `measures` | at least 1 measure id of the model |
| `dimensions` | up to 4 dimension ids |
| `filters` | named model filters |
| `variables` | values for model variables |
| `order` | `[{ field, dir: "asc" or "desc" }]` |
| `limit` | 1 to 5000 rows, default 500 |
| `granularity` | `{ "<time dimension>": "day" ... "year" }` |

Up to 8 measures and 3 joins per query.

### Chart rules

- Use `mark` (or `layer`) plus `encoding`. `transform` and `config` are allowed.
- Allowed marks: `bar`, `line`, `area`, `point`, `arc`, `circle`, `square`, `tick`, `rect`, `rule`, `text`, `trail`, `boxplot`, `errorbar`, `errorband`, `geoshape`. No `image`.
- No `data`, no `$schema`, no `url`, and no string with `http://`, `https://`, `//`, `data:` or `url(` anywhere.
- Encode fields by the measure and dimension ids of the query.
- For a good 3D view, use a single mark (`bar`, `line`, `area`, `point`, `arc`) with a nominal or temporal x and a quantitative y.

### Form widgets

`card` is an Adaptive Card, version 1.5 or lower, with a subset of elements:

- Elements: `TextBlock`, `RichTextBlock`, `TextRun`, `Container`, `ColumnSet`, `Column`, `FactSet`, `ActionSet`, `Image` (inline `data:` image under 64 KiB only), `Input.Text`, `Input.Number`, `Input.Date`, `Input.Time`, `Input.Toggle`, `Input.ChoiceSet`.
- Actions: exactly one `Action.Submit` at the top level, plus `Action.ShowCard` and `Action.ToggleVisibility`.
- Up to 40 inputs. Input ids match `^[A-Za-z_][A-Za-z0-9_]{0,63}$`.
- Not allowed: `Action.OpenUrl`, `Action.Execute`, `Media`, `ImageSet`, `Table`, `Carousel`, `selectAction`.

`target` is `{ "kind": "workflow", "flowId": "<id>" }` or `{ "kind": "agent", "agentRef": "<ref>", "prompt": "Handle: {{inputs}}" }`.

### Widget actions

`{ id, label (1 to 60), icon?, handler: { type: "workflow" or "agent", ref }, input?: "{{row}}" or "{{selection}}", confirm?, placement?: "row" or "toolbar" }`. A KPI widget only has toolbar actions.

### Dashboard

| Field | Type | Required | Rules |
|---|---|---|---|
| `id` | string | yes | id pattern |
| `title` | string | yes | 1 to 120 characters |
| `icon` | string | no | `LayoutDashboard`, `BarChart3`, `LineChart`, `PieChart`, `Table2`, `Gauge`, `TrainFront`, `Truck`, `Factory`, `Wallet`, `Receipt`, `Users`, `Briefcase`, `ClipboardList`, `Activity`, `Package`, `ShoppingCart`, `Building2`, `Landmark`, `Leaf` |
| `group` | string | no | at most 60 characters, the heading in the navigation |
| `order` | integer | no | default 100 |
| `filters` | array | no | up to 12 of `{ id, model, filter, control, label?, param?, dimension? }`. `control`: `period`, `select`, `text`, `number`. `filter` must exist on the model |
| `layout` | array | yes | up to 40 of `{ widget, x (0 to 11), y (0 or more), w (1 to 12), h (1 to 40), static? }` |

Layout rules: `x + w` is at most 12, widgets do not overlap, each widget appears once. A grid row is 40 px high.

## Full examples

### A sales dashboard pack

`manifest.json`:

```json
{
  "v": 2, "kind": "bundle", "id": "acme.sales-dashboard", "version": "1.0.0", "title": "Sales overview",
  "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
  "requires": { "platform": ">=1.0.0" },
  "parameters": [ { "id": "target_workspace", "type": "workspace", "label": "Workspace", "required": true } ],
  "items": [
    { "kind": "dataset", "schemaVersion": 1, "id": "sales_orders", "scope": "workspace", "workspace": "{{param.target_workspace}}", "spec": { "$ref": "content/dataset.sales_orders.json" } },
    { "kind": "dataset", "schemaVersion": 1, "id": "regions", "scope": "workspace", "workspace": "{{param.target_workspace}}", "spec": { "$ref": "content/dataset.regions.json" } },
    { "kind": "model", "schemaVersion": 1, "id": "sales", "scope": "workspace", "workspace": "{{param.target_workspace}}", "spec": { "$ref": "content/model.sales.json" } },
    { "kind": "widget", "schemaVersion": 1, "id": "revenue_by_region", "scope": "workspace", "workspace": "{{param.target_workspace}}", "spec": { "$ref": "content/widget.revenue_by_region.json" } },
    { "kind": "widget", "schemaVersion": 1, "id": "revenue_this_month", "scope": "workspace", "workspace": "{{param.target_workspace}}", "spec": { "$ref": "content/widget.revenue_this_month.json" } },
    { "kind": "dashboard", "schemaVersion": 1, "id": "sales-overview", "scope": "workspace", "workspace": "{{param.target_workspace}}", "spec": { "$ref": "content/dashboard.sales-overview.json" } }
  ]
}
```

`content/dataset.sales_orders.json`:

```json
{
  "id": "sales_orders",
  "title": "Sales orders",
  "columns": [
    { "id": "order_id", "type": "string", "required": true },
    { "id": "date", "type": "date", "required": true },
    { "id": "region", "type": "string", "required": true, "maxLength": 32 },
    { "id": "product", "type": "string" },
    { "id": "amount", "type": "number", "min": 0 },
    { "id": "units", "type": "integer", "min": 0 }
  ],
  "key": ["order_id"],
  "retention": { "maxAgeDays": 730, "maxRows": 500000 }
}
```

`content/dataset.regions.json`:

```json
{
  "id": "regions",
  "title": "Regions",
  "columns": [
    { "id": "region", "type": "string", "required": true },
    { "id": "manager_team", "type": "string" }
  ],
  "key": ["region"],
  "retention": { "maxRows": 1000 }
}
```

`content/model.sales.json`:

```json
{
  "id": "sales",
  "title": "Sales",
  "entities": {
    "orders": { "dataset": "sales_orders" },
    "regions": { "dataset": "regions" }
  },
  "dimensions": {
    "date": { "entity": "orders", "column": "date", "granularity": ["day", "month", "quarter"] },
    "region": { "entity": "orders", "column": "region", "label": "Region" },
    "team": { "entity": "regions", "column": "manager_team", "label": "Team" }
  },
  "measures": {
    "revenue": { "entity": "orders", "agg": "sum", "column": "amount", "label": "Revenue", "format": "currency" },
    "units": { "entity": "orders", "agg": "sum", "column": "units", "label": "Units", "format": "integer" },
    "orders": { "entity": "orders", "agg": "count", "label": "Orders" }
  },
  "filters": {
    "this_month": { "dimension": "date", "op": "in_period", "value": "current_month", "label": "This month" }
  },
  "joins": [
    { "id": "by_region", "left": { "entity": "orders", "column": "region" }, "right": { "entity": "regions", "column": "region" }, "type": "left" }
  ]
}
```

`content/widget.revenue_by_region.json`:

```json
{
  "id": "revenue_by_region",
  "type": "chart",
  "title": "Revenue by region",
  "source": { "model": "sales", "query": { "measures": ["revenue"], "dimensions": ["region"], "filters": ["this_month"], "limit": 50 } },
  "interactions": { "emit": { "dimension": "region" }, "listen": true },
  "chart": {
    "mark": "bar",
    "encoding": {
      "x": { "field": "region", "type": "nominal" },
      "y": { "field": "revenue", "type": "quantitative" }
    }
  }
}
```

`content/widget.revenue_this_month.json`:

```json
{
  "id": "revenue_this_month",
  "type": "kpi",
  "title": "Revenue this month",
  "source": { "model": "sales", "query": { "measures": ["revenue"], "filters": ["this_month"] } },
  "kpi": { "measure": "revenue", "format": "currency", "label": "Revenue" },
  "interactions": { "listen": true }
}
```

`content/dashboard.sales-overview.json`:

```json
{
  "id": "sales-overview",
  "title": "Sales overview",
  "icon": "BarChart3",
  "group": "Sales",
  "order": 10,
  "filters": [
    { "id": "period", "model": "sales", "filter": "this_month", "control": "period", "label": "Period" }
  ],
  "layout": [
    { "widget": "revenue_this_month", "x": 0, "y": 0, "w": 4, "h": 4 },
    { "widget": "revenue_by_region", "x": 4, "y": 0, "w": 8, "h": 8 }
  ]
}
```

### A form widget that starts a workflow (REST)

```http
POST /api/widgets?workspaceId=ws-sales
Content-Type: application/json

{ "definition": {
    "id": "discount_request", "type": "form", "title": "Request a discount",
    "form": {
      "card": {
        "type": "AdaptiveCard", "version": "1.5",
        "body": [
          { "type": "Input.Text", "id": "customer", "label": "Customer", "isRequired": true },
          { "type": "Input.Number", "id": "percent", "label": "Discount in percent", "min": 1, "max": 30 }
        ],
        "actions": [ { "type": "Action.Submit", "title": "Send" } ]
      },
      "target": { "kind": "workflow", "flowId": "flow_discount_request" },
      "onSuccess": { "message": "Submitted, request {{runId}}" }
    } } }
```

### Pin a chart from chat

`POST /api/charts/pin` turns a chat chart into a dataset, a model and a widget on a dashboard:

```json
{ "workspaceId": "ws-sales", "newDashboardTitle": "My sales", "title": "Units by region",
  "spec": { "mark": "bar", "encoding": {
    "x": { "field": "Region", "type": "nominal" },
    "y": { "field": "Units Sold", "type": "quantitative", "aggregate": "sum" } } },
  "rows": [ { "Region": "North", "Units Sold": 120 }, { "Region": "South", "Units Sold": 95 } ] }
```

## Install and test

### As a pack

Sign and import the pack (see [Packs](/developers/packs)), then activate it with `{"version":"1.0.0","parameters":{"target_workspace":"ws-sales"}}`. On activation the dashboard is created and published. When the pack is retired, objects are removed only if nobody changed them, and a dataset that holds rows is never removed automatically.

### With the REST API

| Call | Permission | Notes |
|---|---|---|
| `POST /api/models`, `PUT /api/models/{id}` | `dashboards.edit_own` | `{definition}` |
| `POST /api/models/{id}/query` | `dashboards.view_own` | run a model query, useful for testing |
| `POST /api/widgets`, `PUT /api/widgets/{id}` | `dashboards.edit_own` | `{definition}`. Saving compiles the query, so an unknown measure fails here |
| `POST /api/dashboards` | `dashboards.edit_own` | `{workspaceId, definition}`, returns a draft |
| `PUT /api/dashboards/{id}/draft` | `dashboards.edit_own` | `{definition, ifVersion}` with the current `draftVersion` |
| `POST /api/dashboards/{id}/publish`, `/rollback {version}`, `/retire` | `dashboards.publish_own` | |
| `POST /api/dashboards/{id}/export` | `dashboards.publish_own` | returns a signed pack |
| `POST /api/dashboards/assist` | `dashboards.edit_own` | `{modelId, intent}`, returns a proposal; nothing is saved |
| `POST /api/dashboards/{id}/share` | `result.share` | read-only share link, 1 to 720 hours |
| `POST /api/widgets/{widgetId}/actions/{actionId}` | `dashboards.view_own` and run rights | runs a widget action |
| `POST /api/charts/pin` | `dashboards.edit_own` | see above |

The workspace comes from `?workspaceId=` or the body's `workspaceId`.

In the UI: **Work > Dashboards**, then Add widget, **Help me build**, Save draft, Publish, Share. In chat, use **Pin to dashboard**.

## Common errors

| Code | Message | Fix |
|---|---|---|
| `VALIDATION` | definition is required | Wrap the object in `{"definition": ...}` |
| `WIDGET_SPEC_INVALID` | /source: a chart widget needs a source (model + query) | Add `source` |
| `WIDGET_SPEC_INVALID` | /source/query/measures: at least one measure | Name a measure of the model |
| `WIDGET_SPEC_INVALID` | /chart/data: a chart fragment must not carry data; the platform injects the query result | Remove `data` |
| `WIDGET_SPEC_INVALID` | /chart: no URLs, $schema or external resources allowed in a chart fragment | Remove `$schema`, `url` and links |
| `WIDGET_SPEC_INVALID` | /chart/mark: a chart fragment needs a mark (or layer) / image marks are not allowed | Use an allowed mark |
| `WIDGET_SPEC_INVALID` | /actions: a KPI widget only has toolbar actions | `"placement": "toolbar"` |
| `WIDGET_SPEC_INVALID` | Action.OpenUrl is not allowed: form cards carry no external links | Stay in the card subset |
| `WIDGET_SOURCE_FORBIDDEN` | Model '...' is not available in this workspace. | Create or import the model first |
| `MODEL_ENTITY_UNKNOWN` | exactly one of dataset or connection / connection entities need a saved query / joins need dataset entities | Fix the entity |
| `DATASET_NOT_FOUND` | Dataset '...' not found. | The model names a missing dataset |
| `DASHBOARD_INVALID` | /layout/0: exceeds the 12-column grid / overlaps widget ... / widget placed twice | Fix `x`, `w` and overlaps |
| `DASHBOARD_INVALID` | /icon: icon must be one of the allowed set | Use an icon from the list |
| `DASHBOARD_INVALID` | /filters: filter '...' is not defined on model '...' | Add the filter to the model |
| `DASHBOARD_VERSION_CONFLICT` | The dashboard draft changed since you loaded it. Reload and retry. | Send the new `draftVersion` |
| `SHARE_CONTAINS_FORM` | Dashboard contains a form widget; forms cannot be shared anonymously. | Remove the form or share internally |
| `EXPORT_CONTAINS_PERSONAL_DATA` | Widget '...' is bound to a dataset snapshot that carries personal data; it cannot be exported. | |
| `FORM_TARGET_INVALID` | The target workflow is paused or not published. | Publish the workflow |

## Limits and editions

- Datasets: up to 200 columns. Models: 3 entities, 100 dimensions, 100 measures, 3 joins. Queries: 5000 rows, 4 dimensions, 8 measures.
- Dashboards: up to 40 widgets and 12 filters. Widgets: up to 5 actions. Forms: up to 40 inputs.
- Widget actions are limited to 30 runs per minute per user and workspace.
- Public share links need the public sharing licence feature.
- Dashboards are controlled by permissions: `dashboards.view_own`, `dashboards.edit_own`, `dashboards.publish_own`.
- Check your edition on [aancer.ai/pricing](https://aancer.ai/pricing).



## Event hooks

A hook is a small JSON object, data and never code, that says: "when platform event X happens in this workspace, and these filter clauses all match, start workflow W or agent A". Events come from a fixed catalog of ten, such as `run.failed`, `approval.decided` and `dataset.rows.published`. Delivery is reliable: each event is recorded, the hook is evaluated, and the handler is started once per hook and event, with retries, dead letters, manual retry and replay. Hooks belong to a workspace, at most 100 per workspace. You create them under **Automations > Hooks**, with the REST API, or ship them in a signed pack as `kind: "hook"`.

Hooks do not call URLs. To notify an external system, let the handler workflow do it with a connector step.

## Quick start

Start a workflow when an approval is rejected.

```json
{
  "id": "rejected_approvals",
  "title": "Rejected approvals",
  "event": { "name": "approval.decided", "version": 1 },
  "filter": [
    { "path": "payload.outcome", "op": "eq", "value": "rejected" }
  ],
  "handler": { "type": "workflow", "ref": "flow_notify_requester" }
}
```

The workflow `flow_notify_requester` must be published with the **AANCER Event** trigger set to the event `approval.decided`. In its steps, use `{{trigger.payload.approvalId}}`, `{{trigger.payload.note}}` and so on.

## File layout

```text
acme-approval-alerts/
  manifest.json          # one hook item, workspace scope
  content/
    hook.json            # the hook spec
```

Manifest item:

```json
{ "kind": "hook", "schemaVersion": 1, "id": "rejected_approvals", "scope": "workspace",
  "workspace": "{{param.target_workspace}}", "spec": { "$ref": "content/hook.json" } }
```

A pack hook must have a workspace. The workflow or agent it names must already exist in that workspace.

## Field reference

JSON Schema: [hook.schema.json](https://aancer.ai/dev/schemas/hook.schema.json)

### Hook spec

| Field | Type | Required | Rules |
|---|---|---|---|
| `id` | string | yes | `^[a-z0-9][a-z0-9._-]{0,63}$`, unique per workspace |
| `workspace` | string | no | a workspace id or `{{param.<id>}}` |
| `title` | string | no | at most 120 characters. Default: the id |
| `event.name` | string | yes | one of the ten event names below |
| `event.version` | integer | no | `1` |
| `filter` | array | no | up to 8 clauses `{ path, op, value? }`. All must match. For "or", write two hooks |
| `handler.type` | string | yes | `workflow` or `agent` |
| `handler.ref` | string | yes | a workflow id, or an agent reference such as `agent:digest` |
| `delivery.atLeastOnce` | boolean | no | |
| `delivery.maxConcurrency` | integer | no | 1 to 20, default 1 |
| `delivery.retry.max` | integer | no | 0 to 10, applied up to the installation's setting (default 3) |
| `delivery.retry.backoffSeconds` | integer[] | no | up to 10 values, each 1 to 86400. Default `[30, 120, 480]`. The last value repeats |
| `enabled` | boolean | no | default `true` |

With the REST API you can also send `dataClassification` (`sovereign`, `internal` or `permitted`): the data class for agent handler runs. Leave it out of pack specs. For a pack hook, a workspace admin sets it after install.

### Filter clauses

- `path`: `actor.role`, or a dot path starting with `payload.` or `resource.`.
- `op`: `eq`, `neq`, `in`, `gt`, `gte`, `lt`, `lte`, `contains`, `exists`.
- `value`: required for every op except `exists`. `in` needs an array. `exists` with `value: false` means "absent".
- Types are strict: `"5"` does not equal `5`. `gt`, `gte`, `lt`, `lte` compare numbers only. `contains` is a case-insensitive substring match on text, or an element match on arrays. A type mismatch is simply false.

### Event catalog

Every handler receives this envelope:

```json
{
  "id": "evt_01",
  "name": "approval.decided",
  "version": 1,
  "workspaceId": "ws-finance",
  "occurredAt": "2026-11-20T10:00:00Z",
  "actor": { "sub": "u_admin", "role": "admin" },
  "resource": { "type": "approval", "id": "apr_01" },
  "payload": { "approvalId": "apr_01", "runId": "run_03", "flowId": "flow_invoices", "outcome": "rejected", "decidedBy": "u_admin", "note": "Amount exceeds budget" },
  "dataCategories": ["CONTACT"]
}
```

| Event | Payload fields (always) | Payload fields (sometimes) |
|---|---|---|
| `run.completed` | `runId`, `flowId` | `flowName`, `durationMs`, `stepCount`, `triggeredBy` |
| `run.failed` | `runId`, `flowId`, `status` (`FAILED`, `INTERNAL_ERROR`, `TIMEOUT`) | `flowName`, `errorRef` |
| `approval.decided` | `approvalId`, `runId`, `outcome` (`approved`, `rejected`), `decidedBy` | `flowId`, `note`, `via` (`web`, `teams`, `slack`) |
| `approval.requested` | `approvalId`, `runId`, `toolId`, `surface`, `expiresAt` | `conversationId` |
| `dataset.rows.published` | `datasetId`, `mode` (`append`, `upsert`, `replace`), `inserted`, `rowCount`, `source` | `updated`, `runId` |
| `dashboard.published` | `dashboardId`, `version`, `publishedBy` | |
| `document.ingested` | `knowledgeSetId`, `documentId` | `fileType`, `bytes`, `ocr` |
| `user.provisioned` | `sub`, `roleName`, `via` (`invite`, `scim`, `sso`, `admin`) | |
| `workspace.member.changed` | `workspaceId`, `sub`, `change` (`added`, `removed`, `role_changed`) | `roleName` |
| `schedule.run.completed` | `taskId`, `runId`, `trigger` (`schedule`, `manual`) | `conversationId`, `agentId` |

Events never carry document content or raw error text. `GET /api/events/catalog` returns the live catalog with schemas and sample events.

### What the handler gets

- **Workflow**: the workflow must be published with the **AANCER Event** trigger. If the trigger names an event, it must be the hook's event. The trigger output is `{ event, eventName, eventId, workspaceId, occurredAt, payload }`, so steps use `{{trigger.event}}` or `{{trigger.payload.datasetId}}`.
- **Agent**: a governed agent run. The task text holds the event name, time, workspace, resource and the payload as JSON.

A delivery counts as delivered when the run starts. If the run fails later, the failure is shown on the delivery, but it is not retried automatically.

## Full examples

### Alert when a dataset receives new rows

```json
{
  "id": "orders_alert",
  "title": "New orders alert",
  "event": { "name": "dataset.rows.published", "version": 1 },
  "filter": [
    { "path": "payload.datasetId", "op": "eq", "value": "sales_orders" },
    { "path": "payload.inserted", "op": "gt", "value": 0 }
  ],
  "handler": { "type": "workflow", "ref": "flow_orders_alert" },
  "delivery": { "maxConcurrency": 1, "retry": { "max": 3, "backoffSeconds": [30, 120, 480] } },
  "enabled": true
}
```

### An agent digest after every completed run, as a pack

```json
{
  "v": 2, "kind": "bundle", "id": "acme.run-digest", "version": "1.0.0", "title": "Run digest",
  "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
  "requires": { "platform": ">=1.0.0" },
  "parameters": [ { "id": "target_workspace", "type": "workspace", "label": "Workspace", "required": true } ],
  "items": [
    { "kind": "hook", "schemaVersion": 1, "id": "run_digest", "scope": "workspace", "workspace": "{{param.target_workspace}}",
      "spec": { "id": "run_digest", "title": "Digest", "event": { "name": "run.completed" }, "handler": { "type": "agent", "ref": "agent:digest" } } }
  ]
}
```

### Failed runs of one workflow, with its own retry schedule

```json
{
  "id": "invoice_run_failed",
  "event": { "name": "run.failed" },
  "filter": [
    { "path": "payload.flowId", "op": "in", "value": ["flow_invoices", "flow_invoices_eu"] },
    { "path": "payload.status", "op": "neq", "value": "TIMEOUT" }
  ],
  "handler": { "type": "workflow", "ref": "flow_open_ticket" },
  "delivery": { "retry": { "max": 3, "backoffSeconds": [60, 300, 900] } }
}
```

## Install and test

### Test the filter first

`POST /api/event-hooks/test` checks a hook against a sample event. It never starts the handler. It needs `hooks.manage_own`.

```http
POST /api/event-hooks/test
Content-Type: application/json

{ "workspaceId": "ws-finance",
  "hook": { "id": "rejected_approvals", "event": { "name": "approval.decided" },
            "filter": [ { "path": "payload.outcome", "op": "eq", "value": "rejected" } ],
            "handler": { "type": "workflow", "ref": "flow_notify_requester" } },
  "sampleEvent": { "id": "evt_1", "name": "approval.decided", "version": 1, "workspaceId": "ws-finance",
                   "occurredAt": "2026-11-20T10:00:00Z", "actor": { "sub": "u_admin", "role": "admin" },
                   "resource": { "type": "approval", "id": "apr_01" },
                   "payload": { "approvalId": "apr_01", "runId": "run_03", "outcome": "rejected", "decidedBy": "u_admin" },
                   "dataCategories": ["CONTACT"] } }
```

Answer: `{"matches": true, "clauses": [{"path": "payload.outcome", "op": "eq", "matched": true}], "errors": []}`. In the UI, the hook editor has a **Test filter** button.

### Create it

| Call | Permission | Notes |
|---|---|---|
| `GET /api/events/catalog` | signed in | events, schemas, samples |
| `POST /api/event-hooks` | `hooks.manage_own` | `{workspaceId, definition}`, returns 201 |
| `GET /api/event-hooks?workspaceId=&event=` | `hooks.view_own` | |
| `PUT /api/event-hooks/{id}` | `hooks.manage_own` | not for pack hooks |
| `POST /api/event-hooks/{id}/enable`, `/disable` | `hooks.manage_own` | enable checks the handler again |
| `DELETE /api/event-hooks/{id}` | `hooks.manage_own` | retire |
| `GET /api/event-hooks/{id}/deliveries?state=` | `hooks.view_own` | `pending`, `delivered`, `failed`, `dead_lettered` |
| `POST /api/event-hooks/{id}/deliveries/{deliveryId}/retry` | `hooks.manage_own` | failed or dead-lettered only |
| `POST /api/event-hooks/{id}/replay {from, to, dryRun?}` | `hooks.manage_own` | up to 30 days and 1000 events |
| `PUT /api/event-hooks/{id}/data-classification` | `workspaces.manage_settings_own` | `{workspaceId, dataClassification}` |

### As a pack

Sign, import and activate the pack (see [Packs](/developers/packs)). Activation creates or updates the hook. Retiring the pack retires it. A pack hook can only be changed with a new pack version, except for its data class.

If the handler workflow is not yet published with an Event trigger, the hook is saved disabled with a warning. Publish the workflow, then enable the hook.

## Common errors

| Code | Status | Message | Fix |
|---|---|---|---|
| `VALIDATION` | 400 | definition is required | Wrap the hook in `{"definition": ...}` |
| `HOOK_FILTER_INVALID` | 400 | /id: must match ^[a-z0-9][a-z0-9._-]{0,63}$ | Lower-case id |
| `HOOK_FILTER_INVALID` | 400 | /id: a hook with this id already exists | Choose another id, or use PUT |
| `HOOK_EVENT_UNKNOWN` | 400 | /event/name: unknown event '...' | Use a catalog name |
| `HOOK_FILTER_INVALID` | 400 | /filter: at most 8 clauses (OR = two hooks) | Split into two hooks |
| `HOOK_FILTER_INVALID` | 400 | /filter/0/path: path must start with payload., resource. or be actor.role | |
| `HOOK_FILTER_INVALID` | 400 | /filter/0/value: in needs an array value / value is required | |
| `HOOK_LIMIT_EXCEEDED` | 422 | At most 100 hooks per workspace. | Retire unused hooks |
| `HOOK_HANDLER_NOT_FOUND` | 422 | Workflow '...' does not exist. / Agent '...' does not exist. | Create it first |
| `HOOK_HANDLER_FORBIDDEN` | 422 | Workflow '...' belongs to another workspace. | Use a handler in the hook's workspace |
| `HOOK_HANDLER_INACTIVE` | 422 | the workflow is not published with an Event trigger | Publish it with the AANCER Event trigger, then enable |
| `HOOK_INVALID` | 400 | /dataClassification: sovereign, internal or permitted | Use one of the three values |
| warning `HANDLER_INACTIVE` |  | the workflow is not published with an Event trigger; deliveries will fail until it is. | Publish it with the AANCER Event trigger, then enable |
| `HOOK_MANAGED_BY_PACK` | 409 | This hook is managed by pack '...'; edit the pack. | Ship a new pack version |
| `DELIVERY_NOT_RETRYABLE` |  | A '...' delivery cannot be retried. | Only failed or dead-lettered deliveries |
| `HOOK_DISABLED` | 409 | A disabled hook cannot replay; enable it first. | |
| `HOOK_REPLAY_WINDOW_INVALID` | 400 | The replay window is limited to 30 days. | Choose `from` and `to` within 30 days |
| `HOOK_REPLAY_TOO_LARGE` | 400 | More than 1000 events match; narrow the window. | Narrow the window |
| delivery `lastError` |  | HANDLER_INACTIVE: Workflow '...' listens to '...', not '...'. | Make the trigger event and the hook event match |
| `PACK_SCHEMA_INVALID` | 422 | /items/.../spec: must NOT have additional properties | For example `dataClassification` in a pack spec. Remove it |

## Limits and editions

- 100 hooks per workspace, 8 filter clauses per hook, 20 concurrent deliveries per hook.
- Replay reaches events the installation still keeps, up to 30 days per replay.
- Hooks are controlled by permissions: `hooks.view_own`, `hooks.manage_own`. Firing a workflow also needs the workflow to be allowed to run.
- Check your edition on [aancer.ai/pricing](https://aancer.ai/pricing).



## Themes

The look of AANCER is a set of design tokens such as `--bg`, `--ac` and `--t0`, defined for seven theme blocks: `light` (default), `dark`, `midnight`, `high-contrast`, `trust-authority`, `legal` and `terminal`. A **theme pack** is a signed pack with one `theme` item. It overrides those tokens and sets the platform name, tagline, fonts, logos, login page and e-mail colours. It is corporate identity as data: no code, no redeploy, nothing loaded from the internet. Fonts and logos ship inside the pack.

A theme can apply to the whole installation (including the login page and invitation e-mails) or to one workspace (the app shell only). A `locale` item in the same pack can rename UI words to match your organisation's vocabulary.

Without a pack, an administrator can set simple branding by hand under **Platform Settings > Branding**.

## Quick start

A theme with tokens only, no files. Use schema version 2.

```json
{
  "v": 2, "kind": "bundle", "id": "acme.ci", "version": "1.0.0", "title": "Acme corporate identity",
  "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
  "requires": { "platform": ">=1.0.0" },
  "items": [
    {
      "kind": "theme", "schemaVersion": 2, "id": "acme-ci", "scope": "install",
      "spec": {
        "id": "acme-ci",
        "platformName": "Acme Cloud",
        "tagline": "Sovereign AI for Acme",
        "defaultTheme": "light",
        "typography": { "ui": "system-ui, sans-serif" },
        "themes": {
          "light": { "--bg": "#FAFAF7", "--s1": "#FAFAF7", "--s2": "#FFFFFF", "--t0": "#1B2430", "--ac": "#0F6E74", "--aci": "#FFFFFF", "--pr": "#0B1F3A" },
          "dark":  { "--bg": "#0E1420", "--s1": "#0E1420", "--s2": "#151C2A", "--t0": "#E9EDF3", "--ac": "#5CC6C9", "--aci": "#0B1F22" }
        },
        "login": { "backgroundColor": "#0B1F3A", "tagline": "Welcome to Acme Cloud", "legalFooter": "Acme Example Ltd" },
        "email": { "headerBackground": "#0B1F3A", "buttonColor": "#0F6E74" }
      }
    }
  ]
}
```

Keep the item `id` and `spec.id` equal.

## File layout

```text
acme-ci/
  manifest.json            # one theme item, "spec": {"$ref": "content/theme.json"}
  content/
    theme.json             # the theme document
    fonts/<name>.woff2     # woff2 only, at most 2 MiB each
    logos/<name>.png       # png, svg, jpg or ico, at most 2 MiB each
```

File names under `fonts/` and `logos/` use lower-case `[a-z0-9._-]` only. `aancer-pack sign` lists every file in `assets` with its hash.

## Field reference

JSON Schema: [theme.schema.json](https://aancer.ai/dev/schemas/theme.schema.json). The root is the version 2 theme. `$defs/themeV1` is the simple branding form and `$defs/locale` is the locale overlay.

### Theme item

| Field | Type | Required | Rules |
|---|---|---|---|
| `kind` | string | yes | `"theme"` |
| `schemaVersion` | integer | yes | `2`. Version `1` is the simple six-field branding form |
| `id` | string | yes | `^[a-z0-9][a-z0-9._-]{0,63}$`, equal to `spec.id` |
| `scope` | string | no | `install` (default) or `workspace`. One active theme per installation and one per workspace |
| `workspace` | string | if scope is `workspace` | a workspace id or `{{param.<id>}}` |
| `spec` | object | yes | the theme document, or `{"$ref": "content/theme.json"}` |

### Theme document (version 2)

| Field | Type | Required | Rules |
|---|---|---|---|
| `id` | string | yes | `^[a-z0-9][a-z0-9._-]{0,63}$` |
| `platformName` | string | yes | 1 to 64 characters. Replaces "AANCER" in the shell and on the login page |
| `tagline` | string | no | at most 120 characters |
| `defaultTheme` | string | no | the block a new user sees first: `light`, `dark`, `midnight`, `high-contrast`, `trust-authority`, `legal`, `terminal` |
| `fonts` | array | no | at most 12 font files |
| `fonts[].family` | string | yes | 1 to 64 characters, the name you use in `typography` |
| `fonts[].src` | string | yes | `content/fonts/<file>.woff2`, a real woff2 file |
| `fonts[].weight` | string | no | for example `"400"` or `"400 700"`. Default `"400"` |
| `fonts[].style` | string | no | `normal` or `italic` |
| `fonts[].display` | string | no | `swap` (default), `block`, `fallback`, `optional`, `auto` |
| `fonts[].unicodeRange` | string | no | at most 200 characters |
| `typography` | object | no | CSS font stacks: `ui`, `mono`, `display`, `label`, each at most 200 characters |
| `logos` | object | no | `light`, `dark`, `monochrome`, `favicon`, `emailHeader`. Each a path under `content/logos/` |
| `themes` | object | yes | keys are theme block ids; `light` is required. Each block maps token to value |
| `login` | object | no | `backgroundColor`, `backgroundImage` (path under `content/logos/`), `tagline` (120), `legalFooter` (500). Install scope only |
| `email` | object | no | `headerBackground`, `bodyBackground`, `textColor`, `buttonColor`, each a colour. Install scope only |

Every family in `typography` must be declared in `fonts` or be a generic family such as `system-ui`, `sans-serif`, `serif`, `monospace`, `ui-monospace`, `ui-sans-serif`, `-apple-system`, `'segoe ui'`, `roboto`, `'helvetica neue'`, `arial`, `menlo` or `consolas`.

Colour values: `#rgb`, `#rrggbb`, `rgb(r,g,b)` or `rgba(r,g,b,a)` with `a` written as `0`, `1` or a decimal such as `0.3` or `.3`. No `var()`, `hsl()` or colour names. `--shadow-card` takes free CSS of at most 200 characters.

The theme document must not contain `http:`, `https:`, `//`, `data:` or `url(` anywhere. This includes text fields such as the tagline and the legal footer. Ship files in `content/` instead.

SVG logos must not contain `<script`, event handler attributes, `<foreignObject` or references to external resources.

### Tokens you can set

| Token | Paints |
|---|---|
| `--bg` | page background |
| `--s0` to `--s4` | surfaces, lowest to highest |
| `--t0`, `--t1`, `--t2` | text: headings, body, muted |
| `--ac`, `--aci`, `--acs`, `--acb` | accent, text on accent, accent surface, accent border |
| `--pr`, `--prs`, `--prb` | primary buttons, surface, border |
| `--te`, `--tei`, `--tes`, `--teb` | success colours |
| `--am`, `--ams`, `--amb` | warning colours |
| `--re`, `--res`, `--reb` | danger colours |
| `--b`, `--bm`, `--bs` | borders: light, medium, strong |
| `--scrollbar` | scrollbar thumb |
| `--anchor`, `--anchor-raised`, `--ink-on-anchor`, `--ink-on-anchor-dim` | the dark navigation rail and its text |
| `--shadow-card` | card shadow |

Fonts are set through `typography`, not tokens. Motion tokens cannot be changed.

### How blocks combine

Tokens you leave out keep the stock value. Your `light` block is applied over the stock light block. Every other block is the stock block, plus your accent colours (`--ac`, `--aci`, `--acs`, `--acb`, `--pr`, `--prs`, `--prb`), plus your own block for that id if you wrote one. The dark blocks (`dark`, `midnight`, `trust-authority`, `terminal`) take the accent from your `dark` block if it sets one. Otherwise AANCER brightens your light accent for dark backgrounds.

### Contrast checks

Every resolved block is checked:

- Text pairs warn below 4.5:1: `--t0` on `--bg`, `--t0` on `--s2`, `--t1` on `--s1`, `--t2` on `--s1`, `--aci` on `--ac`, `--tei` on `--te`, `--ink-on-anchor` on `--anchor`, `--ink-on-anchor-dim` on `--anchor`.
- Interface colours warn below 3:1: `--ac`, `--pr`, `--re`, `--am`, `--te` on `--s1`.
- Import is refused below 1.5:1 for `--t0` on `--bg`, `--t0` on `--s2`, `--aci` on `--ac` and `--ink-on-anchor` on `--anchor`.

### Simple branding (version 1)

| Field | Type | Required | Rules |
|---|---|---|---|
| `platformName` | string | no | 1 to 64 characters |
| `tagline` | string | no | at most 160 characters |
| `logoUrl`, `logoDarkUrl`, `faviconUrl` | string or null | no | a relative path served by the installation, such as `/branding/logo.png` |
| `primaryColor` | string | yes | `#rrggbb`, becomes the accent |
| `secondaryColor` | string | yes | `#rrggbb`, becomes the primary button colour |
| `loginBackgroundColor` | string or null | no | `#rrggbb` |
| `defaultTheme` | string | no | `light`, `dark`, `midnight`, `high-contrast` |

Use version 2 for new work.

### Locale overlay

A `locale` item renames UI strings: `{ "locale": "de", "keys": { "<UI key>": "<text>" } }`.

| Field | Rules |
|---|---|
| `locale` | `en`, `de`, `es` or `ar` |
| `keys` | 1 to 2000 entries. Each key must be an existing UI string key. Each value at most 500 characters |

Values cannot contain `<` or `>` or the names of third-party products. Keys starting with `_meta` are not overridable. Placeholders such as `{{count}}` must match the original string. A locale overlay applies to the whole installation: use install scope, one overlay per locale.

## Full examples

### Theme with a font and logos, scoped to one workspace, plus a locale overlay for the installation

`manifest.json`:

```json
{
  "v": 2, "kind": "bundle", "id": "acme.workspace-ci", "version": "1.0.0", "title": "Acme workspace identity",
  "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
  "requires": { "platform": ">=1.0.0" },
  "parameters": [ { "id": "target_workspace", "type": "workspace", "label": "Workspace", "required": true } ],
  "items": [
    { "kind": "theme", "schemaVersion": 2, "id": "acme-ws-ci", "scope": "workspace", "workspace": "{{param.target_workspace}}",
      "spec": { "$ref": "content/theme.json" } },
    { "kind": "locale", "schemaVersion": 1, "id": "de-words", "scope": "install",
      "spec": { "locale": "de", "keys": { "nav.knowledge": "Wissen" } } }
  ]
}
```

`content/theme.json`:

```json
{
  "id": "acme-ws-ci",
  "platformName": "Acme",
  "tagline": "Your data. Your AI.",
  "defaultTheme": "light",
  "fonts": [
    { "family": "Acme Sans", "src": "content/fonts/acme-sans.woff2", "weight": "400 700", "style": "normal", "display": "swap" }
  ],
  "typography": {
    "ui": "'Acme Sans', system-ui, sans-serif",
    "display": "'Acme Sans', system-ui, sans-serif"
  },
  "themes": {
    "light": {
      "--bg": "#ffffff", "--s0": "#f3f6f7", "--s1": "#ffffff", "--s2": "#ffffff", "--s3": "#f3f6f7", "--s4": "#e6ecee",
      "--t0": "#14232a", "--t1": "#3c4f57", "--t2": "#5b6c73",
      "--ac": "#0f6e74", "--aci": "#ffffff", "--acs": "#e3f2f2", "--acb": "rgba(15,110,116,0.30)",
      "--pr": "#14232a", "--prs": "#e9eef0", "--prb": "rgba(20,35,42,0.30)",
      "--b": "#d3dcdf", "--bm": "#b8c5ca", "--bs": "#8a9aa0", "--scrollbar": "#b8c5ca",
      "--anchor": "#14232a", "--anchor-raised": "#22343c", "--ink-on-anchor": "#ffffff", "--ink-on-anchor-dim": "#c3cfd3",
      "--shadow-card": "0 1px 3px rgba(20,35,42,0.08), 0 4px 14px rgba(20,35,42,0.06)"
    },
    "dark": {
      "--bg": "#0f1a1f", "--s0": "#0a1317", "--s1": "#0f1a1f", "--s2": "#17252b", "--s3": "#1f2f36", "--s4": "#2a3c44",
      "--t0": "#eef3f4", "--t1": "#c3cfd3", "--t2": "#9fb0b6",
      "--ac": "#5cc6c9", "--aci": "#0a1317", "--acs": "#12343a", "--acb": "rgba(92,198,201,0.35)",
      "--pr": "#c3cfd3", "--prs": "#1f2f36", "--prb": "rgba(195,207,211,0.35)",
      "--b": "#2a3c44", "--bm": "#3a4f58", "--bs": "#4e646d", "--scrollbar": "#3a4f58",
      "--anchor": "#081014", "--anchor-raised": "#1f2f36", "--ink-on-anchor": "#eef3f4", "--ink-on-anchor-dim": "#9fb0b6",
      "--shadow-card": "0 1px 3px rgba(0,0,0,0.45), 0 4px 14px rgba(0,0,0,0.3)"
    }
  },
  "logos": {
    "light": "content/logos/logo.png",
    "dark": "content/logos/logo-dark.png",
    "favicon": "content/logos/mark.png"
  }
}
```

The folder also holds `content/fonts/acme-sans.woff2`, `content/logos/logo.png`, `content/logos/logo-dark.png` and `content/logos/mark.png`. `login` and `email` are left out because they apply to install-scoped themes only.

## Install and test

### In the UI

1. **Platform Settings > Extensions > Trust keys > Add trust key**, once per publisher.
2. **Import pack**. The summary lists items, fonts, logos and contrast warnings.
3. **Activate**. Pick the workspace if the theme is workspace-scoped.
4. Reload the browser.

Under **Platform Settings > Look & feel**, an administrator can switch between stock and imported themes, and offer themes for users to choose. Retiring the pack returns to the stock look, or to the manual branding if one was set.

### With the REST API

| Call | Permission |
|---|---|
| `POST /api/extensions/packs/import` (raw bytes) | `extensions.manage` |
| `POST /api/extensions/packs/{packId}/activate {version, parameters}` | `extensions.manage` (`extensions.manage_own` for workspace-only packs) |
| `GET /api/extensions/themes` | lists stock and imported themes |
| `POST /api/extensions/themes/apply {packId or null, version?}` | switch the active theme |
| `PUT /api/extensions/themes/{packId}/offer {offered: true}` | let users choose it |
| `PUT /api/appearance/me {packId or null}` | a user picks an offered theme (`appearance.choose`) |
| `GET /api/branding` | public, the active branding |
| `GET`, `PUT /api/admin/branding` | manual branding without a pack (`platform.configure_branding`) |

While an install-scoped theme pack is active, manual branding is read-only.

Test in an EVAL or test installation first: import shows every contrast warning before anything changes.

## Common errors

| Message | Fix |
|---|---|
| external or inline resources are not allowed (no http, //, data:, url() anywhere) (`THEME_EXTERNAL_ASSET`) | Ship files in `content/`. Remove URLs and `//` from every text, including tagline and footer |
| `/themes/<id>`: unknown theme id | Use one of the seven block ids |
| `/themes/<id>/<token>`: not a themable token | Use a token from the table. Fonts go in `typography` |
| colour must be #rgb, #rrggbb or rgba(r,g,b,a) | No `var()`, `hsl()` or names |
| `/typography/<k>`: font family '...' is not declared in fonts[] and is not a generic family | Declare the font in `fonts` |
| must be a pack file under content/fonts or content/logos | Fix the path. Lower-case file names only |
| fonts must live under content/fonts/ / logos must live under content/logos/ | Move the file |
| `<path>` is not in the pack (`PACK_SIGNATURE_INVALID`) | Add the file and sign again |
| `<path>` is not a woff2 font (`THEME_ASSET_MIME`) | Convert the font to woff2 |
| `<path>`: contains `<script>` / an event handler attribute / references an external resource (`THEME_ASSET_MIME`) | Clean the SVG |
| `<path>` exceeds ... bytes (`THEME_ASSET_TOO_LARGE`) | Fonts and logos at most 2 MiB each |
| `<a>` on `<b>` is illegible (`THEME_ILLEGIBLE`) | Pick colours with more contrast |
| warning `CONTRAST_AA: light --aci on --ac = 3.05:1 (needs 4.5:1)` | Optional, but fix it for readability |
| `THEME_ALREADY_ACTIVE`: Theme pack '...' is already active; retire it first | Retire the other theme, or switch under Look & feel |
| locale: key is not in the shipped bundle (`LOCALE_KEY_UNKNOWN`) | Use an existing UI key |
| locale: markup is not allowed / interpolation slots must match the shipped text | No `<` or `>`; keep the same `{{slots}}` |
| `LOCALE_ALREADY_ACTIVE` | One overlay per locale for the installation |
| locale: vendor names are not allowed in UI copy (`LOCALE_VENDOR_STRING`) | Remove the product name from the text |
| locale: `_meta` keys are not overridable | Remove the key |

## Limits and editions

- Fonts and logos: at most 2 MiB each, 12 fonts per theme. Pack limits apply (see [Packs](/developers/packs)).
- `login` and `email` apply to install-scoped themes only.
- Theme packs are controlled by permissions: `extensions.manage`, `platform.configure_branding`, `appearance.choose`.
- A theme pack changes colours, fonts, logos and names. Removing the "powered by AANCER" attribution is a separate licence feature.
- Check your edition on [aancer.ai/pricing](https://aancer.ai/pricing).



## Embedded apps

An embedded app is a web application that you host yourself, on its own https origin, and that AANCER shows inside its own interface. Customers and partners use it to bring their own tools into AANCER: a shift planner, an order board, a quality checklist, an internal form. The app appears as an entry in the **Dashboards** navigation (and, if you like, as a card on Home), so people reach it next to their dashboards, agents and workflows.

AANCER shows the app in a sandboxed `<iframe>` and talks to it through a `postMessage` protocol called the **bridge** (`aancer-bridge/2`). Through the bridge the app can learn who the user is, read and write named datasets, query a BI model, move the user to another page and show a short notice. Each of these is a **capability**: it works only if the manifest declares it, an administrator approves it, and the user's own permissions in that workspace allow it.

AANCER can also sign the user in to your app without sending any platform token to the browser. The frame gets a one-time code that is valid for 60 seconds. Only your server, holding the app secret and a PKCE verifier, can exchange it for a short-lived token, which it checks against an introspection endpoint.

You ship the app as one `app` item in a signed pack. None of your code runs on the AANCER platform.

## Quick start

1. Host your app at its own origin, for example `https://planner.example.com`. It must not be the same origin as AANCER.
2. Send this header on the embedded page, with your AANCER address:

   ```text
   Content-Security-Policy: frame-ancestors https://aancer.example.com
   ```

3. Write the pack manifest:

   ```json
   {
     "v": 2,
     "kind": "bundle",
     "id": "acme.shift-board",
     "version": "1.0.0",
     "title": "Shift board",
     "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
     "requires": { "platform": ">=1.0.0" },
     "parameters": [ { "id": "target_workspace", "type": "workspace", "label": "Workspace", "required": true } ],
     "items": [
       {
         "kind": "app",
         "schemaVersion": 2,
         "id": "shift-board",
         "scope": "workspace",
         "workspace": "{{param.target_workspace}}",
         "spec": {
           "id": "shift-board",
           "title": "Shift board",
           "icon": "Table",
           "group": "Operations",
           "order": 31,
           "url": "https://planner.example.com/board.html",
           "origin": "https://planner.example.com",
           "sso": { "mode": "none" },
           "capabilities": ["read:dataset:shift_plan"],
           "egress": { "hosts": [] },
           "embed": { "sandbox": ["allow-scripts", "allow-same-origin"] }
         }
       }
     ]
   }
   ```

4. In the page, say hello to the shell and read the dataset:

   ```js
   const PLATFORM = 'https://aancer.example.com';
   const bridge = await AancerBridge.connect({ platformOrigin: PLATFORM });
   const result = await bridge.call('read:dataset', { datasetId: 'shift_plan', limit: 100 });
   render(result.rows);
   ```

   `AancerBridge` is the small helper `bridge.js` from the examples repository (MIT licence). You can also write the messages yourself; see Bridge protocol below.

5. Sign the pack, import and activate it, then approve the app under **Manage app**. The app appears in the Dashboards navigation of that workspace.

## File layout

The pack carries only the manifest. Your app is a normal web application on your own server.

```text
acme-shift-planner/                # the pack
  manifest.json                    # one item of kind "app" (spec inline, or $ref to content/app.json)

shift-planner-app/                 # your app, deployed at https://planner.example.com
  server.mjs                       # serves the pages, redeems the sign-in code, checks tokens
  public/
    index.html                     # the embedded page
    app.js                         # your app logic
    bridge.js                      # bridge helper (frame side)
```

## Field reference

JSON Schema: [app.schema.json](https://aancer.ai/dev/schemas/app.schema.json). `$defs/link` and `$defs/card` cover navigation links and Home cards.

### App item

| Field | Type | Required | Rules |
|---|---|---|---|
| `kind` | string | yes | `"app"` |
| `schemaVersion` | integer | yes | `2` |
| `id` | string | yes | `^[a-z0-9][a-z0-9._-]{0,63}$`. Keep it equal to `spec.id` |
| `scope` | string | no | `workspace` (the app shows in one workspace) or `install` (every workspace). Default `install` |
| `workspace` | string | if scope is `workspace` | a workspace id or `{{param.<id>}}` |
| `spec` | object | yes | the app spec, inline or `{"$ref": "content/app.json"}` |

### App spec

| Field | Type | Required | Rules |
|---|---|---|---|
| `id` | string | yes | `^[a-z0-9][a-z0-9._-]{0,63}$`. Approvals, the app secret and network rules are keyed by it. One active pack per app id |
| `title` | string | yes | 1 to 80 characters. The navigation label and frame title |
| `icon` | string | no | at most 40 characters, an icon name such as `Clock`, `Table` or `Calendar` |
| `group` | string | no | at most 40 characters. The heading the app is listed under in the navigation |
| `order` | integer | no | 0 or more, default 100. Sorting is by group, order, then title |
| `url` | string | yes | https only, 9 to 2048 characters. No user or password, no `#fragment`. The only placeholder is `{{workspace}}` |
| `origin` | string | yes | exactly the origin of `url`: scheme, host and port, no trailing slash |
| `sso` | object | yes | `{ "mode": "code" or "none", "scopes"?: ["profile", "workspace"] }` |
| `capabilities` | string[] | yes | up to 20, unique. See Capabilities. `[]` is valid |
| `egress` | object | no | `{ "hosts": [...] }`: up to 20 extra hosts, `api.example.com` or `*.example.com`. Never `*` |
| `embed` | object | no | `{ "sandbox": [...], "height"?: "full" or "auto" }`: `sandbox` takes up to 5 of `allow-scripts`, `allow-forms`, `allow-same-origin`, `allow-popups`, `allow-downloads` |
| `csp` | object | no | `{ "connectSrc": [...] }`: up to 10 https origins the frame may connect to |
| `workspace` | string | no | a workspace id or `{{param.<id>}}` |

No other fields are allowed.

`url` rules in detail:

- `{{workspace}}` is replaced by the URL-encoded workspace id, but only if the `workspace` identity scope is approved. Otherwise it becomes an empty string.
- The host must not be a loopback, link-local or cloud metadata address. An IP address as host needs the operator to allow private origins; use a DNS name.
- The app origin must differ from the AANCER origin. Use a separate host name such as `planner.example.com`.

### Sign-in modes and scopes

| `sso.mode` | What happens | Default scopes |
|---|---|---|
| `code` | the frame receives a one-time code; your server redeems it and gets the user's identity | `profile`, `workspace` |
| `none` | no sign-in; the app uses the bridge only | none |

| Scope | Gives your app |
|---|---|
| `profile` | user id (`sub`), e-mail, display name |
| `workspace` | workspace id and the user's role label |

The role is a label for display. Do not use it to decide what a user may do. The bridge already applies the user's real permissions.

### Capabilities

| Capability | Lets the app | User permission needed in the workspace |
|---|---|---|
| `read:me` | read the user's identity (within the approved scopes) | none |
| `read:dataset:<id>` | read rows of dataset `<id>` | `datasets.view_own` |
| `write:dataset:<id>` | append or upsert rows in dataset `<id>` | `datasets.write_own` |
| `query:model:<id>` | run a query on BI model `<id>` | `dashboards.view_own` |
| `navigate` | move the user to another AANCER page | none |
| `notify` | show a short notice in AANCER | none |

Dataset ids in capabilities match `[a-z][a-z0-9_]{0,63}` (no dashes). Model ids match `[a-z][a-z0-9_.-]{0,63}`.

A capability works in a session only if it is declared in the manifest, approved by an administrator, and granted when the session starts.

### Sandbox

The frame is `<iframe src="<url>" sandbox="..." referrerpolicy="no-referrer" allow="">`. The default sandbox is `["allow-scripts", "allow-forms", "allow-same-origin"]`. Keep `allow-scripts` and `allow-same-origin`, or the bridge cannot work. Top-level navigation and modal dialogs are never allowed. Add `allow-popups` if your app opens links in a new tab, and `allow-downloads` if it offers file downloads.

## Your server's headers

The embedded page must allow AANCER to frame it:

```text
Content-Security-Policy: frame-ancestors https://aancer.example.com
```

- Accepted sources: the exact AANCER origin, its host, or `*.example.com` / `https://*.example.com` matching the AANCER host. `'none'` refuses.
- Do not send `X-Frame-Options: DENY` or `SAMEORIGIN`.
- The AANCER server checks this header when the app is activated and when it opens, with a HEAD request; it sends a GET only when HEAD answers 404 or 405. Redirects are judged as they are, not followed. The result is cached for 5 minutes per origin.

If the check fails because the header is missing or does not allow AANCER, an approved app opens in a new browser tab at its own URL instead of the frame. The bridge does not exist there. If the app cannot be reached, the user sees a retry card.

We also recommend `default-src 'self'`, `Cache-Control: no-store`, `X-Content-Type-Options: nosniff` and `Referrer-Policy: no-referrer`.

## Bridge protocol

The bridge is `postMessage` between your page (the frame) and the AANCER shell (the parent window).

Rules for your page:

- Post to `window.parent` with the exact AANCER origin as `targetOrigin`. Never `*`.
- Accept a message only when `event.origin` is the AANCER origin and `event.source === window.parent`.
- Every message is an object with `v: 1` and a string `id` that you choose. Answers carry the same `id`.
- Send `hello` within 10 seconds of loading, or the shell shows a "no hello" note.

### Messages

| Direction | Message | Answer |
|---|---|---|
| app to shell | `{ v: 1, id, type: "hello", protocol: "aancer-bridge/2", codeChallenge? }` | `{ v: 1, id, type: "hello-ack", protocol, nonce, capabilities, user, sso }` |
| | | `{ type: "hello-nack", code: "BRIDGE_PROTOCOL_MISMATCH", expected }` when the protocol does not match |
| app to shell | `{ v: 1, id, type: "call", nonce, op, args }` | `{ v: 1, id, type: "result", ok: true, data }` or `{ v: 1, id, type: "result", ok: false, code }` |
| shell to app | `{ v: 1, id, type: "session", state: "revoked", reason }` | none |

The `nonce` from `hello-ack` goes into every `call`.

In `hello-ack`:

- `capabilities`: the capabilities granted to this session.
- `user`: `{ displayName, locale }` with the `profile` scope, otherwise `{ locale }`. For display only.
- `sso`: `{ mode: "code", code, expiresIn }` when you sent a `codeChallenge`; `{ mode: "code" }` when you did not; `{ mode: "code", error }` on a problem; `{ mode: "none" }` for apps without sign-in.

### Operations

| `op` | `args` | `data` | Capability |
|---|---|---|---|
| `read:me` | none | with `profile`: `sub`, `email`, `name`; with `workspace`: `workspaceId`, `role` | `read:me` |
| `read:dataset` | `{ datasetId, limit?, cursor? }`. `limit` default 200, max 500 | `{ rows, nextCursor, total }` | `read:dataset:<id>` |
| `write:dataset` | `{ datasetId, mode, rows }`. `mode` is `append` or `upsert`; `rows` is a non-empty array | `{ written, datasetId }` | `write:dataset:<id>` |
| `query:model` | `{ modelId, query? }`. `query` is a model query (see [Dashboards](/developers/dashboards)) | the query result | `query:model:<id>` |
| `navigate` | `{ path }`, matching `^/[a-z0-9\-/]*$`, for example `/dashboards/sales-overview` | `null` | `navigate` |
| `notify` | `{ text }`, cut to 200 characters and prefixed with the app title | `null` | `notify` |
| `authorize` | `{ codeChallenge }` | `{ code, expiresIn }` | `sso.mode: "code"` |

Writes go through the same path as a workflow Publish step: column checks, quotas, and the `dataset.rows.published` event. So a hook can react to rows your app writes.

### A minimal bridge client

```js
// bridge-min.js: hello plus one call, no dependencies
function connect(platformOrigin, codeChallenge) {
  const pending = new Map();
  let nonce = null;
  const TIMEOUT_MS = 10000; // the shell does not answer a malformed message
  window.addEventListener('message', (event) => {
    if (event.origin !== platformOrigin || event.source !== window.parent) return;
    const msg = event.data;
    if (!msg || msg.v !== 1) return;
    if (msg.type === 'session' && msg.state === 'revoked') { onEnd(msg.reason); return; }
    const p = pending.get(msg.id);
    if (p) { pending.delete(msg.id); p(msg); }
  });
  function send(msg) {
    return new Promise((resolve, reject) => {
      const timer = setTimeout(() => { pending.delete(msg.id); reject(new Error('BRIDGE_TIMEOUT')); }, TIMEOUT_MS);
      pending.set(msg.id, (answer) => { clearTimeout(timer); resolve(answer); });
      window.parent.postMessage(msg, platformOrigin);
    });
  }
  const newId = () => crypto.randomUUID();
  return send({ v: 1, id: newId(), type: 'hello', protocol: 'aancer-bridge/2', codeChallenge })
    .then((ack) => {
      if (ack.type !== 'hello-ack') throw new Error(ack.code || 'HELLO_REFUSED');
      nonce = ack.nonce;
      return {
        capabilities: ack.capabilities, user: ack.user, sso: ack.sso,
        call: (op, args) => send({ v: 1, id: newId(), type: 'call', nonce, op, args })
          .then((r) => { if (!r.ok) throw new Error(r.code); return r.data; }),
      };
    });
}
function onEnd(reason) { document.body.textContent = 'Session ended: ' + reason; }
```

## Sign-in by one-time code

Use `sso.mode: "code"` when your app has its own server and needs to know who the user is. The flow is OAuth 2.0 authorization code with PKCE (S256).

```text
your server            your page (frame)            AANCER shell            AANCER API
    | 1 PKCE pair            |                            |                        |
    |-- challenge ---------->|                            |                        |
    |                        |-- hello + codeChallenge -->|                        |
    |                        |<-- hello-ack (sso.code) ---|                        |
    |<-- code ---------------|                            |                        |
    |-- 3 POST /api/apps/oauth/token (Basic appId:secret, code, verifier) -------->|
    |<-- access_token (5 minutes) -------------------------------------------------|
    |-- 4 POST /api/apps/introspect (Basic appId:secret, token) ------------------>|
    |<-- active, sub, email, name, workspaceId, role ------------------------------|
```

### 1. Make a PKCE pair on your server

The verifier is 43 to 128 characters of `[A-Za-z0-9._~-]`. The challenge is base64url(sha256(verifier)), exactly 43 characters. Keep the verifier on the server. Send only the challenge to the page.

```js
import { randomBytes, createHash } from 'node:crypto';
const verifier = randomBytes(32).toString('base64url');                       // 43 characters
const challenge = createHash('sha256').update(verifier).digest('base64url');  // 43 characters
```

### 2. Get the code in the page

Send `hello` with `codeChallenge`. The `hello-ack` carries `sso.code`. The code is valid for 60 seconds and works once. Post it to your own server.

### 3. Redeem the code on your server

```http
POST https://aancer.example.com/api/apps/oauth/token
Authorization: Basic base64(<app id>:<app secret>)
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=<code>&code_verifier=<verifier>
```

JSON bodies are also accepted. The body must be under 4 kB. Answer:

```json
{ "access_token": "...", "token_type": "Bearer", "expires_in": 300, "scope": "profile workspace", "session_id": "..." }
```

### 4. Check the token on every request

```http
POST https://aancer.example.com/api/apps/introspect
Authorization: Basic base64(<app id>:<app secret>)
Content-Type: application/json

{ "token": "<access_token>" }
```

Answer when valid:

```json
{ "active": true, "token_type": "Bearer", "client_id": "shift-planner", "aud": "shift-planner",
  "sub": "u_123", "email": "jane@example.com", "name": "Jane Doe", "workspaceId": "ws-ops", "role": "Member",
  "scope": "profile workspace", "scopes": ["profile", "workspace"], "sid": "...", "appId": "shift-planner",
  "exp": 1763640000, "iat": 1763639700 }
```

Otherwise `{ "active": false, "reason"? }` with `reason` `revoked`, `ended`, `expired` or `legacy_disabled`. A wrong or missing app secret gets `401 APP_INTROSPECT_UNAUTHORIZED`; after 20 failed attempts within 60 seconds from one address, `429`. You may cache a positive answer for up to 30 seconds. A token becomes inactive after logout, a password change, a change of the user's access, a withdrawn approval, a retired or updated pack, or about 150 seconds after the AANCER frame stops sending its heartbeat (for example after the tab is closed).

### 5. Renew

When introspection says inactive and the user is still in the frame, make a new PKCE pair and call `authorize` through the bridge with the new challenge. Redeem the new code. A new code replaces the previous one; a session can request up to 10 codes in 5 minutes. A token obtained with a code lives at most 600 seconds.

If your server repeats the identical token request within 60 seconds (for example because it lost the answer), it gets a new token, the previous one is revoked and the session stays. Any other reuse of a code ends the user's app session with `code_replayed`.

### Server example (Node.js, no dependencies)

```js
// server.mjs (excerpt): redeem the code and read the user
const PLATFORM = process.env.PLATFORM_ORIGIN;          // https://aancer.example.com
const APP_ID = process.env.APP_ID;                     // shift-planner
const APP_SECRET = process.env.APP_SECRET;             // from "Create app secret"
const basic = 'Basic ' + Buffer.from(`${APP_ID}:${APP_SECRET}`).toString('base64');

async function redeem(code, verifier) {
  const res = await fetch(`${PLATFORM}/api/apps/oauth/token`, {
    method: 'POST',
    headers: { Authorization: basic, 'Content-Type': 'application/x-www-form-urlencoded' },
    body: new URLSearchParams({ grant_type: 'authorization_code', code, code_verifier: verifier }),
  });
  if (!res.ok) throw new Error(`token ${res.status}`);
  return res.json();                                   // { access_token, expires_in, ... }
}

async function introspect(token) {
  const res = await fetch(`${PLATFORM}/api/apps/introspect`, {
    method: 'POST',
    headers: { Authorization: basic, 'Content-Type': 'application/json' },
    body: JSON.stringify({ token }),
  });
  return res.json();                                   // { active, sub, email, name, ... }
}
```

The full server, with sessions and the required headers, is in the examples repository under `examples/apps/shift-planner`.

### Session end

The shell sends `{ type: "session", state: "revoked", reason }` when the app session ends. Reasons: `logout`, `membership_changed`, `access_changed`, `retired`, `withdrawn`, `approval_withdrawn`, `app_updated`, `code_replayed`, `password_changed`, `password_reset`, `not_licensed`. Clear your own session and show a short message.

## Full examples

### App with sign-in, for one workspace

```json
{
  "v": 2,
  "kind": "bundle",
  "id": "acme.shift-planner",
  "version": "2.0.0",
  "title": "Shift planner",
  "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
  "requires": { "platform": ">=1.0.0" },
  "parameters": [ { "id": "target_workspace", "type": "workspace", "label": "Workspace", "required": true } ],
  "items": [
    {
      "kind": "app",
      "schemaVersion": 2,
      "id": "shift-planner",
      "scope": "workspace",
      "workspace": "{{param.target_workspace}}",
      "spec": {
        "id": "shift-planner",
        "title": "Shift planner",
        "icon": "Clock",
        "group": "Operations",
        "order": 30,
        "url": "https://planner.example.com/?ws={{workspace}}",
        "origin": "https://planner.example.com",
        "sso": { "mode": "code", "scopes": ["profile", "workspace"] },
        "capabilities": ["read:me", "read:dataset:shift_plan", "write:dataset:shift_requests", "navigate", "notify"],
        "egress": { "hosts": [] },
        "embed": { "sandbox": ["allow-scripts", "allow-forms", "allow-same-origin"] }
      }
    }
  ]
}
```

### App for every workspace, with a Home card and a navigation link

```json
{
  "v": 2, "kind": "bundle", "id": "acme.ops-apps", "version": "1.0.0", "title": "Operations apps",
  "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" },
  "requires": { "platform": ">=1.0.0" },
  "items": [
    { "kind": "app", "schemaVersion": 2, "id": "shift-planner", "scope": "install",
      "spec": { "id": "shift-planner", "title": "Shift planner", "icon": "Clock", "group": "Operations", "order": 30,
        "url": "https://planner.example.com/embed?ws={{workspace}}", "origin": "https://planner.example.com",
        "sso": { "mode": "code", "scopes": ["profile", "workspace"] },
        "capabilities": ["read:me", "read:dataset:shift_plan", "navigate", "notify"],
        "egress": { "hosts": [] },
        "embed": { "sandbox": ["allow-scripts", "allow-forms", "allow-same-origin"] } } },
    { "kind": "card", "schemaVersion": 1, "id": "shift-card", "scope": "install",
      "spec": { "id": "shift-card", "title": "Shift planner", "body": "Plan next week's shifts.", "href": "app:shift-planner", "icon": "Clock", "order": 10 } },
    { "kind": "link", "schemaVersion": 1, "id": "hr-intranet", "scope": "install",
      "spec": { "id": "hr-intranet", "label": "HR intranet", "url": "https://intranet.example.com/hr", "group": "Operations", "order": 90, "openIn": "new-tab" } }
  ]
}
```

`link` fields: `id`, `label` (1 to 80), `url` (https), `icon`, `group` (40), `order`, `openIn` (`new-tab` only). `card` fields: `id`, `title` (1 to 80), `body` (1 to 280, plain text, no `<` or `>`), `href` (`app:<id>`, `dashboard:<id>` or an https URL, at most 2048 characters), `icon`, `group`, `order`. Home shows up to 6 cards.

### Writing rows from the app

```js
const bridge = await AancerBridge.connect({ platformOrigin: PLATFORM });
await bridge.call('write:dataset', {
  datasetId: 'shift_requests',
  mode: 'append',
  rows: [{ employee: 'u_123', date: '2026-12-01', shift: 'early', note: 'Swap with late shift' }],
});
await bridge.call('notify', { text: 'Your request was sent.' });
await bridge.call('navigate', { path: '/dashboards/shift-overview' });
```

The dataset `shift_requests` must exist in the workspace with matching columns. Ship it in the same pack as a `dataset` item (see [Dashboards](/developers/dashboards)).

## Where the app shows

- **Navigation**: under **Dashboards**, in the group named by `group`, sorted by `order` and then title. The page address is `/dashboards/app/<id>`.
- **Home**: through a `card` item with `"href": "app:<id>"`.
- A workspace-scoped app shows only in its workspace. An install-scoped app shows in every workspace.
- Users need the permission "Open embedded apps" (`apps.view_own`).

## Install and approve

### In the UI

1. **Platform Settings > Extensions > Trust keys > Add trust key**, once per publisher.
2. **Import pack**, then **Activate**, and pick the workspace.
3. Open the pack and choose **Manage app**, then **Approve**. The administrator sees and approves the origin, every capability and the identity scopes.
4. **Create app secret**. It is shown once. Give it to the person who runs your app server, for example as the `APP_SECRET` environment variable.
5. Users open the app from the Dashboards navigation.

The activation also runs the frame check. A warning `APP_EMBED_REFUSED` names the reason: `no_csp` (no `frame-ancestors`), `not_allowed` (AANCER is not among the sources), `xfo` (an `X-Frame-Options` header blocks framing), `unreachable` (the app did not answer) or `egress` (the installation's network rules do not allow the origin).

### With the REST API

Every app manage call (approve, secret, withdraw, frame check, extra hosts) carries the app's `workspaceId`.

| Step | Call | Permission |
|---|---|---|
| Add trust key | `POST /api/extensions/trust-keys {keyId, label, publicKeyPem}` | `extensions.manage` |
| Import | `POST /api/extensions/packs/import` (raw bytes) | `extensions.manage` |
| Activate | `POST /api/extensions/packs/{packId}/activate {version, parameters: {target_workspace: "ws-ops"}}` | `extensions.manage` or `extensions.manage_own` |
| List apps | `GET /api/apps?workspaceId=ws-ops` | `apps.view_own` |
| Approve | `POST /api/apps/{id}/approve {workspaceId?, origins: [origin], capabilities: [...], scopes: [...]}` | `apps.manage_own` in the workspace, or `extensions.manage` for install-scoped apps |
| Create or rotate the secret | `POST /api/apps/{id}/introspect-secret/rotate` returns `201 {secret, previousValidUntil}` | same as approve |
| End the previous secret now | `POST /api/apps/{id}/introspect-secret/previous/end` | same |
| Withdraw approval | `POST /api/apps/{id}/approval/withdraw` | same |
| Run the frame check again | `POST /api/apps/{id}/embed-check/run` | same |
| Allow or remove an extra host | `POST /api/apps/{id}/egress/approve {host}`, `DELETE /api/apps/{id}/egress/{host}` | same |

After a rotation the previous secret stays valid for one hour by default, so you can update your server without downtime.

### Updates

Bump the pack `version`. A new origin, a new capability or a new identity scope must be approved again. Fewer or equal requests need no new approval. Open sessions of the old version end with `app_updated`. Retiring the pack removes approvals, the secret and network rules; a later pack with the same app id starts unapproved.

### Testing

Import and activate the pack in an EVAL or test installation. Open the app, then check: the frame loads (header correct), `hello-ack` arrives (origin correct), each `call` returns `ok: true` (capability approved and user permission present). For sign-in apps, check that your server gets `active: true` from introspection.

## Common errors

Import and manifest errors (path `/items/<itemId>/spec/...`):

| Message | Fix |
|---|---|
| https only (`APP_URL_INVALID`) | Use https |
| origin must equal the URL origin (`APP_URL_INVALID`) | Set `origin` to scheme, host and port of `url`, no trailing slash |
| the app origin must differ from this platform's own address (`APP_URL_INVALID`) | Host the app on its own host name |
| the host is hard-blocked (loopback, link-local or metadata) (`APP_URL_INVALID`) | Use a real DNS name |
| placeholder {{x}} is not allowed (only {{workspace}}) (`APP_URL_INVALID`) | Only `{{workspace}}` |
| credentials in the URL are not allowed / fragments are not allowed | Remove `user:pass@` and `#...` |
| unknown capability '...' (`APP_CAPABILITY_UNKNOWN`) | Use the capability list. Dataset ids have no dashes |
| a bare wildcard is not allowed (`APP_EGRESS_WILDCARD`) | `api.example.com` or `*.example.com` |
| sandbox token '...' is not allowed | Only the five tokens listed |
| must have required property 'sso' | Add `sso` |
| warning `APP_WORKSPACE_PLACEHOLDER_EMPTY` | Add `"workspace"` to `sso.scopes`, or drop `{{workspace}}` from the URL |
| `APP_ID_TAKEN`: The app id '...' is already used by the active pack '...' | Retire that pack, or use another app id |

Runtime errors:

| Code | Message | Fix |
|---|---|---|
| `FEATURE_NOT_LICENSED` | Embedded apps are not included in the licence of this installation. | The installation needs the Embedded apps licence feature |
| `APP_NOT_FOUND` | App '...' is not active in this workspace. | Activate the pack for this workspace |
| `APP_ORIGIN_UNAPPROVED`, `APP_CAPABILITIES_CHANGED` | App '...' has changes an administrator must approve first. | Approve under Manage app |
| `APP_SECRET_MISSING` | App '...' has no app secret yet. | Create the app secret |
| `APP_EMBED_REFUSED` | The app has not allowed this platform to embed it (frame-ancestors). Reason `no_csp`, `not_allowed`, `xfo`, `unreachable` or `egress` | Fix the header, remove `X-Frame-Options`, or allow the origin in the network rules |
| `APP_INTROSPECT_UNAUTHORIZED` (401) | Introspection is not authorised. | Send HTTP Basic with the app id and the current app secret |
| `SSO_NOT_ENABLED` (409) | This app does not use sign-in by one-time code. | Set `sso.mode: "code"` |
| `APP_SESSION_INVALID` | The app session is not valid. | Reopen the app |
| `APP_PKCE_REQUIRED` | A PKCE challenge is required: a codeChallenge of 43 base64url characters. | Send an S256 challenge |
| `APP_AUTHORIZE_RATE_LIMITED` | Too many sign-in codes were requested for this app session. | Renew only when introspection says inactive |
| `CAPABILITY_NOT_DECLARED` | The app did not declare '...'. | Declare it and ship a new version |
| `CAPABILITY_FORBIDDEN` | '...' is not approved for this app session. / Your seat lacks ... in this workspace. | Approve it, or give the user the permission |
| `APP_WRITE_MODE_INVALID` | Apps may only append or upsert. | Use `append` or `upsert` |
| `APP_WRITE_ROWS_INVALID` | rows must be a non-empty array. | |
| `NAVIGATE_REFUSED` | | Use an AANCER path such as `/dashboards/...` |
| `BRIDGE_UNAVAILABLE` | | AANCER could not be reached; retry |
| token `invalid_client` (401) | Client authentication failed: send HTTP Basic with the app id and the app secret. | Check `APP_ID` and `APP_SECRET` |
| token `invalid_grant` (400) | The code is not valid (unknown, expired, already used, or not issued for this app and verifier). | Get a new code through `authorize` |
| token `invalid_request` (400) | code and code_verifier are required; the verifier is 43 to 128 unreserved characters. | |
| token `unsupported_grant_type` (400) | Only grant_type=authorization_code is supported. | |
| token `429` | Too many failed attempts from this address. | Wait a minute, then retry with the correct app secret |
| token `503` | The sign-in service is briefly unavailable. | Retry |

## Limits and editions

- Up to 20 capabilities and 20 extra hosts per app. The sign-in code lives 60 seconds; tokens live 5 minutes by default.
- Embedded apps need the Embedded apps licence feature. Without it, apps do not show and their calls are refused.
- Users need `apps.view_own`. Approving needs `apps.manage_own`, or `extensions.manage` for install-scoped apps.
- Check your edition on [aancer.ai/pricing](https://aancer.ai/pricing).



## Connectors

A connector is an integration with one external system: a set of actions and triggers that workflows, agents, chat tools and knowledge sources call. AANCER offers 750+ connectors. Most of them come from the connector library that ships with each release, and an administrator installs them from the catalog with one click and no restart.

You can build your own connector for a system that is not covered, such as an in-house ERP or a regional service. A connector is written in TypeScript with the AANCER connector framework (`@aancer/connector-framework`). The framework comes with the developer kit, with full TypeScript declarations (node10 and node16 module resolution) and a scaffold. A connector written against it builds against the runner's own copy of the framework during certification, so the pack ships without a bundled copy. A connector reaches an installation as a signed **connector pack**: a pack with exactly one `connector` item, which `aancer-pack` builds from your code.

Connector code runs inside AANCER, so the rules are stricter than for other packs. **Connector packs for production are signed by AANCER through certification.** Partners build and test the connector, then submit it. AANCER reviews it, builds the archive and signs the pack. On every edition except the developer edition, a connector pack signed with any other key is refused.

**On the developer edition you sign your own connectors.** Sign the pack with your developer key and it installs on your installation only: the pack is bound to that installation's install id, and both the gateway and the connector runner check it. Remove the key and the connector stops. To ship the connector to customers, submit it for certification.

Outbound network access is denied by default. A connector can reach only the hosts it declares, and only after an administrator clicks **Enable**.

## Quick start

Start from the scaffold, `aancer-pack init connector <name>`, or write it by hand. A connector with one action that echoes its input.

`package.json`:

```json
{
  "name": "@aancer/piece-example-echo",
  "version": "0.1.0",
  "main": "./dist/src/index.js",
  "dependencies": {
    "@aancer/connector-framework": "^0.33"
  }
}
```

`src/index.ts`:

```ts
import { createConnector, createAction, Property, ConnectorAuth } from '@aancer/connector-framework';

const echo = createAction({
  name: 'echo',
  displayName: 'Echo',
  description: 'Returns the text you send.',
  props: {
    text: Property.ShortText({ displayName: 'Text', required: true }),
  },
  async run({ propsValue }) {
    return { text: propsValue.text };
  },
});

export const connector = createConnector({
  displayName: 'Example echo',
  auth: ConnectorAuth.None(),
  minimumSupportedRelease: '0.82.0',
  logoUrl: 'https://cdn.example.com/echo.png',
  authors: ['acme'],
  actions: [echo],
  triggers: [],
});
```

`pack.json`:

```json
{
  "displayName": "Example echo",
  "description": "Echoes its input back. Useful to test connector install.",
  "category": "Developer",
  "egressHosts": []
}
```

Submit these files for certification. The result is a signed connector pack that any AANCER installation accepts.

## File layout

What you write:

```text
example-echo/
  package.json         # name @aancer/piece-<name>, version x.y.z, main ./dist/src/index.js
  package-lock.json    # locked runtime dependencies
  pack.json            # pack metadata, see below
  tsconfig.json
  src/
    index.ts           # createConnector(...) export
    lib/*.ts           # actions and triggers
  test/*.ts
```

What the certified pack contains:

```text
conn.example-echo-0.1.0.ancpack
  MANIFEST.json        # pack manifest with one connector item
  MANIFEST.sig         # AANCER platform signature
  content/<archive>    # the built connector, written by the build
```

## Field reference

JSON Schema: [connector.schema.json](https://aancer.ai/dev/schemas/connector.schema.json) (the connector item spec)

### pack.json

| Field | Type | Required | Rules |
|---|---|---|---|
| `displayName` | string | yes | 1 to 80 characters. The name in the catalog |
| `title` | string | no | pack title. Default `<displayName> connector` |
| `description` | string | no | at most 300 characters. Default: the `package.json` description |
| `category` | string | no | `AI`, `Comms`, `Commerce`, `Core`, `Business`, `Finance`, `Productivity`, `Content`, `Developer`, `Support`, `Forms`, `HR`, `Payments`, `Marketing`, `Sales`, `Other`. Default `Other` |
| `licence` | string | no | `"required"` for a paid connector bound to one customer licence. Leave it out for a free connector. A paid connector's pack version gets the suffix `-l<first 8 hex of the licence id>` |
| `framework` | string | no | `major.minor` of the connector framework the connector is built against |
| `egressHosts` | string[] | no | at most 64 fixed hosts the connector calls. Default `[]` |
| `egressFromConnection` | object | no | `{ hostProp, portProp, defaultPort }`: take the host from the connection settings. For systems each customer hosts themselves |

### Connector item spec

This is what certification writes into the pack. You do not write it by hand, but it shows exactly what the installation checks.

| Field | Type | Required | Rules |
|---|---|---|---|
| `pieceName` | string | yes | `@aancer/piece-<name>`, name `^[a-z0-9][a-z0-9-]{1,62}$`. Must be unique on the installation |
| `pieceVersion` | string | yes | strict `x.y.z`, no pre-release |
| `displayName` | string | yes | 1 to 80 characters |
| `description` | string | no | at most 300 characters |
| `category` | string | yes | see the category list above |
| `archive` | string | yes | set by the build; do not edit |
| `framework` | string | yes | `major.minor` of the connector framework, written by certification |
| `egressHosts` | string[] | yes | at most 64. Hostname with optional `*.` prefix and `:port`. A bare `*` is refused |
| `egressFromConnection` | object | no | `{ hostProp (1 to 64), portProp (1 to 64), defaultPort (1 to 65535) }` |
| `licenceId` | string | no | lower-case UUID of the customer licence for a paid connector. Absent means free |
| `deps` | array | yes | the bill of materials: up to 2000 of `{ name, version, license }` |
| `build` | object | no | build facts recorded by certification |
| `knowledgeSource` | object | no | for a connector that feeds knowledge sets: `{ contract: 1, label (1 to 40), actions: { list, item, download, estimate? }, siteProps? (up to 5), sharedConnectionView? }`. Action names match `^[a-z][a-z0-9_]{0,63}$` |
| `metadata` | boolean | no | `true` when the archive root holds `aancer-metadata.json` |

No other fields are allowed.

### Network egress

There are two ways to let a connector reach the network:

1. **Fixed hosts** (`egressHosts`): for a cloud API such as `api.example.com` or `*.example.org`. When an administrator clicks **Enable**, these hosts are added to the installation's allow-list.
2. **Host from the connection** (`egressFromConnection`): for a system each customer runs, such as an on-premises database. The administrator types host and port into the connection and switches its egress on. Only that `host:port` is allowed. Loopback, link-local and cloud metadata addresses are always blocked.

Disable or uninstall removes the grant. Connections and credentials are kept.

### Authentication

The connector carries its own authentication: `ConnectorAuth.None()`, `ConnectorAuth.SecretText(...)`, `ConnectorAuth.CustomAuth({ props: {...} })` or the framework's OAuth2 properties. Secrets are stored encrypted in the connection.

### Build rules

Certification refuses a connector that breaks any of these rules. Check them before you submit:

- No `install`, `preinstall`, `postinstall` or `prepare` scripts in any dependency.
- No native add-ons (`*.node`, `binding.gyp`, `prebuilds/`), no symlinks.
- Do not bundle the connector framework itself.
- `npm audit --omit=dev` reports 0 vulnerabilities.
- Dependency licences: MIT, ISC, BSD-2-Clause, BSD-3-Clause, Apache-2.0 or 0BSD.
- The built connector loads without network access.
- At most 2000 packages, 20,000 files and 32 MiB per file.
- `package-lock.json` is committed.

## Full examples

### A paid connector for a customer-hosted database

`pack.json`:

```json
{
  "title": "Example ERP connector",
  "displayName": "Example ERP",
  "description": "Read-only orders, invoices, production status and customers from the ERP database.",
  "category": "Business",
  "licence": "required",
  "egressHosts": [],
  "egressFromConnection": { "hostProp": "server", "portProp": "port", "defaultPort": 1433 }
}
```

The connection properties in the connector must include `server` and `port`:

```ts
import { ConnectorAuth, Property } from '@aancer/connector-framework';

export const erpAuth = ConnectorAuth.CustomAuth({
  displayName: 'ERP connection',
  required: true,
  props: {
    server: Property.ShortText({ displayName: 'Server', required: true }),
    port: Property.Number({ displayName: 'Port', defaultValue: 1433, required: true }),
    database: Property.ShortText({ displayName: 'Database', required: true }),
    username: Property.ShortText({ displayName: 'User name', required: true }),
    password: ConnectorAuth.SecretText({ displayName: 'Password', required: true }),
  },
  validate: async () => ({ valid: true }),
});
```

### The signed manifest of a free connector

```json
{
  "v": 2,
  "kind": "bundle",
  "id": "conn.example-echo",
  "version": "0.1.0",
  "title": "Example echo connector",
  "publisher": { "name": "Evntx FZCO", "keyId": "platform-<12 hex>" },
  "parameters": [],
  "assets": [
    { "path": "<set by the build>", "sha256": "<64 hex characters>", "contentType": "application/x-tar" }
  ],
  "items": [
    {
      "kind": "connector",
      "schemaVersion": 1,
      "id": "example-echo",
      "scope": "install",
      "spec": {
        "pieceName": "@aancer/piece-example-echo",
        "pieceVersion": "0.1.0",
        "displayName": "Example echo",
        "description": "Echoes its input back. Useful to test connector install.",
        "category": "Developer",
        "archive": "<set by the build>",
        "framework": "<major.minor>",
        "egressHosts": ["api.example.com"],
        "deps": [{ "name": "ms", "version": "2.1.3", "license": "MIT" }]
      }
    }
  ]
}
```

## Install and test

### Test on your developer edition

```bash
aancer-pack connector check my-connector              # checks the code and the manifest
aancer-pack connector run echo my-connector --props props.json   # runs one action locally
aancer-pack dev my-connector --target http://localhost --trust-key-on-target --watch
```

`aancer-pack dev` signs the pack with your developer key, installs it on your developer edition and does it again on every save. `--trust-key-on-target` adds your public key there as a developer key the first time.

### Submit for certification

Build and test the connector with the connector kit on your own machine. Then submit the source folder through the [AANCER partner programme](https://aancer.ai/partners). AANCER runs the build rules, a security review and the archive checks, then signs the pack with the platform key. You get back a `conn.<name>-<version>.ancpack` file.

### Install a certified connector pack

| Action | UI | API |
|---|---|---|
| Upload the pack | Admin > Connectivity > Connectors > **Add from files**, or Platform Settings > Extensions > **Import pack** | `POST /api/extensions/packs/import?activate=1` with the raw `.ancpack` bytes (`extensions.manage`) |
| Install from the release library | Catalog > **Install** | `POST /api/admin/connectors/install {"ids": ["<catalog id>"]}` (`connectors.install`) |
| Enable network access | Catalog > **Enable** | `POST /api/admin/connectors/{id}/enable` |
| Disable | Catalog > **Disable** | `POST /api/admin/connectors/{id}/disable` |
| Uninstall | Catalog > **Uninstall** | `POST /api/admin/connectors/uninstall {"ids": [...]}` |
| Browse | Admin > Connectivity > Connectors | `GET /api/admin/connectors/browse` (`connectors.view`) |

An installed connector is usable about 90 seconds later. No restart is needed. Then create a connection, and use the connector in a workflow, an agent or chat.

## Common errors

| Code | Message | Fix |
|---|---|---|
| `PACK_SIGNER_NOT_ALLOWED` | Connector packs must be signed by the platform key. This pack was signed by another key. | Submit the connector for certification |
| `PACK_SCHEMA_INVALID` | `/egressHosts/0: a bare '*' is not allowed; name the hosts` | List the real hosts |
| `PACK_SCHEMA_INVALID` | `/egressHosts/0: must be a hostname (optionally *.domain and :port)` | No scheme or path, just the host |
| `PACK_SCHEMA_INVALID` | `/items: a connector pack carries no other kinds` | Put other items in a separate pack |
| `PACK_CONTENT_FORBIDDEN` | The connector archive contains forbidden content: ... native addon (*.node) | Remove native dependencies |
| `PACK_PIECE_NAME_TAKEN` | A connector named ... is already installed on this platform. | Choose a unique connector name |
| `PACK_VERSION_CONFLICT` | Pack ... is already imported with different content. Bump the version. | Raise `version` in `package.json` |
| `PACK_LICENCE_REQUIRED` | This connector pack needs an active licence. | Activate the licence first |
| `PACK_LICENCE_MISMATCH` | This connector pack was issued for a different licence. | Request a pack issued for this installation |
| `CONNECTOR_NOT_INSTALLED` | Install this connector first, then enable it. | |
| `CONNECTOR_LICENCE_REQUIRED` | This connector is not part of your licence. | |
| `CREDENTIAL_REQUIRED` | Add the provider API key first. | Configure the connector |
| `EXTENSION_REFERENCED` | Enabled flows use this connector: ... | Disable those workflows first |
| Validation | A connector must declare at least one allowed egress host before it can be enabled. | Add `egressHosts` or `egressFromConnection` |

## Limits and editions

- One connector per pack. Archive at most 96 MiB, unzipped at most 128 MiB.
- Connectors are installation-wide. There is no per-workspace install.
- Connector packs are signed by AANCER through certification. Partners submit them.
- Some catalog connectors are licensed and can be installed but not enabled without the matching licence feature. Paid partner connectors are bound to one customer licence.
- Check your edition on [aancer.ai/pricing](https://aancer.ai/pricing).



## REST API and MCP

AANCER has two programmable surfaces. The **REST API** under `/api` manages everything on these pages: packs, agents, templates, skills, dashboards, hooks and embedded apps. The **MCP server** at `/mcp/v1` lets external AI clients, such as Claude, ChatGPT or your own agent, find and ask AANCER agents and use tools an administrator has approved. AANCER can also act as an MCP client: administrators register external MCP servers and approve their tools one by one, so agents and workflows can use them.

Packs are always created on your machine, signed with the `aancer-pack` CLI, and installed through the REST API or the admin screens. No MCP tool creates, validates or installs a pack.

## Quick start

Import and activate a pack:

```bash
export AANCER=https://aancer.example.com
curl -X POST "$AANCER/api/extensions/packs/import" \
  -H "Authorization: Bearer $TOKEN" \
  --data-binary @acme.business-skills-1.0.0.ancpack

curl -X POST "$AANCER/api/extensions/packs/acme.business-skills/activate" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"version":"1.0.0"}'
```

Ask an AANCER agent over MCP:

```bash
curl -X POST "$AANCER/mcp/v1" \
  -H "Authorization: Bearer $MCP_TOKEN" -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"my-client","version":"1.0"}}}'
```

## REST API basics

- Base address: `https://<your installation>/api`.
- Authentication: the browser session, or a bearer token issued by the identity provider your installation uses for sign-in.
- Bodies are JSON unless stated. Pack import takes the raw `.ancpack` bytes.
- Errors have the shape `{ "error": "<message>", "code": "<CODE>", "details"?: [...] }`. Validation details are `{ itemId?, path, message }` with paths like `/items/<itemId>/spec/<field>`.
- Every call checks the caller's permissions in the workspace. A missing permission returns 403 `{ "error": "Permission denied", "permission": "<name>" }`, without a `code`.
- Coming in this release: a machine-readable OpenAPI 3.1 description of the API at `GET https://<your installation>/api/openapi.json`. It needs a signed-in user (401 otherwise). Each operation names the permission it needs in `x-aancer-permission`. Request bodies are described generically (object or binary), not field by field.

## Endpoint reference

### Packs and extensions

| Method and path | Permission | Body and answer |
|---|---|---|
| `POST /api/extensions/packs/import` | `extensions.manage` | raw `.ancpack` bytes. Add `?activate=1` to activate in the same call. `201` new or `200` known, with `{ packId, version, title, state, signer, items[], parameters[], upgradeFrom, warnings[], certification?, revocation?, keptBehind? }` |
| `POST /api/extensions/packs/validate` (coming in this release) | `extensions.manage` | the same upload as an import. Runs exactly the import's checks and stores nothing. Valid: `200 { "valid": true, "summary": ... }` with the summary an import shows. Refused: the same status and error body an import would give. Import size limit applies (`413 PACK_TOO_LARGE`); 10 calls per user per minute (`429` with `Retry-After`) |
| `POST /api/extensions/packs/{packId}/activate` | `extensions.manage` or `extensions.manage_own` | `{ version, parameters?: { <id>: "<value>" or null } }`. `null` unbinds an optional parameter. Answer `{ packId, activeVersion, previousVersion, objects, warnings? }` |
| `POST /api/extensions/packs/{packId}/rollback` | `extensions.manage` | `{ version }` |
| `POST /api/extensions/packs/{packId}/retire` | `extensions.manage` | |
| `GET /api/extensions/packs` | `extensions.view` | filter with `state`, `kind`, `workspaceId` |
| `GET /api/extensions/packs/{packId}` | `extensions.view` | detail with every version |
| `GET /api/extensions/objects` | `extensions.view` | installed objects; filter with `kind`, `workspaceId`, `state`, `packId` |
| `GET /api/extensions/schemas` | `extensions.view` | supported kinds and schema versions |
| `GET /api/extensions/export-key` | signed in | `{ available }`: whether this installation can sign exports |
| `POST /api/extensions/packs/{packId}/revocation-override` | `extensions.manage` | `{ version, reason }`: keep a withdrawn version running |
| `DELETE /api/extensions/packs/{packId}/revocation-override` | `extensions.manage` | `{ version }`: end that decision |
| `GET /api/extensions/trust-keys` | `extensions.view` | list of trusted keys |
| `POST /api/extensions/trust-keys` | `extensions.manage` | `{ keyId, label?, publicKeyPem }`, answers `201` |
| `DELETE /api/extensions/trust-keys/{keyId}` | `extensions.manage` | answers `204` |
| `POST /api/extensions/packs/scan-dir` | `extensions.manage` | import packs from the server folder |

To test a pack, import it into a developer, EVAL or test installation: import is installation-wide, checks everything and changes nothing until you activate. A pack that contains workflow templates also passes the template permission check on activate and rollback.

### Other areas

| Area | Base path | Details |
|---|---|---|
| Agents | `/api/agents` | [Agents](/developers/agents) |
| Workflow templates | `/api/automations/templates/authored` | [Templates](/developers/templates) |
| Workflows | `/api/automations` | [Templates](/developers/templates) |
| Skills | `/api/skills` | [Skills](/developers/skills) |
| Datasets, models, widgets, dashboards | `/api/models`, `/api/widgets`, `/api/dashboards`, `/api/charts/pin` | [Dashboards](/developers/dashboards) |
| Event hooks | `/api/event-hooks`, `/api/events/catalog` | [Hooks](/developers/hooks) |
| Embedded apps | `/api/apps` | [Embedded apps](/developers/apps) |
| Connectors | `/api/admin/connectors` | [Connectors](/developers/connectors) |
| Themes and branding | `/api/extensions/themes`, `/api/branding` | [Themes](/developers/themes) |

## MCP server

This section is about the MCP server of your own AANCER installation, which gives assistants access to your workspace. For building extensions, use the public AANCER Builder server at `https://aancer.ai/mcp` instead (see [the overview](/developers#connect-the-aancer-builder-mcp-server)).

AANCER speaks the Model Context Protocol over Streamable HTTP, JSON-RPC 2.0, protocol version `2025-06-18`.

- Endpoint: `POST https://<your installation>/mcp/v1`
- Header: `Authorization: Bearer mcp_<64 hex characters>`
- After `initialize`, send the `Mcp-Session-Id` header you received.
- Methods: `initialize`, `notifications/initialized`, `tools/list`, `tools/call`, `resources/list`, `resources/read`.
- `DELETE /mcp/v1` ends the session. `GET /mcp/v1` answers `405`.

### Tools

| Tool | Arguments | What it does |
|---|---|---|
| `find_agent` | `{ query }` | finds agents the token may use |
| `ask_agent` | `{ agent, message, conversationId? }` | runs an agent and returns its answer |
| `list_agent_runs` | `{ agent? }` | lists recent runs |
| approved tools | as approved | external MCP tools that an administrator approved and marked as shareable |

Governance stays in force. When an agent wants to write and the write needs a person's approval, `ask_agent` returns `status: "approval_required"` with an `approvalUrl`. Answers above the workspace's data classification are withheld and only the run id is returned.

Resources: knowledge sets the token may read, as `aancer://kb/<setId>`.

### Tokens

| Token | Who creates it | Call | Scope |
|---|---|---|---|
| Personal | any user with `mcp.tokens_own` in the workspace; the installation needs the licence features `chatSurfaces` and `mcpServerFacade` | `POST /api/me/mcp-tokens { workspaceId, name, expiresInDays }` (`name` required, up to 100 characters; 1 to 365 days, default 90) returns `201 { id, token, expiresAt }` | the agent tools |
| Facade | an administrator with `mcp.facade.issue_token` | `POST /api/admin/mcp/facade/tokens` returns `201 { id, token }` | chosen tools and resources |

The token value is shown once. Store it like a password.

Facade token body:

```json
{
  "displayName": "Claude for the finance team",
  "workspaceId": "ws-finance",
  "allowedOrigins": ["https://claude.ai"],
  "scope": {
    "tools": ["mcp.crm.lookup_account"],
    "resources": ["aancer://kb/ks_policies"]
  },
  "dataClassification": "internal"
}
```

`GET /api/admin/mcp/facade/exposable?workspaceId=ws-finance` lists the tools and resources you can put in `scope`. If you set `allowedOrigins`, browser requests must send a matching `Origin` header. `dataClassification` is `sovereign`, `internal` or `permitted`.

### Connect an MCP client

Most clients take a server address and a header. For example:

```json
{
  "mcpServers": {
    "aancer": {
      "type": "http",
      "url": "https://aancer.example.com/mcp/v1",
      "headers": { "Authorization": "Bearer mcp_0123456789abcdef..." }
    }
  }
}
```

Then ask the client: "Use find_agent to find the invoice agent, then ask it to summarise this week's open invoices."

### AANCER as an MCP client

Administrators register external MCP servers under `/api/admin/mcp/servers` with `{ displayName, endpointUrl, transport: "streamable-http", authMode: "bearer" or "none", credential?, openEgress? }`. The rate limit is not part of the body; a new server starts at 60 calls per minute. They then approve each tool with a data classification ceiling, an approval requirement, the workspaces that may use it and a budget per call. Approved tools appear as `mcp.<serverId>.<toolName>` and can be used in agents and workflows. Network access to the server goes through the installation's allow-list.

## Full example: build, sign, install and use

```bash
# 1. write manifest.json and content/ (see the page for your extension type)
# 2. sign
aancer-pack sign manifest.json content/ -o acme.invoice-desk-1.0.0.ancpack --key acme.key
aancer-pack verify acme.invoice-desk-1.0.0.ancpack --pubkey acme.pub

# 3. import into a test installation and read the summary
curl -s -X POST "$AANCER/api/extensions/packs/import" \
  -H "Authorization: Bearer $TOKEN" --data-binary @acme.invoice-desk-1.0.0.ancpack | jq '.items, .warnings'

# 4. activate
curl -s -X POST "$AANCER/api/extensions/packs/acme.invoice-desk/activate" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"version":"1.0.0","parameters":{"target_workspace":"ws-test","policies":"ks_booking_rules"}}'

# 5. create an agent from the blueprint
curl -s -X POST "$AANCER/api/agents" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"workspaceId":"ws-test","name":"Invoice clerk","blueprintId":"pack:acme.invoice-desk:invoice-clerk"}'
```

## Common errors

| Code | Status | Message | Fix |
|---|---|---|---|
| `PACK_UNSIGNED` | 422 | This pack is not signed (MANIFEST.sig is missing). | Sign with `aancer-pack sign` |
| `PACK_SIGNATURE_INVALID` | 400 | This pack could not be verified, the signature is invalid. | Re-sign after every change |
| `PACK_SIGNER_UNKNOWN` | 422 | This pack was signed by an unknown key (...). | Add the trust key |
| `PACK_SCHEMA_INVALID` | 422 | The pack failed validation: ... | Fix the named path. Also used when the unzipped pack is too large |
| `PACK_TOO_LARGE` | 413 | The pack file is too large. | Applies to the file size only |
| `PACK_REVOKED` | 403 | This pack version was withdrawn by the platform (...). | Install the fixed version named in the message |
| `PACK_LICENCE_REQUIRED` | 403 | This connector pack needs an active licence. | Activate the licence, then import again |
| `PACK_LICENCE_MISMATCH` | 403 | This connector pack was issued for a different licence. | Ask for a pack issued to this installation |
| `PACK_CONTENT_FORBIDDEN` | 422 | The connector archive contains forbidden content: ... | Remove the named files |
| `PACK_PIECE_NAME_TAKEN` | 409 | A connector named ... is already installed on this platform. | Use another package name |
| `EXTENSION_NOT_FOUND` | 404 | ... not found. | Check the pack id or object id |
| `PACK_VERSION_CONFLICT` | 409 | Pack ... is already imported with different content. Bump the version. | Bump the version |
| `PACK_PARAMETER_MISSING` | 422 | Required parameters are missing: ... | Send them on activate |
| `EXTENSION_REFERENCED` | 409 | Other active extensions still reference objects in this pack: ... | Retire dependants first |
| `FORBIDDEN` | 403 | You are not allowed to do that. | Check the permission in the answer |
| (no code) | 403 | Permission denied | The answer names the missing `permission` |
| `VALIDATION` | 400 | version is required | Send `version` on activate |
| MCP | 401 | Authorization: Bearer mcp_… required | Send the `Authorization` header |
| MCP | 401 | Invalid token format — expected mcp_… token | Use an MCP token, not a session or API token |
| MCP | 401 | Invalid or revoked token | Issue a new token |
| `MCP_FACADE_REQUIRES_APPROVAL` | JSON-RPC error | The tool call needs a person's approval before it runs | Approve it in AANCER, then call again |
| MCP | 403 | The MCP Server facade is not included in your current license. | The installation needs the MCP server licence feature |
| MCP | 403 | Origin not in token allow-list | Match `allowedOrigins`, or issue a token without it for server use |
| `INVALID_TOKEN_SCOPE` | 400 on issue, 403 on `/mcp/v1` | scope must be { tools: string[], resources: string[] } | Fix the token body, or use a tool inside the token's scope |

## Limits and editions

- The MCP server and personal MCP tokens need licence features of your installation. Registering external MCP servers is available to administrators with the MCP permissions.
- Pack import and activation are controlled by permissions, with per-type licence features listed on each page.
- Check your edition on [aancer.ai/pricing](https://aancer.ai/pricing).
