## Start a workflow for a transaction manually (tenant:settings:write)

`POST /api/workflow/v1/trigger`

Module: Workflow · operationId: `triggerWorkflow` · Tag: Instances · Auth: access token (`Authorization: Bearer <accessToken>`)

Starts the active blueprint `blueprintId` for one trade transaction, as polling would. The
transaction is given by `transactionId` (UUID) or, as a fallback, by its number (`objectNumber`),
which must match exactly one transaction of the blueprint's transaction types. A running workflow
locks the transaction in trade.

- `200`: the workflow runs (`OPEN`).
- `204`: the start was accepted but nothing runs: it ended at start (`TRIGGER_NOT_MATCHED`,
  `TECHNICALLY_FAILED`), it is waiting for trade (`RETRYING_SYNC`, retried automatically), or a
  workflow of the blueprint already runs for the transaction.
- `400`: nothing was started – workflows are off, the blueprint is unknown or switched off, the
  transaction was not found or does not match the trigger, or another start of it is in progress.

### Request body

`application/json` (required)

- `blueprintId` (string, required): Blueprint id
- `initialNote` (string): Note stored in the instance data as `initialNote`
- `objectNumber` (string): Transaction number, used when transactionId is empty
- `transactionId` (string (uuid)): Trade transaction id

Example:

```json
{
  "blueprintId": "angebot-pruefung",
  "initialNote": "Bitte bis Freitag prüfen",
  "transactionId": "0b6f3c2e-5d4a-4e1b-9a7c-2f8d1e6b4c90"
}
```

### Responses

- **200** Started and running (no body)
- **204** Accepted, but no running workflow resulted
- **400** Error (`application/json`)
- **401** Missing or invalid token (`unauthorized`) (`application/json`)
- **403** Error (`application/json`)
- **422** Nothing started (`nothing_to_start`): workflows are off, the blueprint or transaction is unknown, or a start is in progress (`application/json`)
- **500** Error (`application/json`)

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/workflow/v1/trigger' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"blueprintId":"angebot-pruefung","initialNote":"Bitte bis Freitag prüfen","transactionId":"0b6f3c2e-5d4a-4e1b-9a7c-2f8d1e6b4c90"}'
```
