# Manifest reference

> Every field in prosaic.extension.toml — scopes, triggers, connections, validation.

Source: https://developer.prosaic.works/docs/extensions/manifest

The manifest is the contract between your extension and the platform. It declares who you are, what you can touch, and when you run. The runtime enforces every bit of it.

## Shape

```toml
#:schema https://developer.prosaic.works/schemas/extension-manifest.json
name = "my-extension"
version = "0.0.1"
description = "Optional one-liner"

[scopes]
required = ["read:transactions", "send:email"]

# At least one trigger block below is required.

[[targets.events]]
type = "journal.posted"

[targets.cron]
schedule = "0 9 * * *"

[[targets.actions]]
placement = "transaction.single"
label = "Analyse this transaction"
```

## Validation in your editor

The first line points TOML editors at the manifest's JSON Schema:

```toml
#:schema https://developer.prosaic.works/schemas/extension-manifest.json
```

Editors built on [Taplo](https://taplo.tamasfe.dev/), such as the Even Better TOML extension for VS Code, read that line and check the file as you type: unknown scopes, misspelt event types, missing labels. `prosaic extension init` and the `scaffold_extension` MCP tool write it for you. To a TOML parser it is a comment, so the platform ignores it.

The schema is generated from the same lists the validator uses, so the editor and `prosaic extension validate` agree. You can fetch it directly at `https://developer.prosaic.works/schemas/extension-manifest.json`.

## Top-level fields

| Field         | Required | Description                                                                                             |
| ------------- | -------- | ------------------------------------------------------------------------------------------------------- |
| `name`        | Yes      | Kebab-case by convention. Deploy finds the extension by this name, so keep it unique in your workspace. |
| `version`     | Yes      | Any string; semver recommended. Shown in Settings → Extensions.                                         |
| `description` | No       | Free-text. Appears alongside the name.                                                                  |

## `[scopes]`

Declare every permission you need. Calling a method your manifest didn't authorise throws `Permission denied: scope '…' is required to call prosaic.…`. Start minimal — you can add more on the next deploy.

| Scope | Grants access to |
| --- | --- |
| `read:transactions` | `prosaic.transactions.list` and `.get` |
| `write:transactions` | `prosaic.transactions.update` |
| `read:journals` | `prosaic.journals.list` and `.get` |
| `read:entities` | `prosaic.entities.list` and `.get` |
| `send:email` | `prosaic.email.send` |
| `use:ai` | `prosaic.ai.complete` (also extends execution timeout to 120s) |
| `use:tools` | `prosaic.tools.list` and `.invoke` |
| `use:http` | `prosaic.http.fetch` — outbound requests to a declared [[connections]] target |
| `read:reports` | `prosaic.reports.list` and `.generate` — profit & loss, balance sheet, trial balance and the other financial reports |
| `read:gst-returns` | `prosaic.gst.list` and `.get` — GST return status, periods and IRD box amounts |

`prosaic.storage.*`, `prosaic.links.*` and `prosaic.log.*` need no scope — they're always available.

`prosaic.tools.invoke` checks two scopes: `use:tools` for the call itself, and the scope of the tool you invoke. `accounts.list`, the entity's chart of accounts, needs `read:entities`. See [`prosaic.tools`](/docs/extensions/sandbox-api#prosaictools).

## Triggers

You need at least one. You can mix them — an extension can have events, a cron, and action links all at once.

### `[[targets.events]]`

Runs when a domain event fires on an entity the extension is installed on. Multiple event blocks are fine.

```toml
[[targets.events]]
type = "journal.posted"

[[targets.events]]
type = "transaction.reconciled"
```

| Event type | Fires when | `input` payload |
| --- | --- | --- |
| `journal.created` | A manual journal is created | `{ journalId: string, logicalJournalId: string }` |
| `journal.posted` | A journal is posted (becomes final) | `{ journalId: string }` |
| `journal.voided` | A journal is voided | `{ journalId: string, reversalJournalId: string }` |
| `transaction.reconciled` | A bank transaction is matched to a journal | `{ transactionId: string, journalId: string }` |
| `file.uploaded` | A file is uploaded to an entity | `{ fileId: string, filename: string }` |
| `gst.period.rollover` | A new GST period starts (phase: 'started') or the previous period's return is finalised (phase: 'previous-finalised') | `{ phase: 'started' \| 'previous-finalised', gstReturnId: string, periodStart: string, periodEnd: string, dueDate: string, gstPeriodMonths: 1 \| 2 \| 6, previousReturnId: string \| null }` |
| `gst.return.finalised` | A GST return is finalised (draft → finalised); its figures are locked | `{ gstReturnId: string, status: string, periodStart: string, periodEnd: string, dueDate: string, netGstPosition: string \| null, isAmendment: boolean }` |
| `gst.return.reverted_to_draft` | A finalised or rejected GST return is reverted to draft | `{ gstReturnId: string, status: string, periodStart: string, periodEnd: string, dueDate: string, netGstPosition: string \| null, isAmendment: boolean }` |
| `gst.return.filed` | A finalised GST return is filed with IRD (finalised → filed) | `{ gstReturnId: string, status: string, periodStart: string, periodEnd: string, dueDate: string, netGstPosition: string \| null, isAmendment: boolean }` |
| `gst.return.accepted` | IRD accepts a filed GST return (filed → accepted) | `{ gstReturnId: string, status: string, periodStart: string, periodEnd: string, dueDate: string, netGstPosition: string \| null, isAmendment: boolean }` |
| `gst.return.rejected` | IRD rejects a filed GST return (filed → rejected) | `{ gstReturnId: string, status: string, periodStart: string, periodEnd: string, dueDate: string, netGstPosition: string \| null, isAmendment: boolean, rejectionCode: string, rejectionMessage: string }` |
| `gst.return.awaiting_payment` | An accepted GST return has an outstanding IRD balance (accepted → awaiting_payment) | `{ gstReturnId: string, status: string, periodStart: string, periodEnd: string, dueDate: string, netGstPosition: string \| null, isAmendment: boolean, balance: string }` |
| `gst.return.completed` | A GST return reaches its end state — paid/settled (auto) or marked completed (manual) | `{ gstReturnId: string, status: string, periodStart: string, periodEnd: string, dueDate: string, netGstPosition: string \| null, isAmendment: boolean }` |

The payload arrives on `prosaic.context.input`, and `prosaic.context.trigger` is the event type.

### `[targets.cron]`

Runs on a schedule. Standard 5-field Unix cron — minute, hour, day, month, weekday. All in UTC.

```toml
[targets.cron]
schedule = "0 9 * * *"     # Every day at 09:00 UTC
```

Only one cron block per extension. It runs once per installation, so an extension installed on three entities runs three times. `prosaic.context.trigger` is `"cron"` and `prosaic.context.input` is empty.

Some common patterns:

| Schedule       | Meaning                          |
| -------------- | -------------------------------- |
| `*/15 * * * *` | Every 15 minutes                 |
| `0 * * * *`    | Every hour on the hour           |
| `0 9 * * *`    | Daily at 09:00 UTC               |
| `0 9 * * 1`    | 09:00 UTC every Monday           |
| `0 9 1 * *`    | 09:00 UTC on the 1st every month |

### `[[targets.actions]]`

Adds a button to the Prosaic UI. Users click it, your extension runs. Good for one-off bulk jobs or "look at this thing" actions.

```toml
[[targets.actions]]
placement = "transaction.single"
label = "Categorise with AI"

[[targets.actions]]
placement = "transaction.bulk"
label = "Bulk categorise"
```

| Placement | Shows up | `input` payload |
| --- | --- | --- |
| `transaction.single` | In the detail view of a single transaction | `{ placement: "transaction.single", transactionId: string }` |
| `transaction.bulk` | On the transaction list after multi-selecting rows | `{ placement: "transaction.bulk", transactionIds: string[] }` |
| `report` | Above the Profit and loss report | `{ placement: "report", reportType: "profit-loss", entityId: string, startDate: string, endDate: string }` |

`label` is the button text — keep it short. `prosaic.context.trigger` is `"action.link"`.

## `[[connections]]`

A connection declares a third-party API your extension calls with [`prosaic.http.fetch`](/docs/extensions/sandbox-api#prosaichttpfetch). Declaring one requires the `use:http` scope. A workspace admin connects it from the extension's page under **Settings → Extensions**, by entering the credential (or, for `oauth2`, the third party's client ID and secret, then authorising) — see [Connect outside services](/docs/extensions/using-extensions#connect-outside-services). Prosaic stores the credential and attaches it to each request on the server, so your code never holds it.

```toml
[scopes]
required = ["use:http", "read:transactions"]

[[connections]]
name = "acme"
label = "Acme CRM"
auth = "bearer"
base_url = "https://api.acme.example"
allowed_hosts = ["api.acme.example"]

[[connections.fields]]
key = "token"
label = "API token"
secret = true
```

| Field           | Required | Description                                                                                                                                                                          |
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `name`          | Yes      | Lowercase kebab-case, starting with a letter, up to 64 characters. You pass it to `http.fetch`.                                                                                      |
| `label`         | Yes      | Shown to the admin who connects it.                                                                                                                                                  |
| `description`   | No       | Shown alongside the label.                                                                                                                                                           |
| `auth`          | Yes      | `bearer`, `basic`, `header` or `oauth2` — see below.                                                                                                                                 |
| `base_url`      | Yes      | An `https://` URL. Request paths resolve against it.                                                                                                                                 |
| `allowed_hosts` | Yes      | Hosts requests may reach. `*.example.com` matches subdomains but not `example.com` itself. Must cover the `base_url` host.                                                           |
| `scope`         | No       | `workspace` (the default) shares one credential across the workspace; `entity` keeps one per entity and uses the one for the run's entity, but can't be connected from Settings yet. |
| `fields`        | Depends  | `[[connections.fields]]` blocks, each with `key` and `label`, and optionally `secret`, `required` and `placeholder`.                                                                 |

What each `auth` strategy sends, and what it needs declared:

| `auth`   | Sends                                             | Declare                                                                                                                                                     |
| -------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bearer` | `Authorization: Bearer {token}`                   | A field with `key = "token"`                                                                                                                                |
| `basic`  | `Authorization: Basic base64(username:password)`  | Fields `username` and `password`                                                                                                                            |
| `header` | A header you name, such as `X-Api-Key: {api_key}` | `[connections.header]` with `name` and `template`; each `{placeholder}` must be a field key                                                                 |
| `oauth2` | `Authorization: Bearer <access token>`, refreshed | `[connections.oauth2]` with `authorize_url` and `token_url` (optional `scopes`, `pkce`, `audience`); no fields. Both URLs' hosts must be in `allowed_hosts` |

## Validation

`prosaic extension validate`, `prosaic extension deploy` and the `validate_extension_manifest` MCP tool all run the same checks:

- `name` and `version` are required.
- Every scope must be one of the scopes listed above. Typos fail.
- Every event `type` must be one of the events listed above.
- Cron schedules must have exactly 5 fields.
- Every action must have a valid `placement` and a non-empty `label`.
- At least one of `targets.events`, `targets.cron`, or `targets.actions` is required — no trigger, no extension.
- Every connection needs a valid `name`, a `label`, a known `auth`, an `https` `base_url` and at least one allowed host, and declaring any connection requires `use:http`.

When you deploy, Prosaic also checks each connection's strategy against its fields (a `bearer` connection without a `token` field is refused, for example) and that `allowed_hosts` covers every URL the connection uses.

Check locally before deploying:

```bash
prosaic extension validate --dir .
```

## Full example — AI categorisation suggestions

```toml
#:schema https://developer.prosaic.works/schemas/extension-manifest.json
name = "categorisation-suggestions"
version = "0.1.0"
description = "Suggest accounts for selected transactions using AI"

[scopes]
required = [
  "read:transactions",
  "read:entities",
  "use:tools",
  "use:ai",
]

[[targets.actions]]
placement = "transaction.single"
label = "Suggest an account"

[[targets.actions]]
placement = "transaction.bulk"
label = "Suggest accounts"
```

Two buttons, four scopes. `read:entities` and `use:tools` together let it read the chart of accounts through `prosaic.tools.invoke('accounts.list', {})`. The handler is in [Triggers](/docs/extensions/triggers#handler-recipe--suggest-accounts-for-selected-transactions).
