# PATCH /referrals/:id

**Resource:** [Referrals](./referrals.md)  
**Scopes:** `referrals:write`  
**Write operation:** yes

Update a referral. Writable fields: referred_contact_id, referred_deal_id, status, category, notes. Setting status="converted" stamps converted_at but does NOT send the thank-you email -- use POST /referrals/:id/convert for the full flow.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `id` | path | string | yes | Referral UUID. |
| `referred_contact_id` | body | string | no | Link to the referred contact UUID. |
| `referred_deal_id` | body | string | no | Link to the opportunity UUID. |
| `status` | body | string | no | pending \| accepted \| converted \| declined |
| `category` | body | string | no | Update the workspace category. |
| `notes` | body | string | no | Update free-text notes. |

## Request example

```bash
curl -X PATCH "https://ucqwijexmjctglmrxlej.supabase.co/functions/v1/api/v1/referrals/8aa0c05e-d0b2-49b3-b6e8-2da112254c63" \
  -H "Authorization: Bearer tp_live_..." \
  -H "Content-Type: application/json" \
  -d '{"status": "accepted", "category": "CT"}'
```

## Response example

```json
{
  "data": {
    "id": "8aa0c05e-d0b2-49b3-b6e8-2da112254c63",
    "status": "accepted",
    "category": "CT",
    "updated_at": "2026-05-16T10:05:00.000Z"
  },
  "meta": { "credits_remaining": 4498 }
}
```

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