# tags.notion.link

Link a project to a Notion page or database row with page, sourceOfTruth (notion: name, dates, status, budget and description come from Notion; oatmilk: Oatmilk writes them to Notion) and idempotencyKey. Pass tagId (and optionally the project's expectedRevision) to link an existing project, or leave it out to create a project from the page (optionally parentId and color). For a database row, properties is required: the Notion property for each of dates, status, budget and description, or null to leave it out (accounting_tags_notion_preview suggests them; nothing is mapped silently). Linking syncs once straight away and never empties a filled field on either side: where one side is empty the filled value is kept, reads the page text as context for the classifier, and asks the classifier to suggest transactions for the project.

`POST /api/v1/accounting/tags.notion.link`

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

MCP tool: `accounting_tags_notion_link`

## Fields

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `tagId` | string (ID) |  | The ID of a project tag, from tags.list. |
| `expectedRevision` | integer |  | 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. at most 9007199254740991; greater than 0. |
| `page` | string | Yes | 1–2000 characters. |
| `sourceOfTruth` | enum | Yes | One of: `oatmilk`, `notion`. |
| `properties` | object |  | No other fields. |
| `properties.dates` | string or null |  |  |
| `properties.status` | string or null |  | Only include records with this status. |
| `properties.budget` | string or null |  |  |
| `properties.description` | string or null |  | A short description. |
| `parentId` | string (ID) |  | The ID of the related record. |
| `color` | enum |  | One of: `gray`, `red`, `orange`, `amber`, `green`, `teal`, `blue`, `purple`, `pink`. |
| `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/tags.notion.link \
  -H "Authorization: Bearer $OATMILK_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "page": "example",
  "sourceOfTruth": "oatmilk"
}'
```

Reference page: https://app.getoatmilk.com/docs/api/tags.notion.link
