Metadata
Metadata is a small set of your own key/value pairs on a record, for the things your system knows and Budget Thing doesn't: an external ID, a CRM deal, the ERP record the invoice came from. Five kinds of business record carry it:
| Record | Page | List operation |
|---|---|---|
| Client | Clients | list-clients |
| Project | Projects | list-projects |
| Invoice | Invoices | list-invoices |
| Quote | Quotes | list-quotes |
| Time entry | Time tracking | list-time-entries |
All of them are in business workspaces, so
every operation returns 409 WORKSPACE_NOT_BUSINESS in a personal workspace.
Metadata has no scopes of its own: you read and write it through the record's
own operations, with that record's scopes, role rules and plan feature.
Metadata is internal. It is returned by the API and carried in events, exports and workspace clones. It is never printed on a quote or invoice PDF, never in the frozen document snapshot, never on a shared document and never in a document or reminder email. Don't put anything in metadata that you wouldn't want your own staff to see.
The field
Every read of one of these records has a metadata member. It is always an
object, {} when the record has none, never null and never left out:
{
"id": "cli_...",
"name": "Acme Design Studio",
"metadata": { "external_id": "ABC-123", "source": "crm" }
}
Keys and values are strings.
| Rule | Limit |
|---|---|
| Key | 1 to 40 characters from A-Z a-z 0-9 _ . - (case-sensitive) |
| Value | 1 to 500 Unicode characters (characters, not bytes) |
| Keys per record | 50, counted after an update is merged |
| Value characters | No NUL (\u0000) and no other control character below U+0020 except tab, so no line breaks |
| Filter keys per request | 10 |
A request that breaks a rule is refused whole, with nothing stored, and returns
422 with a typed error that names the offending key:
| Code | Meaning |
|---|---|
METADATA_INVALID_KEY | A key is empty, too long or has a character outside the allowed set. translationParams.key repeats it. |
METADATA_VALUE_TOO_LONG | A value is longer than 500 characters (an empty value is a delete, see below). |
METADATA_VALUE_EMPTY | A metadata[key]= list filter has an empty value. translationParams.key repeats the key. |
METADATA_INVALID_VALUE | A value contains a control character. |
METADATA_TOO_MANY_KEYS | The record would hold more than 50 keys once the update is applied. |
METADATA_TOO_MANY_FILTERS | A list was filtered by more than 10 metadata keys. |
Writing metadata
metadata is an optional member of the create and update request of each
record.
On create an omitted, null or {} member stores {}. A key whose value
is null or "" is ignored.
On update the pairs you send are merged per key into what is stored:
| You send | Result |
|---|---|
metadata left out, or "metadata": {} | No change. |
"metadata": { "k": "v" } | Sets k, or overwrites it. Other keys stay. |
"metadata": { "k": null } or { "k": "" } | Removes k. Removing a key that isn't there is not an error. |
"metadata": null | Removes every key. |
So PATCH with {"metadata": {"source": "erp", "legacy_id": null}} changes
source and removes legacy_id, and leaves every other key as it was. The
50-key limit is checked on the result, so swapping one key for another on a
record that already holds 50 works.
A metadata change goes through the record's normal update: it is saved in one
transaction with the rest of the request, bumps updatedAt and publishes the
record's normal *.updated event.
Locked records
Metadata is internal and never on a document, so it stays writable where the
rest of the record is locked, as long as the request changes only
metadata:
- an issued or void invoice, a sent, accepted, declined or superseded quote,
billed or written-off time, and an archived client or project accept a
metadata-only
PATCH. This is how you attach an external ID to an invoice after you issued it. - a request that mixes
metadatawith any other field is judged by the usual rules for that record, so an issued invoice still answers409INVOICE_NOT_DRAFTto{"notes": "x", "metadata": {...}}.
Finding records by metadata
Every list operation in the table above takes the same exact-match filter as
a metadata[key]=value query parameter. Several keys are AND-ed, and the
filter AND-s with the operation's other filters:
GET /v1/workspaces/{workspaceID}/invoices?metadata[external_id]=ABC-123&metadata[source]=crm&status=issued
- Matching is exact and case-sensitive:
ABC-123doesn't matchabc-123orABC-1234. - At most 10 keys per request (
METADATA_TOO_MANY_FILTERS). A key or a value that breaks the rules above answers422, the same codes as for a write. - Escape the value as any query value (
%26for&,%3Dfor=). - The filter only narrows a list you can already read. It never reaches into another workspace: a value that exists in two workspaces matches only in the one you ask about.
list-time-entriescomputes itstotalMinutesandbillableMinutesover the filtered entries.- A new quote version copies its metadata (see below), so a filter on a quote's
external ID returns the superseded versions as well. Filter on
status, or readsupersededById, to tell them apart.
The parameter is an OpenAPI deepObject (style: deepObject, explode: true),
which generated clients serialize as metadata[key]=value. AI assistants pass it
as an object argument, {"metadata": {"external_id": "ABC-123"}}; see
MCP tools.
What is copied, and what isn't
| Situation | Metadata |
|---|---|
A new version of a quote (create-quote-version) | Copied. A version is a revision of the same quote, so your reference still applies. The two versions don't share it afterwards. |
Quote lines added to an invoice (lines/from-quote) | Not copied. An invoice can draw on several quotes, so it would be ambiguous. Set the invoice's own metadata. |
| Billing time onto an invoice | Not copied, from the project or from the entries. |
| An invoice drafted from a recurring schedule | Not copied. Schedules have no metadata. |
Workspace export (data.json) | Included, as a metadata object on each client, project, quote, invoice and time entry of data.json. |
| Workspace clone | Copied with the record. |
In events and webhooks
The snapshot of the record inside an event carries the record's metadata, so you can correlate an event with your own ID without a second call:
{
"type": "invoice.updated",
"data": {
"invoice": {
"id": "inv_...",
"client_id": "cli_...",
"status": "issued",
"metadata": { "external_id": "ABC-123" }
}
}
}
metadata is inside the client, project, invoice, quote or entry
object and never a top-level member of the payload. A *.deleted event carries
the metadata the record had before it was deleted. Changing only metadata
publishes the record's normal *.updated event with an empty changes object.
See Webhook events.