> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hookpulse.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Human Approval Action

> Approve or reject a pending workflow approval. Approving allows the workflow to continue, while rejecting skips the current step and moves to the failure path

Approve or reject a pending workflow approval. Use this endpoint to take action on workflows that are waiting for human approval. Approving allows the workflow to continue, while rejecting skips the current step and moves to the failure path.

## Base URL

All API requests should be made to:

```
https://api.hookpulse.io
```

## Example request

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.hookpulse.io/v1/api/human_approval_action/" \
    -H "x-hookpulse-api-key: {{x-hookpulse-api-key}}" \
    -H "x-brand-uuid: {{x-brand-uuid}}" \
    -H "Content-Type: application/json" \
    -d '{
      "action": "approve",
      "execution_plan_uuid": "{{execution_plan_uuid}}"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.hookpulse.io/v1/api/human_approval_action/', {
    method: 'POST',
    headers: {
      'x-hookpulse-api-key': '{{x-hookpulse-api-key}}',
      'x-brand-uuid': '{{x-brand-uuid}}',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      action: 'approve',
      execution_plan_uuid: '{{execution_plan_uuid}}'
    })
  });

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

  ```python Python theme={null}
  import requests

  url = 'https://api.hookpulse.io/v1/api/human_approval_action/'
  headers = {
      'x-hookpulse-api-key': '{{x-hookpulse-api-key}}',
      'x-brand-uuid': '{{x-brand-uuid}}',
      'Content-Type': 'application/json'
  }
  payload = {
      'action': 'approve',
      'execution_plan_uuid': '{{execution_plan_uuid}}'
  }

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

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'json'
  require 'uri'

  uri = URI('https://api.hookpulse.io/v1/api/human_approval_action/')
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  request = Net::HTTP::Post.new(uri)
  request['x-hookpulse-api-key'] = '{{x-hookpulse-api-key}}'
  request['x-brand-uuid'] = '{{x-brand-uuid}}'
  request['Content-Type'] = 'application/json'
  request.body = {
    action: 'approve',
    execution_plan_uuid: '{{execution_plan_uuid}}'
  }.to_json

  response = http.request(request)
  puts JSON.parse(response.body)
  ```

  ```php PHP theme={null}
  <?php

  $url = "https://api.hookpulse.io/v1/api/human_approval_action/";
  $data = [
      'action' => 'approve',
      'execution_plan_uuid' => '{{execution_plan_uuid}}'
  ];

  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      'x-hookpulse-api-key: {{x-hookpulse-api-key}}',
      'x-brand-uuid: {{x-brand-uuid}}',
      'Content-Type: application/json'
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  echo $response;
  ?>
  ```
</RequestExample>

## Request body

| Field                 | Type   | Required | Description                                     |
| --------------------- | ------ | -------- | ----------------------------------------------- |
| `action`              | string | Yes      | Action to take: `"approve"` or `"reject"`       |
| `execution_plan_uuid` | string | Yes      | UUID of the execution plan waiting for approval |

## Example response

### Approve Response

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "message": "Workflow approved and resumed"
  }
  ```
</ResponseExample>

### Reject Response

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "message": "Workflow rejected and skipped"
  }
  ```
</ResponseExample>

## Response fields

| Field     | Type    | Description                                        |
| --------- | ------- | -------------------------------------------------- |
| `success` | boolean | Indicates if the action was processed successfully |
| `message` | string  | Success message indicating the action taken        |

## Action Types

| Action      | Description                       | Result                                                                              |
| ----------- | --------------------------------- | ----------------------------------------------------------------------------------- |
| `"approve"` | Approve the pending workflow step | Workflow continues to the next step (or delay\_to\_next\_step if configured)        |
| `"reject"`  | Reject the pending workflow step  | Workflow moves to the failure path (on\_fail\_next\_step\_identifier if configured) |

## Workflow Behavior

### Approve Action

When you approve a workflow:

* The workflow **resumes execution** and continues to the next step
* If `delay_to_next_step` is configured, the workflow waits for that duration before proceeding
* The workflow follows the `on_success_next_step_identifier` path if configured
* The execution status changes from `"waiting_approval"` to `"active"`

### Reject Action

When you reject a workflow:

* The workflow **skips the current step** and moves to the failure path
* The workflow follows the `on_fail_next_step_identifier` path if configured
* If no failure path is configured, the workflow may stop or continue based on workflow settings
* The execution status changes from `"waiting_approval"` to the next appropriate status

## Use Cases

* **Approval Workflows**: Approve or reject steps that require human decision
* **Quality Control**: Review and approve workflows before they proceed
* **Compliance**: Ensure workflows meet compliance requirements before continuing
* **Error Handling**: Reject workflows that need to be stopped or redirected
* **Manual Intervention**: Allow humans to control workflow execution at critical points

## Examples

### Approve a Workflow

```json theme={null}
{
  "action": "approve",
  "execution_plan_uuid": "{{execution_plan_uuid}}"
}
```

### Reject a Workflow

```json theme={null}
{
  "action": "reject",
  "execution_plan_uuid": "{{execution_plan_uuid}}"
}
```

## Important Notes

* **Execution Plan UUID**: Use the `execution_plan_id` from the [Get All Pending Approvals](/docs/api-reference/human-approval/get-all-pending-approvals-paginated) endpoint
* **Immediate Effect**: Actions take effect immediately when processed
* **One-Time Action**: Each approval can only be acted upon once
* **Workflow Continuation**: After approval or rejection, the workflow continues automatically based on the configured paths

## Related Documentation

* [Human Approval Overview](/docs/api-reference/human-approval/overview) - Learn about human approval in workflows
* [Get All Pending Approvals (Paginated)](/docs/api-reference/human-approval/get-all-pending-approvals-paginated) - View all pending approvals
* [Add Workflow Step](/docs/api-reference/workflow-template/add-workflow-step) - Configure steps with human approval


## OpenAPI

````yaml POST /v1/api/human_approval_action/
openapi: 3.0.3
info:
  title: Hookpulse API
  description: >-
    Complete API documentation for Hookpulse. Build powerful integrations with
    our RESTful API.
  version: 1.0.0
  contact:
    name: Hookpulse Support
    email: care@hookpulse.io
    url: https://hookpulse.io
servers:
  - url: https://api.hookpulse.io
    description: Production server
security:
  - apiKeyAuth: []
    brandUuidAuth: []
paths:
  /v1/api/human_approval_action/:
    post:
      description: >-
        Approve or reject a pending workflow approval. Approving allows the
        workflow to continue, while rejecting skips the current step and moves
        to the failure path
      requestBody:
        description: Human approval action configuration
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HumanApprovalActionRequest'
      responses:
        '200':
          description: Action processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HumanApprovalActionResponse'
        '400':
          description: Bad request or execution plan not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    HumanApprovalActionRequest:
      required:
        - action
        - execution_plan_uuid
      type: object
      properties:
        action:
          type: string
          enum:
            - approve
            - reject
          description: 'Action to take: ''approve'' or ''reject'''
        execution_plan_uuid:
          type: string
          description: UUID of the execution plan waiting for approval
    HumanApprovalActionResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Indicates if the action was processed successfully
        message:
          type: string
          description: Success message indicating the action taken
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-hookpulse-api-key
      description: >-
        API key for authentication. Get this from your dashboard by selecting a
        brand and going to API Keys section.
    brandUuidAuth:
      type: apiKey
      in: header
      name: x-brand-uuid
      description: >-
        Brand UUID for authentication. Get this from your dashboard after adding
        a brand - it will be displayed in the UI.

````