---
title: "Prepare, approve, and execute"
description: "Require explicit user approval before an Agent operation can cause an effect."
image: "https://help.agent.mq/og.svg"
---

> Documentation Index
> Fetch the complete documentation index at: https://help.agent.mq/llms.txt
> Use this file to discover all available pages before exploring further.

# Prepare, approve, and execute

## Prerequisites

The discovered operation must have `requiresEndUser: true`. The Agent key and the end user must belong to the same application boundary.

1. **Prepare an immutable Action**

```bash
curl -X POST \
  https://api.agent.mq/v1/agent/applications/app_<32-lowercase-hex>/operations/<operation-id>/prepare \
  -H "Authorization: Bearer $AGENTMQ_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: <stable-request-key>" \
  -d '{"endUserId":"<end-user-id>","providerId":"<provider-id>","input":{"<field>":"<value>"}}'
```

   Use either `text` or `input` when the operation requires one, not both.
2. **Send the person to the approval URL**

   The preparation response includes an immutable Action and `approvalUrl`. The person signs in, reviews the exact proposal, and approves or rejects it.
3. **Read Action status**

   `GET /v1/agent/applications/{appId}/actions/{jobId}` reconciles the Action with its native execution receipt.
4. **Execute once**

```bash
curl -X POST \
  https://api.agent.mq/v1/agent/applications/app_<32-lowercase-hex>/actions/actjob_<32-lowercase-hex>/execute \
  -H "Authorization: Bearer $AGENTMQ_TOKEN"
```

## Verify

Execution succeeds only after approval and only for the prepared input. Rejection, expiry, cancellation, and execution are distinct states with distinct receipts.

## Next steps

- [Consumer controls](/approval/consumer-controls)
- [Receipts and result retention](/operate/receipts)

Source: https://help.agent.mq/approval/human-approval/index.mdx
