Skip to main content

Tags, Facets & Batch Metadata

List document tags and filter counts, add, remove or set tags on up to 1000 documents in one call, replace one document's tags, and import batch ids from CSV.

Tags are the labels your team puts on documents to sort, filter and share them. GET /v1/documents/tags lists every distinct tag on documents the key's person can see, and GET /v1/documents/system-tags lists the grouping tags Talonic sets itself, such as the email or archive a document arrived in. GET /v1/documents/facets counts visible documents per filter value, ready to drive a filter panel.

PATCH /v1/documents/batch-tag changes the tags of up to 1000 documents in one call: add merges the tags in, remove takes them away, and set replaces each document's tags. It is all or nothing: if one document is missing or hidden from the key's person, nothing changes and the call answers 404. The answer lists each document's resulting tags and the id of the one audit event the change recorded. PATCH /v1/documents/{id}/tags replaces one document's tags; an empty list clears them.

POST /v1/documents/batch-metadata/import sets batch ids on documents you already have, from a CSV. The CSV needs a document_id column and a batch_id column. document_id may be the document id, the filename without its extension, or the item id the source gave the document. Talonic answers how many documents it updated and which document_id values matched nothing.

Who can call these routes. The reads need the read scope (or documents:read), and any member of the workspace may call them. The writes need documents:write, and the key's person must be an Admin of the workspace, as in the web app; in a workspace whose model configuration Talonic manages, they return 403 insufficient_role. A tag can grant access through a tag share, so tag writes are held to the same rule as on the screen.

GET/v1/documents/tags
GET/v1/documents/system-tags
GET/v1/documents/facets

Response fields

sensitivityarrayDocuments per sensitivity level.
departmentarrayDocuments per department.
jurisdictionarrayDocuments per jurisdiction, where one was found.
languagearrayDocuments per language.
regulatedarrayDocuments that likely hold regulated data (true) or not (false).
piiarrayDocuments per kind of personal data found.
specialCategoryarrayDocuments per special category of personal data found.
PATCH/v1/documents/batch-tag

Body parameters

document_ids*uuid[]Documents to change, 1 to 1000.
tags*string[]Tags to apply, at most 50, each up to 64 characters with at least one visible character.
modestringadd merges, remove takes the tags away, set replaces each document's tags. Default: add

Tag two documents

curl -X PATCH https://api.talonic.com/v1/documents/batch-tag \
  -H "Authorization: Bearer $TALONIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"document_ids": ["0b6c1f9e-2d4a-4e8b-9c1d-3f5a7b9c2e10", "4e2a8c1b-7f3d-4a6e-b9c0-1d2e3f4a5b6c"], "tags": ["q3-close"], "mode": "add"}'

Response (200)

{
  "updated": 2,
  "mode": "add",
  "tags": ["q3-close"],
  "results": [
    { "id": "0b6c1f9e-2d4a-4e8b-9c1d-3f5a7b9c2e10", "status": "updated", "tags": ["invoices", "q3-close"] },
    { "id": "4e2a8c1b-7f3d-4a6e-b9c0-1d2e3f4a5b6c", "status": "updated", "tags": ["q3-close"] }
  ],
  "audit_event_id": "e7a1c2d3-4b5f-4e6a-9c8d-1f2e3a4b5c6d"
}
PATCH/v1/documents/{id}/tags
POST/v1/documents/batch-metadata/import

CSV columns

document_id*stringThe document id, the filename without its extension, or the source item id.
batch_id*stringThe batch id to set on that document.

Import batch ids

curl -X POST https://api.talonic.com/v1/documents/batch-metadata/import \
  -H "Authorization: Bearer $TALONIC_API_KEY" \
  -F "file=@batches.csv"

Errors

Error responses

400validation_errorBad body (too many ids or tags, a blank tag), a CSV without the two columns, no file, or a call made from the all-workspaces view.
403forbiddenreason: insufficient_scope, insufficient_role, no_person, person_inactive or workspace_read_only.
404not_foundA document is missing or hidden from the key's person. A batch changes nothing in that case.

Frequently asked questions

What happens if one document in a batch-tag call is hidden from me?+
Nothing changes. The call is all or nothing and answers 404, so you never tag part of a batch by accident. Remove the document from the list and call again.
What is the difference between tags and system tags?+
Tags are set by people and integrations and can be changed with these routes. System tags are set by Talonic to group documents that arrived together, such as the attachments of one email or the files of one archive.
Which values can the CSV document_id column hold?+
The document id, the filename without its extension, or the item id the source gave the document. Values that match nothing come back in not_found.
Why does a tag change need an Admin?+
A tag can grant access to a document through a tag share, so changing tags can change who sees what. The API applies the same rule as the web app.