# Ask for approval

> Emails a person a form and waits for their answer. The answers can be used in the steps after it.

Source: https://docs.go-lumen.ai/es/reference/nodes/approval

## De un vistazo

| Propiedad | Valor |
| --- | --- |
| **Node field** | `approval` (set instead of `stepRef` on a FlowNode) |
| **Side effects** | yes |

A FlowNode sets exactly one of `stepRef`, `branch`, `filter`, `forEach`, `wait` and `approval`.

## Ajustes

El valor del campo del nodo, con estos ajustes.

| Ajuste | Tipo | Valor por defecto | Descripción |
| --- | --- | --- | --- |
| `to` (obligatorio) | string |  | To is the address the form is sent to. It may use `{<nodeId>.<field>}` placeholders, e.g. `{email.from}`. |
| `subject` | string |  | Subject of the email; placeholders allowed. |
| `message` | string |  | Message is shown above the form; placeholders allowed. |
| `attach` | boolean |  | Attach emails the files the run holds here with the form, so the person reads the change list and opens the file in one email. Files over the email limit are named in it instead. |
| `fields` (obligatorio) | list of object |  | Fields are what the person fills in. |
| `fields[].name` (obligatorio) | string |  | Name is the output's name, <nodeId>.<name>. |
| `fields[].label` | string |  | Label is what the person reads; defaults to the name. |
| `fields[].type` (obligatorio) | string |  |  |
| `fields[].required` | boolean |  |  |
| `fields[].options` | list of string |  | Options a select field offers. |
| `fields[].default` | string |  | Default prefills the field; placeholders allowed. |
| `timeout` | string |  | Timeout is how long the form stays open; unanswered by then, the run fails. Defaults to 72h. (pattern \`^(\[0-9\]+(\\.\[0-9\]+)?(ns|us|µs|ms|s|m|h))+$\`) |
| `timeZone` | string |  | TimeZone is the IANA time zone the form's closing time is shown in, instead of the workspace's. |
| `reminders` | object |  | Reminders are sent in the form email's thread while nobody has answered. |
| `reminders.after` | list of string |  | How long after the email went out, such as 24h. Each one sends a reminder if nobody answered by then; at most three, each shorter than the timeout. |
| `reminders.message` | string |  | Empty is Lumen's own text, in the email's language. |
| `onTimeout` | object |  | OnTimeout says who is told when the form closes unanswered and the run fails here. |
| `onTimeout.notify` | list of string |  | Addresses told when nobody answered in time; `{email.from}` is the sender of the email that started the run. |
| `onTimeout.message` | string |  | Empty is Lumen's own text, in the email's language. |

El JSON Schema completo de estos ajustes: [approval.schema.json](https://docs.go-lumen.ai/schemas/nodes/approval.schema.json).

## Úsalo en un flujo

```yaml title="flow.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Connector
metadata:
  name: my-email-forward
  namespace: tenant-acme
spec:
  classRef: {name: email-forward}
  config: {}
---
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: approval-example
  namespace: tenant-acme
spec:
  displayName: "Ask for approval"
  triggers:
    - id: start
      ref: {name: email-arrives}
      connectorRef: {name: my-email-forward}
      next: [text]
  nodes:
    - id: text
      stepRef: {name: read-text}
      next: [approve]
    - id: approve
      approval:
        to: approvals@yourcompany.co.il
        subject: "Approve the invoice from {start.from}?"
        timeout: 48h
        fields:
          - {name: approved, label: Approve payment, type: boolean, required: true}
          - {name: comment, type: text}
      next: [keep]
    - id: keep
      stepRef: {name: save-file}
      config: {destination: lumen}
```
