# Approve or reject a pending approval

> Source: https://elaichi.ai/docs/api-reference/workflows/automation-approval/resolveautomationapproval/

`POST /automation-approval/{id}/resolve`

Resource: **Workflow Approval** · API: **Workflows**

## Path parameters

- **`id`** _(string, required)_
  Resource id

## Request body

- **`decision`** _(string)_
  Allowed: `approve`, `reject`
- **`note`** _(string)_

## Response body

- **`id`** _(string)_
- **`automation_id`** _(string)_
- **`automation_name`** _(string)_
- **`run_id`** _(string)_
- **`step_key`** _(string)_
- **`step_path`** _(string)_
- **`version_id`** _(string)_
- **`status`** _(string)_
  Allowed: `pending`, `approved`, `rejected`, `expired`, `cancelled`
- **`title`** _(string)_
- **`message`** _(string)_
- **`message_format`** _(string)_
  How `message` is written. Display only: draw `slack` mrkdwn or a small Markdown subset as formatting, never as HTML.
  Allowed: `text`, `slack`, `markdown`
- **`details`** _(array<object>)_
  - **`label`** _(string)_
  - **`value`** _(string)_
- **`details_omitted`** _(integer)_
  Detail rows the step produced beyond the ones kept; 0 when nothing was cut.
- **`gated_tier`** _(string)_
- **`step_up_required`** _(boolean)_
- **`prevent_self_approval`** _(boolean)_
- **`owner_user_id`** _(string)_
- **`owner_display_name`** _(string,null)_
- **`trigger_actor_user_id`** _(string,null)_
- **`approver_count`** _(integer)_
- **`approver_preview`** _(object)_
  - **`names`** _(array<string>)_
  - **`count`** _(integer)_
- **`notified`** _(object)_
  - **`count`** _(integer)_
  - **`total`** _(integer)_
- **`delivery`** _(null | object)_
  What became of the Slack and email delivery, per channel, as counts of approvers per outcome. Counts only: never an address, token or message. Null before the first delivery runs and on requests from before outcomes were recorded.
  _One of:_
  - **object**
    - **`slack`** _(object)_
      Slack direct messages.
      - **`sent`** _(integer)_
      - **`no_installation`** _(integer)_
      - **`user_not_found`** _(integer)_
      - **`failed`** _(integer)_
      - **`disabled`** _(integer)_
    - **`email`** _(object)_
      Email.
      - **`sent`** _(integer)_
      - **`no_installation`** _(integer)_
      - **`user_not_found`** _(integer)_
      - **`failed`** _(integer)_
      - **`disabled`** _(integer)_
    - **`channel`** _(null | object)_
      _One of:_
      - **object**
        - **`sent`** _(integer)_
        - **`no_installation`** _(integer)_
        - **`user_not_found`** _(integer)_
        - **`failed`** _(integer)_
        - **`disabled`** _(integer)_
    - **`skipped`** _(object)_
      Approvers no channel was attempted for: `inactive` are no longer active members, `over_limit` are past the cap on how many people one request messages. Absent when none were skipped.
      - **`inactive`** _(integer)_
      - **`over_limit`** _(integer)_
- **`delivery_line`** _(string,null)_
  Who was told about this request and, when someone was not, why, in plain words ("Notified 1 of 1 · Slack, email"). Computed from `delivery` and the caller's own standing, so a reader who was never asked to approve is told they were not notified.
- **`created_at`** _(string)_
- **`expires_at`** _(string)_
- **`escalate_at`** _(string,null)_
- **`escalated_at`** _(string,null)_
- **`resolved_by`** _(string,null)_
- **`resolved_by_display_name`** _(string,null)_
- **`resolved_at`** _(string,null)_
- **`resolution_note`** _(string,null)_
- **`resolved_via`** _(string,null)_
- **`from_older_version`** _(boolean)_
  Pending, and its run is pinned to an older version than the workflow's current published one: approving resumes that run with its old steps. False once settled. A heads-up only; it never changes what an answer does.
- **`run_version`** _(integer,null)_
  The version number the run is pinned to.
- **`current_version`** _(integer,null)_
  The workflow's current published version number.
- **`is_approver`** _(boolean)_
- **`can_resolve`** _(boolean)_
- **`can_view_automation`** _(boolean)_
  The caller may open the workflow (an approver is not necessarily able to).
- **`can_view_run`** _(boolean)_
  The caller may open the run (`use` access or better on the workflow).
- **`action`** _(string,null)_
  The exact thing being asked in one sentence ("Pay $1,250.00 to Acme Ltd from Stripe"); set for a payment, null for an ordinary approval whose `title` is the sentence.
- **`on_approve`** _(string)_
  What happens if the caller approves, in plain words.
- **`on_reject`** _(string)_
  What happens to the run if the caller rejects, in plain words.
- **`resolve_requires`** _(object)_
  - **`step_up`** _(boolean)_
  - **`blocked_reason`** _(string,null)_
- **`can_bulk_resolve`** _(boolean)_
  May be answered in a bulk decision: `can_resolve`, and not a payment or a step-up gate (those are answered one at a time).
- **`bulk_resolve_blocked_reason`** _(string,null)_
  Why a request the caller can answer on its own is kept out of a bulk decision, in words.
- **`console_url`** _(string)_
- **`runs_as`** _(object)_
  - **`owner_name`** _(string,null)_

## Code examples

### curl

```bash
curl -X POST 'https://api.elaichi.ai/automation-approval/<id>/resolve' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"decision":"approve","note":"your_note"}'
```

### JavaScript

```javascript
const body = {
  "decision": "approve",
  "note": "your_note"
};

const response = await fetch('https://api.elaichi.ai/automation-approval/<id>/resolve', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/automation-approval/<id>/resolve"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "decision": "approve",
    "note": "your_note"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
```
