# POST /automations/:automation_id/actions/:action_id/custom-script/approve-code

**Resource:** [Custom Scripts](./custom-scripts.md)  
**MCP tool:** `approve_custom_script_code`  
**Scopes:** `automations:write`  
**Write operation:** yes

Approve a Custom Script's current generated code for live execution (Gate B — separate from saving the action itself).

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `automation_id` | path | string | yes |  |
| `action_id` | path | string | yes |  |
| `require_approval` | body | boolean | no | Optional. Set true to route this write into the approval queue for human review instead of executing it immediately (returns 202 + an approval_id). Works even when your key/token has permission to execute directly. |

## Request example

```bash
curl -X POST   "https://api.trustpager.com/functions/v1/api/v1/automations/:automation_id/actions/:action_id/custom-script/approve-code"   -H "Authorization: Bearer YOUR_API_KEY"
```

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`