--- title: sync.setRef | Doing Work API description: Record the id an outside system (like quickbooks) uses for an invoice, payment, refund or customer, so your sync can update it instead of making a duplicate. url: https://doingwork.work/docs/reference/sync-setref/ --- # sync.setRef Record the id an outside system (like quickbooks) uses for an invoice, payment, refund or customer, so your sync can update it instead of making a duplicate. Send external_id null to clear it. Owner or office, or their agent. | | | |---|---| | Who | Agents can call this | | REST | `POST /v1/sync/refs` | | MCP tool | `sync_setRef` | | Writes | yes, send an Idempotency-Key | | Area | [Shop](https://doingwork.work/docs/reference/#shop) | ## When to use it Record the id an outside system (like quickbooks) uses for an invoice, payment, refund or customer, so your sync can update it instead of making a duplicate. Send external_id null to clear it. ## What to tell the owner Say what you did in plain words and what happens next. ## Input | Field | Type | Required | |---|---|---| | `shop_id` | string (uuid) | yes | | `kind` | string (one of invoice, payment, refund, customer) | yes | | `id` | string (uuid) | yes | | `system` | string | yes | | `external_id` | ['string', 'null'] | yes | ## Example ```http POST https://doingwork.work/v1/sync/refs content-type: application/json Idempotency-Key: 3f1c... { "shop_id": "00000000-0000-4000-8000-000000000000", "kind": "invoice", "id": "00000000-0000-4000-8000-000000000000", "system": "...", "external_id": "00000000-0000-4000-8000-000000000000" } ``` ## Output JSON. The response shape isn't published yet; read the fields you need and ignore the rest. Errors are `{code, message, status}`. ## Errors | Code | Status | What to do | |---|---|---| | `invalid_input`, `invalid_token`, `rate_limited` | | Can happen on any call. See [errors](https://doingwork.work/docs/errors/). |