# POST /service-requests/:id/links

**Resource:** [Service Requests](./service-requests.md)  
**Scopes:** `service-requests:write`  
**Write operation:** yes

Add or remove related service request links. Both directions are maintained automatically (two-way symmetry). A request cannot link to itself. All IDs must belong to the same company -- cross-company linking is rejected.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `id` | path | string | yes | Service request UUID to update links on |
| `add` | body | string[] | no | UUIDs of service requests to link to this one. Each must exist in this company. |
| `remove` | body | string[] | no | UUIDs of service requests to unlink from this one. Two-way link is also removed. |

## Request example

```bash
curl -X POST https://ucqwijexmjctglmrxlej.supabase.co/functions/v1/api/v1/service-requests/f112de7b-c7df-4193-bacd-2d43c31c1f11/links \
  -H "Authorization: Bearer tp_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "add": ["a1b2c3d4-e5f6-7890-abcd-ef1234567890"],
    "remove": []
  }'
```

## Response example

```json
{
  "data": {
    "id": "f112de7b-c7df-4193-bacd-2d43c31c1f11",
    "related_ids": ["a1b2c3d4-e5f6-7890-abcd-ef1234567890"],
    "updated_at": "2026-04-19T21:10:00.000Z"
  },
  "meta": { "credits_remaining": 3452 }
}
```

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