Skip to main content

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:

RecordPageList operation
ClientClientslist-clients
ProjectProjectslist-projects
InvoiceInvoiceslist-invoices
QuoteQuoteslist-quotes
Time entryTime trackinglist-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.

RuleLimit
Key1 to 40 characters from A-Z a-z 0-9 _ . - (case-sensitive)
Value1 to 500 Unicode characters (characters, not bytes)
Keys per record50, counted after an update is merged
Value charactersNo NUL (\u0000) and no other control character below U+0020 except tab, so no line breaks
Filter keys per request10

A request that breaks a rule is refused whole, with nothing stored, and returns 422 with a typed error that names the offending key:

CodeMeaning
METADATA_INVALID_KEYA key is empty, too long or has a character outside the allowed set. translationParams.key repeats it.
METADATA_VALUE_TOO_LONGA value is longer than 500 characters (an empty value is a delete, see below).
METADATA_VALUE_EMPTYA metadata[key]= list filter has an empty value. translationParams.key repeats the key.
METADATA_INVALID_VALUEA value contains a control character.
METADATA_TOO_MANY_KEYSThe record would hold more than 50 keys once the update is applied.
METADATA_TOO_MANY_FILTERSA 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 sendResult
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": nullRemoves 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 metadata with any other field is judged by the usual rules for that record, so an issued invoice still answers 409 INVOICE_NOT_DRAFT to {"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-123 doesn't match abc-123 or ABC-1234.
  • At most 10 keys per request (METADATA_TOO_MANY_FILTERS). A key or a value that breaks the rules above answers 422, the same codes as for a write.
  • Escape the value as any query value (%26 for &, %3D for =).
  • 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-entries computes its totalMinutes and billableMinutes over 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 read supersededById, 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​

SituationMetadata
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 invoiceNot copied, from the project or from the entries.
An invoice drafted from a recurring scheduleNot 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 cloneCopied 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.