# POST /custom-scripts/:script_id/run

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

Run an approved Custom Script by its id right now (a live run — enforces the code-approval gate). Optionally pass contact_id/deal_id/trigger so the script can resolve a real record. Async: poll get_custom_script_invocations for the result.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `script_id` | path | string | yes |  |
| `contact_id` | body | string | no |  |
| `deal_id` | body | string | no |  |
| `trigger` | body | object | no |  |
| `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/run"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"contact_id":"...","deal_id":"...","trigger":"..."}'
```

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