> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://docs.prividium.com/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

The Workflow Engine keeps one record for each asset the zone sets up: the contract, its accounts, the signers by
reference, the source systems and the applications bound to them, the policy ruleset and the outcome webhooks. A zone
administrator sets it up through these routes with a user session.

:::info[Authentication]
Zone-operator routes: `admin_read` for reads and `admin_write` for writes, like the rest of the administrative API. The
feature is mounted when `WORKFLOW_API_ENABLED=true`, and `GET /info` lists it as `workflow`.
:::

## Routes

| Method | Path                                           | Result                                                                                      |
| ------ | ---------------------------------------------- | ------------------------------------------------------------------------------------------- |
| `POST` | `/api/workflow/assets`                         | `201` with the new record. The same `idempotencyKey` and body again `200`. A conflict `409` |
| `GET`  | `/api/workflow/assets`                         | The zone's records, unfinished setup included                                               |
| `GET`  | `/api/workflow/assets/{assetId}`               | One record with its configuration, `status` and `steps`                                     |
| `PUT`  | `/api/workflow/assets/{assetId}/configuration` | Replace the configuration under the `revision` read; a stale one `409`                      |

Every asset of a zone belongs to one organization and has its own `logicalAssetId`. Every conflict answers `409` with
`error.code` `WORKFLOW_CONFLICT`, and `error.message` names it:

| `error.message`          | Cause                                                                                             |
| ------------------------ | ------------------------------------------------------------------------------------------------- |
| `IDEMPOTENCY_KEY_REUSED` | The `idempotencyKey` was sent again with a different `name`, `organizationId` or `logicalAssetId` |
| `LOGICAL_ASSET_EXISTS`   | Another record already has this `logicalAssetId`                                                  |
| `ORGANIZATION_MISMATCH`  | The zone's records belong to another organization                                                 |
| `REVISION_MISMATCH`      | The configuration was written after the `revision` the caller read                                |

## Create the record

```bash
curl -X POST "http://localhost:8000/api/workflow/assets" \
  -H "Authorization: Bearer <OPERATOR_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Tokenized cash",
    "organizationId": "10000000-0000-4000-8000-000000000001",
    "logicalAssetId": "tokenized-cash",
    "idempotencyKey": "setup-2026-10-16"
  }'
```

`logicalAssetId` is the stable name the instruction service and its records carry; it is never renamed. The
`idempotencyKey` is yours: an interrupted setup that retries the create gets the record it already made.

## Save the configuration

The configuration is saved whole on every write, under the `revision` the caller read. A step the operator has not
reached is simply empty.

```json
{
  "revision": 1,
  "configuration": {
    "contract": { "address": "0x1234…", "chainId": 506, "templateKey": "controlled-asset" },
    "accounts": [
      { "code": "CLIENT-OMNIBUS", "wallet": "clientOmnibus", "address": "0x4444…" },
      { "code": "OPERATIONAL", "wallet": "operational", "address": "0x5555…" }
    ],
    "sources": [
      {
        "system": "LEDGER",
        "events": [
          { "type": "DEPOSIT", "operation": "mint" },
          { "type": "WITHDRAWAL", "operation": "burn" }
        ],
        "principalIds": ["<ledger application id>"]
      }
    ],
    "signers": {
      "ordinary": { "kind": "fireblocks", "address": "0x3333…", "reference": "vault 12" },
      "correction": { "kind": "fireblocks", "address": "0x6666…", "reference": "vault 13" }
    },
    "permissionsApplied": true,
    "permissions": {
      "executorRoleId": "<executor role id>",
      "correctorRoleId": "<corrector role id>",
      "readerRoleIds": []
    },
    "policy": {
      "rulesetId": "<published ruleset id>",
      "cryptoOperationsRoleId": "<approver role id>",
      "presetId": "issuance-redemption"
    },
    "webhooks": { "eventWebhookIds": [] }
  }
}
```

| Field                | Meaning                                                                                                                         |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `contract`           | The deployed `IControlledAsset` contract, with the template it came from and its deployment transaction when known              |
| `accounts`           | Account codes callers name, the wallet key each maps to on chain, and the address the contract maps that key to once registered |
| `sources`            | Source systems, what each event type means, and the applications or users allowed to submit for that system                     |
| `signers`            | The ordinary and correction signers by address and reference only; the key or custody credential stays with the service         |
| `permissionsApplied` | Set once the contract and event permissions the signers and readers need are in place                                           |
| `permissions`        | The Prividium roles those permissions were granted to: the executor's, the corrector's and the readers'                         |
| `policy`             | The published issuance and redemption ruleset, and the approval role corrections require                                        |
| `webhooks`           | The event webhooks that carry instruction outcomes                                                                              |

Account codes, wallet keys and source systems must be unique, each event type appears once across all sources, and the
two signers must differ. The record holds references only, never a key or custody credential, and every zone operator can read it.

## Progress

Every read returns `status` and `steps`, derived from the configuration rather than stored, so they can never disagree
with what was saved:

```json
{
  "status": "setup",
  "steps": [
    { "step": "accounts", "status": "partial" },
    { "step": "token", "status": "done" },
    { "step": "signers", "status": "done" },
    { "step": "permissions", "status": "pending" },
    { "step": "policy", "status": "pending" },
    { "step": "sources", "status": "done" },
    { "step": "webhooks", "status": "optional" }
  ]
}
```

`accounts` is `partial` once some accounts have an address and some do not, and `pending` while none has. `sources` is
`partial` while some sources lack principals or events, and `pending` while none has both. `webhooks` is `optional`
until one is connected. `status` becomes `ready` once every other step is `done`.

Every create and configuration write lands in the audit log under `workflow.asset.create` and
`workflow.asset.configure`, and each revision of the row in `db_mutation_audit_logs`.
