Overview
For completed normal tasks, if the file category is incorrect, you can use the amend category API to modify the file category. After modification, the system will reprocess the data using the new category.Only normal tasks support category modification. File split tasks and multi-image crop tasks require using corresponding parameters for modification.
After modifying the file category, the system will automatically re-extract using the fields configured for the new category, and the extraction results will change.
Use Cases
- Category Error Correction: Automatic classification results are incorrect and need manual correction
- Category Adjustment: Business requirements change and files need to be reclassified
API Endpoint
Endpoint:POST /api/app-api/sip/platform/v2/file/amend_category
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspace_id | string | Yes | Workspace ID |
task_id | string | Yes | Task ID |
category | string | Yes | New file category |
Parameter Description
task_id: Can be obtained through thefile/fetchAPIcategory: New file category name, must be a file category already configured in the DocFlow workspace
Example Code
Get Task ID
Before modifying the file category, you need to obtain the task’stask_id. You can query it through the file/fetch API:
Response
After successfully modifying the file category, the API returns a success response:Complete Example
The following is a complete example showing how to query file information, get the task ID, and then modify the file category:Python
Notes
- Task Type Restriction: Only normal tasks (non-split tasks, non-multi-image crop tasks) support category modification through the
categoryparameter - Category Must Exist: The specified
categorymust already be configured in the DocFlow workspace, otherwise an error will be returned - Category Name Matching: Category names must exactly match the configuration (case-sensitive)
- Chinese Category Handling: If using Chinese category names, ensure the request body uses UTF-8 encoding
- Reprocessing After Modification: After modifying the file category, the system will reprocess the data according to the new category

