Document Display Names
Give documents readable names: choose a rule, preview a script on real filenames, draft one from a plain instruction, check coverage, and apply it to every document.
Filenames from scanners and mail systems are often unreadable: a GUID, a date stamp, a sender prefix. A display name rule turns each filename into a readable name that review screens and lists show instead. The rule has three modes: off (no readable names, the default), default (Talonic tidies the filename) and lua (your own short script decides).
A script reads record.filename and calls record:set('display_name', value). Before you save one, POST /v1/documents/display-name-rule/preview runs it over a sample of your real filenames and shows what it would produce, without saving anything. If you would rather describe the rule in words ("drop the GUID in front of the name"), POST /v1/documents/display-name-rule/generate-script drafts a script from your instruction, using your own filenames as examples. It also saves nothing.
Saving a rule with PATCH /v1/documents/display-name-rule applies it to documents from then on. To rename the documents you already have, call POST /v1/documents/display-name-rule/backfill, which overwrites their readable names. GET /v1/documents/display-name-rule/coverage reports how many documents carry a readable name, how many differ from their filename, and a sample still showing the raw filename.
The reads need the read scope (or documents:read), and any member may call them. Setting, previewing, drafting and applying the rule need documents:write, and the key's person must be an Admin of the workspace, as in the web app; anyone else gets 403 insufficient_role.
/v1/documents/display-name-ruleResponse fields
off, default or lua.{ filename, display_name } pairs from stored documents./v1/documents/display-name-ruleBody parameters
off, default or lua.lua; in the other modes it is kept as a draft./v1/documents/display-name-rule/previewBody parameters
50Preview a script
curl -X POST https://api.talonic.com/v1/documents/display-name-rule/preview \
-H "Authorization: Bearer $TALONIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"lua_script": "record:set(\"display_name\", (record.filename:gsub(\"^%x+%-\", \"\")))", "sample_size": 20}'/v1/documents/display-name-rule/generate-scriptBody parameters
40/v1/documents/display-name-rule/coverage/v1/documents/display-name-rule/backfillcheck_pending is false on GET /v1/documents/display-name-rule before you apply a newly saved script.