# dataSources.pin

Pin or unpin a database for everyone in the workspace so it appears first when importing. Supply source, databaseId, pinned and idempotencyKey.

`POST /api/v1/accounting/dataSources.pin`

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

MCP tool: `accounting_data_sources_pin`

## Fields

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `source` | enum | Yes | Where the record came from. One of: `notion`, `google_drive`, `onedrive`. |
| `databaseId` | string | Yes | 1–200 characters; Matches ^[A-Za-z0-9_.:-]+$. |
| `pinned` | boolean | Yes |  |
| `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/dataSources.pin \
  -H "Authorization: Bearer $OATMILK_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "source": "notion",
  "databaseId": "database_id",
  "pinned": true
}'
```

Reference page: https://app.getoatmilk.com/docs/api/dataSources.pin
