# POST /lead-magnets/:lead_magnet_id/gift-script/generate

**Resource:** [LEAD_MAGNETS](./lead-magnets.md)  
**MCP tool:** `generate_lead_magnet_gift_script`  
**Scopes:** `lead_magnets:write`, `automations:write`  
**Write operation:** yes

Write (or rewrite) the Custom Script that makes a lead magnet's Made for you gift, from a plain-English description of the gift. The script gets the reader (first_name, business_name, industry, city, state, postcode, website, why_now) and returns { title, text, html, url, image_url }. New code needs approval (approve_lead_magnet_gift_script) before it makes real gifts; try it first with test_lead_magnet_gift_script.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `lead_magnet_id` | path | string | yes | The lead magnet whose Made for you gift the script makes. |
| `description` | body | string | yes | Plain-English description of what the script should do. |
| `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/lead-magnets/:lead_magnet_id/gift-script/generate"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"description":"...","require_approval":"..."}'
```

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