Overview
PATCH /invoices/{id} updates the metadata of an issued invoice - a free-form bag of string key/value pairs you can use to attach your own references (an external accounting ID, a Mews record, a sync state…).
An issued invoice is legally immutable: its amounts, lines, and the seller / account / contact snapshots are frozen at issue time and cannot be changed through this endpoint. metadata is the only writable field; it lives alongside the legal invoice and never affects it. A legal correction is always materialized by a new document (typically a credit note), never by editing an invoice.
This endpoint does not emit any webhook - there is no
invoice.updated event. Updating metadata is a silent, side-channel write. Any attempt to modify a legal field is rejected with 422.metadata: { "ref": "ABC" }upserts therefkey, leaving every other key untouched.metadata: { "ref": null }deletes therefkey.
Authentication
All requests require a Bearer token (your BookingShake API key):Path Parameters
The invoice document ID - the
id field carried by the invoice.created webhook.Body Parameters
A flat object of string values. Pass
null as a value to delete that key. Keys present in the object are merged into the existing metadata; keys you omit are left untouched.Limits: up to 50 keys per invoice, each key ≤ 40 characters, each value ≤ 500 characters. Nested objects, arrays, and non-string values are rejected with 422.Request
Response
The full invoice is returned in its post-update state, wrapped in the standard{ message, data } envelope - identical in shape to GET /invoices/{id}, with the updated metadata.
Errors
| Status | Meaning |
|---|---|
400 | Missing/invalid token, missing invoice id, empty/invalid body, or no metadata provided |
422 | A field other than metadata was sent (legal fields are immutable), metadata is not a flat object of strings, or a limit was exceeded (50 keys, key ≤ 40 chars, value ≤ 500 chars) |
404 | Invoice not found - it does not exist, belongs to another venue, or is not an invoice (e.g. a quote) |
429 | Rate limit exceeded (30 requests/minute) |
500 | Internal server error |
A
404 is returned uniformly whenever the invoice is outside your scope, so the existence of another venue’s invoice is never disclosed.Next Steps
Get an Invoice
Retrieve an invoice and read its current metadata
Invoice Events
Receive invoices in real time via the invoice.created webhook
