# POST /custom-scripts/:script_id/restore-approved

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

Put a Custom Script back to its last approved version and re-approve it. Use this when a newer version cannot be published (a syntax error, a size limit, a bad credential) and has left the script unable to run: it republishes code a human already approved, so the automation goes live again without waiting for the broken version to be fixed.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `script_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/custom-scripts/:script_id/restore-approved"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"require_approval":"..."}'
```

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