# PATCH /automations/:automation_id/actions/:action_id/custom-script/code

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

Save hand-edited Custom Script code verbatim (marks it manually_edited so future regenerations never silently overwrite it).

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `automation_id` | path | string | yes |  |
| `action_id` | path | string | yes |  |
| `code` | body | 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 PATCH   "https://api.trustpager.com/functions/v1/api/v1/automations/:automation_id/actions/:action_id/custom-script/code"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"code":"..."}'
```

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