# notion.links.create

Link an Oatmilk account, invoice, or contractor to a Notion page by page ID or pasted link. Links created by a person are confirmed unless status is proposed. Supply idempotencyKey.

`POST /api/v1/accounting/notion.links.create`

Permissions: `accounting:read`, `accounting:write` · Roles: admin, finance · Idempotency key required · Reaches outside Oatmilk (email or a provider)

MCP tool: `accounting_notion_links_create`

## Fields

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `localType` | enum | Yes | One of: `party`, `invoice`, `contractor`. |
| `localId` | string (ID) | Yes | The ID of the related record. |
| `role` | enum |  | A person's access level in the company. One of: `invoices`, `companies`, `vendors`, `contacts`. |
| `pageId` | string |  | 32–36 characters. |
| `url` | string |  | A full web address, starting with https://. 1–2000 characters. |
| `method` | enum |  | One of: `manual`, `link`, `smart_lookup`. |
| `status` | enum |  | Only include records with this status. One of: `confirmed`, `proposed`. |
| `candidate` | object |  | No other fields. |
| `candidate.score` | integer |  | 0 to 100. |
| `candidate.confidence` | enum |  | One of: `low`, `medium`, `high`. |
| `candidate.reasons` | array of strings |  | at most 20 items; each at most 200 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/notion.links.create \
  -H "Authorization: Bearer $OATMILK_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "localType": "party",
  "localId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
  "pageId": "9f2b5c1d7e3a4b6c8d0e2f4a6b8c0d2e"
}'
```

Reference page: https://app.getoatmilk.com/docs/api/notion.links.create
