# sponsorships.links.set

Replace a sponsorship's references and partial associations to existing income/refund/fee entries, invoices and invoice payments. Source revisions, currencies, current access and total cross-sponsorship allocation are checked. Does not change bank reconciliation, amounts, categories or tax.

`POST /api/v1/accounting/sponsorships.links.set`

Permissions: `accounting:read`, `accounting:write` · Roles: admin, finance · Idempotency key required · Send `expectedRevision`

MCP tool: `accounting_sponsorships_links_set`

## Fields

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `id` | string (ID) | Yes | The record's ID. |
| `expectedRevision` | integer | Yes | The record's current revision, from the last time you read it. If someone changed the record since, the request is refused with a conflict so you can reload and check before trying again. 0 to 9007199254740991. |
| `links` | array of objects | Yes | at most 100 items. |
| `links[].kind` | enum | Yes | Which kind of record or job this is. One of: `entry`, `invoice`, `payment`. |
| `links[].sourceId` | string (ID) | Yes | The ID of the related record. |
| `links[].sourceRevision` | integer | Yes | The related record's current revision, from the last time you read it. at most 9007199254740991; greater than 0. |
| `links[].amountMinor` | string or null | Yes | An amount in cents (the currency's smallest unit), written as a whole-number string such as "1250" for $12.50. |
| `links[].currency` | string | Yes | Three-letter currency code, such as CAD or USD. |
| `links[].reason` | string | Yes | A short note saying why, kept in the record's history. 3–1000 characters. |
| `idempotencyKey` | string | Yes | Any unique text you generate once per intended change, so a retried request only happens once. Send it as the Idempotency-Key header instead if you prefer; if you send both they must match. 8–200 characters. |

## Example request

```bash
curl https://app.getoatmilk.com/api/v1/accounting/sponsorships.links.set \
  -H "Authorization: Bearer $OATMILK_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
  "expectedRevision": 3,
  "links": [
    {
      "kind": "entry",
      "sourceId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
      "sourceRevision": 3,
      "amountMinor": "1",
      "currency": "CAD",
      "reason": "Synthetic example from the docs"
    }
  ]
}'
```

Reference page: https://app.getoatmilk.com/docs/api/sponsorships.links.set
