Overview
For completed file split tasks, if the category of split child files is incorrect or you need to adjust the page range of child files, you can use the amend category API to modify the category and page numbers of split files.This API is used to modify the category and page numbers of child files generated by file split tasks (
task_type = 2, parent task). You need to first obtain the parent task’s task_id.Use Cases
- Split Category Correction: After automatic splitting, some child files have incorrect category recognition and need manual correction
- Page Range Adjustment: The page range of split files needs adjustment, such as merging or re-dividing multiple child files
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 | Parent task ID (file split task ID) |
split_tasks | array | Yes | File split task list, each element contains category and pages |
split_tasks Parameter Description
| Parameter | Type | Required | Description |
|---|---|---|---|
category | string | Yes | Child task file category |
pages | array | Yes | Child file page number array, starting from 0 |
Parameter Description
task_id: Parent task ID (task_type = 2), can be obtained through thefile/fetchAPIcategory: New file category name, must be a file category already configured in the DocFlow workspace. If a child file doesn’t need category modification, you can keep the original category unchangedpages: Page number array indicating the original file pages contained in this child file. For example,[0, 1]means pages 1 and 2 (starting from 0). If a child file doesn’t need page number modification, you can keep the original page numbers unchanged
Important: The
split_tasks array must contain all split child file information, even if some child files don’t need category or page number modifications. If only partial child file information is submitted, the unlisted child files will be deleted or cause processing exceptions.Example Code
Get Parent Task ID and Child File Information
Before modifying the file category, you need to obtain the parent task’stask_id and child file information. 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 split task information and then modify child file categories and page numbers:Python
Page Number Notes
- Page numbers start from 0, meaning page 1 corresponds to page number
0, page 2 corresponds to page number1, and so on - The
pagesarray indicates the original file page numbers contained in this child file
Notes
- Must Include All Child Files: The
split_tasksarray must contain all split child file information, even if some child files don’t need category or page number modifications. If only partial child file information is submitted, the unlisted child files will be deleted or cause processing exceptions - Task Type Restriction: Only file split parent tasks (
task_type = 2) support using thesplit_tasksparameter - 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)
- Page Range: Ensure page numbers in the
pagesarray are within valid range (0 to total pages - 1), and page numbers cannot be duplicated - No Duplicate Pages: Each page number can only appear in one child file, no overlapping allowed
- Reprocessing After Modification: After modifying file categories and page numbers, the system will reprocess data according to the new categories and page ranges

