## Fill a template with parameter values and get its definition, without creating anything (tenant:flows:read|write|admin)

`POST /api/flows/v1/templates/{key}/render`

Module: Flows · operationId: `renderFlowTemplate` · Tag: Catalog · Auth: access token (`Authorization: Bearer <accessToken>`)

Returns the definition (YAML) a template gives for `name`, `key` and the values of its `params`; nothing is
stored. Use it to preview a flow, and to create an immediate automation from an inline template: post the
YAML to the automation routes of the module that owns it (forge: `POST /api/forge/v1/projects/{key}/automations`),
which validates and stores it under its own rules. Parameter values are data: each is inserted as one YAML
value (a scalar, or a list of scalars) or as a literal of the expression language, so a value never adds keys,
nodes, triggers or expressions to the definition. A parameter left out takes its `default`; an unknown
parameter, a missing required one, a value of the wrong type or an enum value outside the options is
`400 invalid` with the field `params.<key>`. A template whose recipients default to the caller needs a caller
with an e-mail address (`400 invalid`, field `template`). The pickers' values (a project key, a label name,
a space key) are not checked here – the definition's validation and the first run do.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `key` | path | string | yes | The key of a template from `GET /api/flows/v1/templates` |

### Request body

`application/json` (required)

- `name` (string, required): The name of the new flow or automation (max length 200)
- `key` (string): Lower case letters, digits and dashes; default derived from the name (max length 63)
- `params` (FlowTemplateValues): The values of a template's parameters by key: a string, a number, a boolean or a list of strings, as the parameter's `type` says.

Example:

```json
{
  "name": "Fehler kennzeichnen",
  "params": {
    "label": "bug",
    "type": "fehler"
  }
}
```

### Responses

- **200** The definition (`application/json`)
- **400** Invalid input (`invalid`); `field` names the first invalid field, `details.fields` every one. (`application/json`)
- **401** Missing, invalid or expired token (no body).
- **403** The token lacks the permission or has no active tenant (`forbidden`). Also: `person_required` (a service-account key on personal flows or the task inbox), `live_test_forbidden`, `forbidden_grant`, `starter_excluded`. (`application/json`)
- **404** The record does not exist in the token's tenant – or it belongs to a scope the caller may not view (a scoped flow stays hidden). (`application/json`)

Fields of the 200 answer:

- `yaml` (string, required): The definition with every placeholder filled in

Example 200 answer:

```json
{
  "yaml": "schemaVersion: 1\nkey: fehler-kennzeichnen\nname: \"Fehler kennzeichnen\"\ndescription: \"Setzt ein Label an jedes neue Element eines Typs.\"\ntriggers:\n  - {id: angelegt, kind: event, event: forge.item.created, filter: \"trigger.data.typeKey == \\\"fehler\\\"\"}\nnodes:\n  kennzeichnen:\n    kind: action\n    name: Label setzen\n    action: forge.item.add_label\n    params:\n      key: \"{{ trigger.data.projectKey }}\"\n      number: \"{{ trigger.data.number }}\"\n      label: \"bug\"\nedges:\n  - angelegt -\u003e kennzeichnen\n"
}
```

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/flows/v1/templates/forge-typ-kennzeichnen/render' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"name":"Fehler kennzeichnen","params":{"label":"bug","type":"fehler"}}'
```
