Classify file and set attribute values
Changed onApply content-type classifications to a file and set attribute values (metadata) on it. This is how you tag a document with structured metadata from your content-type schema.
Typical workflow:
- Classify the file: {"action": "classify", "content_type_path": "legal:contract:nda"}
- Set attribute values: {"action": "set_value", "content_type_path": "legal:contract:nda", "attribute_name": "jurisdiction", "value": ["FR", "DE"]}
- Read back with GET /api/v3/files/{file_id}/facets
A file can be classified under multiple content types. Just call classify for each one. Removing a classification (unclassify) cascades: all attribute values under that content type are removed too.
Actions:
- classify: assign a content type to the file (idempotent)
- unclassify: remove a content type and all its attribute values
- set_value: set or update an attribute value (the content type must be classified first)
- clear_value: remove an attribute value
Value types for set_value:
- text / rich-text → string
- number → number or numeric string
- date → date string, normalized to YYYY-MM-DD
- boolean → true / false
- select → one string from choices
- multi-select → array of strings from choices
To clear a value, use clear_value (not set_value with null).
Prerequisites: Content types must be set up first. See GET /api/v3/content-types/templates (browse templates) and POST /api/v3/content-types (adopt or create).
Requires edit access to the file.
Request
- Base URLhttps://api.lighton.ai
- URLhttps://api.lighton.ai/api/v3/files/{file_id}/facets
- AuthHTTP bearer
Path parameters
Request body
Response
Content type already classified, or attribute value updated
Changes
- info
added the non-success response with the status
- info