# POST /referrals/attribute

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

Set, reassign, or clear the primary referrer on an opportunity. Pass referrer_contact_id to attribute it to a contact, or null to clear. Updates the referral graph in place so commission tracking and history survive a reassignment, and leaves form/automation-sourced referrals intact.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `opportunity_id` | body | string | yes | Opportunity (deal) UUID to attribute. Required. |
| `referrer_contact_id` | body | string,null | yes | Contact UUID of the referrer. Pass null to clear the referrer. |
| `category` | body | string | no | Optional referral category (modality, service type, lead source). |

## Request example

```bash
curl -X POST   "https://api.trustpager.com/functions/v1/api/v1/referrals/attribute"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"opportunity_id":"...","referrer_contact_id":"...","category":"..."}'
```

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