# POST /automations/:automation_id/actions/:action_id/custom-script/test

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

Deploy and dry-run a Custom Script against sample trigger data. Bypasses both approval gates; never touches automation run history. Optionally pass contact_id/deal_id so tp.contact()/tp.deal()/tp.context() have a real record to resolve.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `automation_id` | path | string | yes |  |
| `action_id` | path | string | yes |  |
| `contact_id` | body | string | no |  |
| `deal_id` | body | string | 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/automations/:automation_id/actions/:action_id/custom-script/test"   -H "Authorization: Bearer YOUR_API_KEY"
```

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