# POST /agents/:id/apply-template

**Resource:** [Agents](./agents.md)  
**Scopes:** `voice-agents:write`  
**Write operation:** yes

Stamp the default FinalPiece voice agent profile (prompt, settings, knowledge base) onto a provisioned agent, OR copy the full configuration from another source agent. Pass source_agent_id to copy from a specific agent; omit it to apply the platform default profile. Overwrites the conversation flow and settings in place -- the agent must be provisioned first (agent_id starts with "agent_").

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `id` | path | uuid | yes | Target voice agent ID |
| `source_agent_id` | body | string | no | UUID of a source voice agent to copy from. Omit to apply the platform default profile. |

## Request example

```bash
curl -X POST "https://ucqwijexmjctglmrxlej.supabase.co/functions/v1/api/v1/agents/agent-uuid/apply-template" -H "Authorization: Bearer tp_live_..." -H "Content-Type: application/json" -d "{}"
```

## Response example

```json
{"data": {"id": "local-uuid", "agent_id": "agent_abc123", "message": "Template applied successfully."}}
```

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