rossum-mcp 0.4.0__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rossum_mcp/__init__.py +1 -1
- rossum_mcp/tools/annotations.py +11 -1
- rossum_mcp/tools/base.py +33 -0
- rossum_mcp/tools/catalog.py +8 -1
- rossum_mcp/tools/discovery.py +2 -1
- rossum_mcp/tools/email_templates.py +5 -9
- rossum_mcp/tools/hooks.py +15 -11
- rossum_mcp/tools/queues.py +25 -6
- rossum_mcp/tools/rules.py +10 -0
- rossum_mcp/tools/schemas.py +23 -7
- rossum_mcp/tools/workspaces.py +9 -1
- rossum_mcp-1.0.0.dist-info/METADATA +241 -0
- rossum_mcp-1.0.0.dist-info/RECORD +25 -0
- {rossum_mcp-0.4.0.dist-info → rossum_mcp-1.0.0.dist-info}/WHEEL +1 -1
- rossum_mcp-1.0.0.dist-info/licenses/LICENSE +21 -0
- rossum_mcp-0.4.0.dist-info/METADATA +0 -1895
- rossum_mcp-0.4.0.dist-info/RECORD +0 -24
- {rossum_mcp-0.4.0.dist-info → rossum_mcp-1.0.0.dist-info}/entry_points.txt +0 -0
- {rossum_mcp-0.4.0.dist-info → rossum_mcp-1.0.0.dist-info}/top_level.txt +0 -0
|
@@ -1,1895 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: rossum-mcp
|
|
3
|
-
Version: 0.4.0
|
|
4
|
-
Summary: MCP server for AI-powered Rossum orchestration: document workflows, debug pipelines automatically, and configure intelligent document processing through natural language.
|
|
5
|
-
Author-email: "Dan Stancl (Rossum AI)" <daniel.stancl@gmail.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Keywords: mcp,rossum,document-processing
|
|
8
|
-
Classifier: Development Status :: 4 - Beta
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
-
Classifier: Intended Audience :: Developers
|
|
15
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
-
Requires-Python: >=3.12
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
Requires-Dist: fastmcp>2.0.0
|
|
20
|
-
Requires-Dist: pydantic>2.0.0
|
|
21
|
-
Requires-Dist: rossum-api>=3.7.0
|
|
22
|
-
Provides-Extra: docs
|
|
23
|
-
Requires-Dist: myst-parser>=2.0.0; extra == "docs"
|
|
24
|
-
Requires-Dist: sphinx>=7.0.0; extra == "docs"
|
|
25
|
-
Requires-Dist: sphinx-autodoc-typehints>=1.25.0; extra == "docs"
|
|
26
|
-
Requires-Dist: sphinx-copybutton>=0.5.2; extra == "docs"
|
|
27
|
-
Requires-Dist: sphinx-rtd-theme>=2.0.0; extra == "docs"
|
|
28
|
-
Provides-Extra: tests
|
|
29
|
-
Requires-Dist: coverage>=7.0.0; extra == "tests"
|
|
30
|
-
Requires-Dist: pytest>=7.0.0; extra == "tests"
|
|
31
|
-
Requires-Dist: pytest-asyncio>=0.21.0; extra == "tests"
|
|
32
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == "tests"
|
|
33
|
-
Requires-Dist: redis>=7.0.0; extra == "tests"
|
|
34
|
-
Provides-Extra: all
|
|
35
|
-
Requires-Dist: coverage>=7.0.0; extra == "all"
|
|
36
|
-
Requires-Dist: fastmcp>=1.0.0; extra == "all"
|
|
37
|
-
Requires-Dist: myst-parser>=2.0.0; extra == "all"
|
|
38
|
-
Requires-Dist: pydantic>2.0.0; extra == "all"
|
|
39
|
-
Requires-Dist: pytest>=7.0.0; extra == "all"
|
|
40
|
-
Requires-Dist: pytest-asyncio>=0.21.0; extra == "all"
|
|
41
|
-
Requires-Dist: redis>=7.0.0; extra == "all"
|
|
42
|
-
Requires-Dist: rossum-api>=3.7.0; extra == "all"
|
|
43
|
-
Requires-Dist: sphinx>=7.0.0; extra == "all"
|
|
44
|
-
Requires-Dist: sphinx-autodoc-typehints>=1.25.0; extra == "all"
|
|
45
|
-
Requires-Dist: sphinx-copybutton>=0.5.2; extra == "all"
|
|
46
|
-
Requires-Dist: sphinx-rtd-theme>=2.0.0; extra == "all"
|
|
47
|
-
|
|
48
|
-
# Rossum MCP Server
|
|
49
|
-
|
|
50
|
-
<div align="center">
|
|
51
|
-
|
|
52
|
-
[](https://stancld.github.io/rossum-mcp/)
|
|
53
|
-
[](https://www.python.org/downloads/)
|
|
54
|
-
[](https://opensource.org/licenses/MIT)
|
|
55
|
-
[](https://pypi.org/project/rossum-mcp/)
|
|
56
|
-
[](https://codecov.io/gh/stancld/rossum-mcp)
|
|
57
|
-
[](#available-tools)
|
|
58
|
-
|
|
59
|
-
[](https://github.com/rossumai/rossum-api)
|
|
60
|
-
[](https://modelcontextprotocol.io/)
|
|
61
|
-
[](https://github.com/astral-sh/ruff)
|
|
62
|
-
[](https://github.com/astral-sh/ty)
|
|
63
|
-
[](https://github.com/astral-sh/uv)
|
|
64
|
-
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
A Model Context Protocol (MCP) server that provides tools for uploading documents and retrieving annotations using the Rossum API. Built with Python and the official [rossum-api](https://github.com/rossumai/rossum-api).
|
|
68
|
-
|
|
69
|
-
> [!NOTE]
|
|
70
|
-
> This is not an official Rossum project. It is a community-developed integration built on top of the Rossum API.
|
|
71
|
-
|
|
72
|
-
> [!WARNING]
|
|
73
|
-
> This project is in early stage development. Breaking changes to both implementation and agent behavior are expected.
|
|
74
|
-
|
|
75
|
-
## Features
|
|
76
|
-
|
|
77
|
-
<details>
|
|
78
|
-
<summary><strong>Document Processing (6 tools)</strong></summary>
|
|
79
|
-
|
|
80
|
-
- **upload_document**: Upload a document to Rossum for processing
|
|
81
|
-
- **get_annotation**: Retrieve annotation data for a previously uploaded document
|
|
82
|
-
- **list_annotations**: List all annotations for a queue with optional filtering
|
|
83
|
-
- **start_annotation**: Start annotation to move it to 'reviewing' status
|
|
84
|
-
- **bulk_update_annotation_fields**: Bulk update annotation field values using JSON Patch operations
|
|
85
|
-
- **confirm_annotation**: Confirm annotation to move it to 'confirmed' status
|
|
86
|
-
|
|
87
|
-
</details>
|
|
88
|
-
|
|
89
|
-
<details>
|
|
90
|
-
<summary><strong>Queue & Schema Management (13 tools)</strong></summary>
|
|
91
|
-
|
|
92
|
-
- **get_queue**: Retrieve queue details including schema_id
|
|
93
|
-
- **list_queues**: List all queues with optional filtering by workspace or name
|
|
94
|
-
- **get_schema**: Retrieve schema details and content
|
|
95
|
-
- **list_schemas**: List all schemas with optional filtering by name or queue
|
|
96
|
-
- **get_schema_tree_structure**: Get lightweight tree view of schema with only ids, labels, categories, and types
|
|
97
|
-
- **get_queue_schema**: Retrieve complete schema for a queue in a single call
|
|
98
|
-
- **get_queue_engine**: Retrieve engine information for a queue
|
|
99
|
-
- **create_queue**: Create a new queue with schema and optional engine assignment
|
|
100
|
-
- **create_schema**: Create a new schema with sections and datapoints
|
|
101
|
-
- **update_queue**: Update queue settings including automation thresholds
|
|
102
|
-
- **update_schema**: Update schema with field-level automation thresholds
|
|
103
|
-
- **patch_schema**: Add, update, or remove individual schema nodes without replacing entire content
|
|
104
|
-
- **prune_schema_fields**: Efficiently remove multiple fields from schema at once (for organization setup)
|
|
105
|
-
|
|
106
|
-
</details>
|
|
107
|
-
|
|
108
|
-
<details>
|
|
109
|
-
<summary><strong>Workspace Management (3 tools)</strong></summary>
|
|
110
|
-
|
|
111
|
-
- **get_workspace**: Retrieve workspace details by ID
|
|
112
|
-
- **list_workspaces**: List all workspaces with optional filtering
|
|
113
|
-
- **create_workspace**: Create a new workspace
|
|
114
|
-
|
|
115
|
-
</details>
|
|
116
|
-
|
|
117
|
-
<details>
|
|
118
|
-
<summary><strong>User Management (3 tools)</strong></summary>
|
|
119
|
-
|
|
120
|
-
- **get_user**: Retrieve user details by ID
|
|
121
|
-
- **list_users**: List users with optional filtering by username, email, etc.
|
|
122
|
-
- **list_user_roles**: List all user roles (permission groups) in the organization
|
|
123
|
-
|
|
124
|
-
</details>
|
|
125
|
-
|
|
126
|
-
<details>
|
|
127
|
-
<summary><strong>Engine Management (6 tools)</strong></summary>
|
|
128
|
-
|
|
129
|
-
- **get_engine**: Retrieve engine details by ID
|
|
130
|
-
- **list_engines**: List all engines with optional filters
|
|
131
|
-
- **create_engine**: Create a new engine (extractor or splitter)
|
|
132
|
-
- **update_engine**: Update engine settings including learning and training queues
|
|
133
|
-
- **create_engine_field**: Create engine fields and link them to schemas
|
|
134
|
-
- **get_engine_fields**: Retrieve engine fields for a specific engine or all engine fields
|
|
135
|
-
|
|
136
|
-
</details>
|
|
137
|
-
|
|
138
|
-
<details>
|
|
139
|
-
<summary><strong>Extensions & Rules (9 tools)</strong></summary>
|
|
140
|
-
|
|
141
|
-
- **get_hook**: Get hook/extension details
|
|
142
|
-
- **list_hooks**: List webhooks and serverless functions (extensions)
|
|
143
|
-
- **create_hook**: Create webhooks or serverless function hooks for custom logic
|
|
144
|
-
- **update_hook**: Update existing hook properties (name, queues, config, events, settings)
|
|
145
|
-
- **list_hook_templates**: List available hook templates from Rossum Store
|
|
146
|
-
- **create_hook_from_template**: Create a hook from a Rossum Store template
|
|
147
|
-
- **list_hook_logs**: List hook execution logs for debugging and monitoring
|
|
148
|
-
- **get_rule**: Get business rule details
|
|
149
|
-
- **list_rules**: List business rules with trigger conditions and actions
|
|
150
|
-
|
|
151
|
-
</details>
|
|
152
|
-
|
|
153
|
-
<details>
|
|
154
|
-
<summary><strong>Email Templates (3 tools)</strong></summary>
|
|
155
|
-
|
|
156
|
-
- **get_email_template**: Retrieve email template details by ID
|
|
157
|
-
- **list_email_templates**: List email templates with optional filtering by queue, type, or name
|
|
158
|
-
- **create_email_template**: Create email templates for automated or manual email sending
|
|
159
|
-
|
|
160
|
-
</details>
|
|
161
|
-
|
|
162
|
-
<details>
|
|
163
|
-
<summary><strong>Relations Management (4 tools)</strong></summary>
|
|
164
|
-
|
|
165
|
-
- **get_relation**: Retrieve relation details by ID
|
|
166
|
-
- **list_relations**: List all relations between annotations (edit, attachment, duplicate)
|
|
167
|
-
- **get_document_relation**: Retrieve document relation details by ID
|
|
168
|
-
- **list_document_relations**: List all document relations (export, einvoice)
|
|
169
|
-
|
|
170
|
-
</details>
|
|
171
|
-
|
|
172
|
-
<details>
|
|
173
|
-
<summary><strong>Tool Discovery (1 tool)</strong></summary>
|
|
174
|
-
|
|
175
|
-
- **list_tool_categories**: List all available tool categories with descriptions, tool names, and keywords for dynamic tool loading
|
|
176
|
-
|
|
177
|
-
</details>
|
|
178
|
-
|
|
179
|
-
## Prerequisites
|
|
180
|
-
|
|
181
|
-
- Python 3.12 or higher
|
|
182
|
-
- Rossum account with API credentials
|
|
183
|
-
- A Rossum queue ID
|
|
184
|
-
|
|
185
|
-
## Installation
|
|
186
|
-
|
|
187
|
-
### Docker (Recommended)
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
git clone https://github.com/stancld/rossum-mcp.git
|
|
191
|
-
cd rossum-mcp
|
|
192
|
-
|
|
193
|
-
# Set up environment variables
|
|
194
|
-
export ROSSUM_API_TOKEN="your-api-token"
|
|
195
|
-
export ROSSUM_API_BASE_URL="https://api.elis.rossum.ai/v1"
|
|
196
|
-
export ROSSUM_MCP_MODE="read-write" # Optional: "read-only" or "read-write" (default)
|
|
197
|
-
|
|
198
|
-
# Run the MCP server
|
|
199
|
-
docker-compose up rossum-agent
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
<details>
|
|
203
|
-
<summary>Install from source (alternative)</summary>
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
git clone https://github.com/stancld/rossum-mcp.git
|
|
207
|
-
cd rossum-mcp/rossum-mcp
|
|
208
|
-
uv sync
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
Install with extras:
|
|
212
|
-
```bash
|
|
213
|
-
uv sync --extra all # All extras (docs, tests)
|
|
214
|
-
uv sync --extra docs # Documentation only
|
|
215
|
-
uv sync --extra tests # Testing only
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
</details>
|
|
219
|
-
|
|
220
|
-
### Environment Variables
|
|
221
|
-
|
|
222
|
-
- **ROSSUM_API_TOKEN** (required): Your Rossum API authentication token
|
|
223
|
-
- **ROSSUM_API_BASE_URL** (required): Base URL for the Rossum API
|
|
224
|
-
- **ROSSUM_MCP_MODE** (optional): Controls which tools are available
|
|
225
|
-
- `read-write` (default): All tools available (GET, LIST, CREATE, UPDATE operations)
|
|
226
|
-
- `read-only`: Only read operations available (GET and LIST operations only)
|
|
227
|
-
|
|
228
|
-
#### Read-Only vs Read-Write Mode
|
|
229
|
-
|
|
230
|
-
When `ROSSUM_MCP_MODE` is set to `read-only`, only read operations are available:
|
|
231
|
-
- **Annotations:** `get_annotation`, `list_annotations`
|
|
232
|
-
- **Queues:** `get_queue`, `list_queues`, `get_queue_schema`, `get_queue_engine`
|
|
233
|
-
- **Schemas:** `get_schema`, `list_schemas`
|
|
234
|
-
- **Engines:** `get_engine`, `list_engines`, `get_engine_fields`
|
|
235
|
-
- **Hooks:** `get_hook`, `list_hooks`, `list_hook_templates`, `list_hook_logs`
|
|
236
|
-
- **Email Templates:** `get_email_template`, `list_email_templates`
|
|
237
|
-
- **Users:** `get_user`, `list_users`, `list_user_roles`
|
|
238
|
-
- **Rules:** `get_rule`, `list_rules`
|
|
239
|
-
- **Relations:** `get_relation`, `list_relations`
|
|
240
|
-
- **Document Relations:** `get_document_relation`, `list_document_relations`
|
|
241
|
-
- **Workspaces:** `get_workspace`, `list_workspaces`
|
|
242
|
-
|
|
243
|
-
All CREATE, UPDATE, and UPLOAD operations are disabled in read-only mode for security purposes.
|
|
244
|
-
|
|
245
|
-
## Usage
|
|
246
|
-
|
|
247
|
-
<details>
|
|
248
|
-
<summary>Running the MCP Server</summary>
|
|
249
|
-
|
|
250
|
-
Start the server using:
|
|
251
|
-
```bash
|
|
252
|
-
python server.py
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
Or using the installed script:
|
|
256
|
-
```bash
|
|
257
|
-
rossum-mcp
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
</details>
|
|
261
|
-
|
|
262
|
-
<details>
|
|
263
|
-
<summary>Claude Desktop Configuration</summary>
|
|
264
|
-
|
|
265
|
-
Configure your MCP client to use this server. In Claude Desktop's config:
|
|
266
|
-
|
|
267
|
-
**Read-write mode:**
|
|
268
|
-
```json
|
|
269
|
-
{
|
|
270
|
-
"mcpServers": {
|
|
271
|
-
"rossum": {
|
|
272
|
-
"command": "python",
|
|
273
|
-
"args": ["/path/to/rossum-mcp/rossum-mcp/rossum_mcp/server.py"],
|
|
274
|
-
"env": {
|
|
275
|
-
"ROSSUM_API_TOKEN": "your-api-token",
|
|
276
|
-
"ROSSUM_API_BASE_URL": "https://api.elis.rossum.ai/v1",
|
|
277
|
-
"ROSSUM_MCP_MODE": "read-write"
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
**Read-only mode:**
|
|
285
|
-
```json
|
|
286
|
-
{
|
|
287
|
-
"mcpServers": {
|
|
288
|
-
"rossum-readonly": {
|
|
289
|
-
"command": "python",
|
|
290
|
-
"args": ["/path/to/rossum-mcp/rossum-mcp/rossum_mcp/server.py"],
|
|
291
|
-
"env": {
|
|
292
|
-
"ROSSUM_API_TOKEN": "your-api-token",
|
|
293
|
-
"ROSSUM_API_BASE_URL": "https://api.elis.rossum.ai/v1",
|
|
294
|
-
"ROSSUM_MCP_MODE": "read-only"
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
</details>
|
|
302
|
-
|
|
303
|
-
## Available Tools
|
|
304
|
-
|
|
305
|
-
### Document Processing
|
|
306
|
-
|
|
307
|
-
#### upload_document
|
|
308
|
-
|
|
309
|
-
Uploads a document to Rossum for processing. Returns a task ID. Use `list_annotations` to get the annotation ID.
|
|
310
|
-
|
|
311
|
-
**Parameters:**
|
|
312
|
-
- `file_path` (string, required): Absolute path to the document file
|
|
313
|
-
- `queue_id` (integer, required): Rossum queue ID where the document should be uploaded
|
|
314
|
-
|
|
315
|
-
**Returns:**
|
|
316
|
-
```json
|
|
317
|
-
{
|
|
318
|
-
"task_id": "12345",
|
|
319
|
-
"task_status": "created",
|
|
320
|
-
"queue_id": 12345,
|
|
321
|
-
"message": "Document upload initiated. Use `list_annotations` to find the annotation ID for this queue."
|
|
322
|
-
}
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
#### get_annotation
|
|
326
|
-
|
|
327
|
-
Retrieves annotation data for a previously uploaded document. Use this to check the status of a document.
|
|
328
|
-
|
|
329
|
-
**Parameters:**
|
|
330
|
-
- `annotation_id` (integer, required): The annotation ID obtained from list_annotations
|
|
331
|
-
- `sideloads` (array, optional): List of sideloads to include. Use `['content']` to fetch annotation content with datapoints
|
|
332
|
-
|
|
333
|
-
**Returns:**
|
|
334
|
-
```json
|
|
335
|
-
{
|
|
336
|
-
"id": "12345",
|
|
337
|
-
"status": "to_review",
|
|
338
|
-
"url": "https://elis.rossum.ai/api/v1/annotations/12345",
|
|
339
|
-
"schema": "67890",
|
|
340
|
-
"modifier": "11111",
|
|
341
|
-
"document": "22222",
|
|
342
|
-
"content": [...],
|
|
343
|
-
"created_at": "2024-01-01T00:00:00Z",
|
|
344
|
-
"modified_at": "2024-01-01T00:00:00Z"
|
|
345
|
-
}
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
#### list_annotations
|
|
349
|
-
|
|
350
|
-
Lists all annotations for a queue with optional filtering. Useful for checking the status of multiple uploaded documents.
|
|
351
|
-
|
|
352
|
-
**Parameters:**
|
|
353
|
-
- `queue_id` (integer, required): Rossum queue ID to list annotations from
|
|
354
|
-
- `status` (string, optional): Filter by annotation status (default: 'importing,to_review,confirmed,exported')
|
|
355
|
-
|
|
356
|
-
**Returns:**
|
|
357
|
-
```json
|
|
358
|
-
{
|
|
359
|
-
"count": 42,
|
|
360
|
-
"results": [
|
|
361
|
-
{
|
|
362
|
-
"id": "12345",
|
|
363
|
-
"status": "to_review",
|
|
364
|
-
"url": "https://elis.rossum.ai/api/v1/annotations/12345",
|
|
365
|
-
"document": "67890",
|
|
366
|
-
"created_at": "2024-01-01T00:00:00Z",
|
|
367
|
-
"modified_at": "2024-01-01T00:00:00Z"
|
|
368
|
-
}
|
|
369
|
-
]
|
|
370
|
-
}
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
#### start_annotation
|
|
374
|
-
|
|
375
|
-
Starts an annotation to move it from 'importing' to 'reviewing' status. This is required before you can update annotation fields.
|
|
376
|
-
|
|
377
|
-
**Parameters:**
|
|
378
|
-
- `annotation_id` (integer, required): Rossum annotation ID to start
|
|
379
|
-
|
|
380
|
-
**Returns:**
|
|
381
|
-
```json
|
|
382
|
-
{
|
|
383
|
-
"annotation_id": 12345,
|
|
384
|
-
"message": "Annotation 12345 started successfully. Status changed to 'reviewing'."
|
|
385
|
-
}
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
#### bulk_update_annotation_fields
|
|
389
|
-
|
|
390
|
-
Bulk update annotation field values using JSON Patch operations. This is the correct way to update annotation field values. Must be called after `start_annotation`.
|
|
391
|
-
|
|
392
|
-
**Parameters:**
|
|
393
|
-
- `annotation_id` (integer, required): Rossum annotation ID to update
|
|
394
|
-
- `operations` (array, required): List of JSON Patch operations with format:
|
|
395
|
-
```json
|
|
396
|
-
[
|
|
397
|
-
{
|
|
398
|
-
"op": "replace",
|
|
399
|
-
"id": 1234,
|
|
400
|
-
"value": {
|
|
401
|
-
"content": {
|
|
402
|
-
"value": "new_value",
|
|
403
|
-
"page": 1,
|
|
404
|
-
"position": [x, y, w, h]
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
]
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
**Important:** Use the numeric datapoint `id` from `annotation.content`, NOT the `schema_id`.
|
|
412
|
-
|
|
413
|
-
**Returns:**
|
|
414
|
-
```json
|
|
415
|
-
{
|
|
416
|
-
"annotation_id": 12345,
|
|
417
|
-
"operations_count": 1,
|
|
418
|
-
"message": "Annotation 12345 updated with 1 operations successfully."
|
|
419
|
-
}
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
#### confirm_annotation
|
|
423
|
-
|
|
424
|
-
Confirms an annotation to move it to 'confirmed' status. Can be called after `bulk_update_annotation_fields`.
|
|
425
|
-
|
|
426
|
-
**Parameters:**
|
|
427
|
-
- `annotation_id` (integer, required): Rossum annotation ID to confirm
|
|
428
|
-
|
|
429
|
-
**Returns:**
|
|
430
|
-
```json
|
|
431
|
-
{
|
|
432
|
-
"annotation_id": 12345,
|
|
433
|
-
"message": "Annotation 12345 confirmed successfully. Status changed to 'confirmed'."
|
|
434
|
-
}
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
### Queue & Schema Management
|
|
438
|
-
|
|
439
|
-
#### get_queue
|
|
440
|
-
|
|
441
|
-
Retrieves queue details including the schema_id.
|
|
442
|
-
|
|
443
|
-
**Parameters:**
|
|
444
|
-
- `queue_id` (integer, required): Rossum queue ID to retrieve
|
|
445
|
-
|
|
446
|
-
#### list_queues
|
|
447
|
-
|
|
448
|
-
Lists all queues with optional filtering by workspace or name.
|
|
449
|
-
|
|
450
|
-
**Parameters:**
|
|
451
|
-
- `workspace_id` (integer, optional): Filter by workspace ID
|
|
452
|
-
- `name` (string, optional): Filter by queue name
|
|
453
|
-
|
|
454
|
-
**Returns:**
|
|
455
|
-
```json
|
|
456
|
-
[
|
|
457
|
-
{
|
|
458
|
-
"id": 12345,
|
|
459
|
-
"name": "Invoice Processing",
|
|
460
|
-
"url": "https://elis.rossum.ai/api/v1/queues/12345",
|
|
461
|
-
"workspace": "https://elis.rossum.ai/api/v1/workspaces/100",
|
|
462
|
-
"schema": "https://elis.rossum.ai/api/v1/schemas/200",
|
|
463
|
-
"inbox": "https://elis.rossum.ai/api/v1/inboxes/300",
|
|
464
|
-
"status": "active",
|
|
465
|
-
"locale": "en_GB",
|
|
466
|
-
"automation_enabled": true
|
|
467
|
-
}
|
|
468
|
-
]
|
|
469
|
-
```
|
|
470
|
-
|
|
471
|
-
**Example usage:**
|
|
472
|
-
```python
|
|
473
|
-
# List all queues
|
|
474
|
-
all_queues = list_queues()
|
|
475
|
-
|
|
476
|
-
# List queues in a specific workspace
|
|
477
|
-
workspace_queues = list_queues(workspace_id=100)
|
|
478
|
-
|
|
479
|
-
# List queues by name
|
|
480
|
-
named_queues = list_queues(name="Invoice Processing")
|
|
481
|
-
|
|
482
|
-
# Combine filters
|
|
483
|
-
filtered_queues = list_queues(workspace_id=100, name="Invoice")
|
|
484
|
-
```
|
|
485
|
-
|
|
486
|
-
#### get_schema
|
|
487
|
-
|
|
488
|
-
Retrieves schema details including the schema content/structure.
|
|
489
|
-
|
|
490
|
-
**Parameters:**
|
|
491
|
-
- `schema_id` (integer, required): Rossum schema ID to retrieve
|
|
492
|
-
|
|
493
|
-
#### list_schemas
|
|
494
|
-
|
|
495
|
-
Lists all schemas with optional filtering by name or queue.
|
|
496
|
-
|
|
497
|
-
**Parameters:**
|
|
498
|
-
- `name` (string, optional): Filter by schema name
|
|
499
|
-
- `queue_id` (integer, optional): Filter by queue ID
|
|
500
|
-
|
|
501
|
-
**Returns:**
|
|
502
|
-
```json
|
|
503
|
-
[
|
|
504
|
-
{
|
|
505
|
-
"id": 12345,
|
|
506
|
-
"name": "Invoice Schema",
|
|
507
|
-
"url": "https://elis.rossum.ai/api/v1/schemas/12345",
|
|
508
|
-
"queues": ["https://elis.rossum.ai/api/v1/queues/100"],
|
|
509
|
-
"content": "<omitted>",
|
|
510
|
-
"metadata": {},
|
|
511
|
-
"modified_at": "2025-01-15T10:00:00Z"
|
|
512
|
-
}
|
|
513
|
-
]
|
|
514
|
-
```
|
|
515
|
-
|
|
516
|
-
**Example usage:**
|
|
517
|
-
```python
|
|
518
|
-
# List all schemas
|
|
519
|
-
all_schemas = list_schemas()
|
|
520
|
-
|
|
521
|
-
# List schemas by name
|
|
522
|
-
named_schemas = list_schemas(name="Invoice Schema")
|
|
523
|
-
|
|
524
|
-
# List schemas used by a specific queue
|
|
525
|
-
queue_schemas = list_schemas(queue_id=100)
|
|
526
|
-
|
|
527
|
-
# Combine filters
|
|
528
|
-
filtered_schemas = list_schemas(name="Invoice", queue_id=100)
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
#### get_queue_schema
|
|
532
|
-
|
|
533
|
-
Retrieves the complete schema for a queue in a single call. This is the recommended way to get a queue's schema.
|
|
534
|
-
|
|
535
|
-
**Parameters:**
|
|
536
|
-
- `queue_id` (integer, required): Rossum queue ID
|
|
537
|
-
|
|
538
|
-
#### get_queue_engine
|
|
539
|
-
|
|
540
|
-
Retrieves the complete engine information for a given queue in a single call.
|
|
541
|
-
|
|
542
|
-
**Parameters:**
|
|
543
|
-
- `queue_id` (integer, required): Rossum queue ID
|
|
544
|
-
|
|
545
|
-
#### create_queue
|
|
546
|
-
|
|
547
|
-
Creates a new queue with schema and optional engine assignment.
|
|
548
|
-
|
|
549
|
-
**Parameters:**
|
|
550
|
-
- `name` (string, required): Name of the queue to create
|
|
551
|
-
- `workspace_id` (integer, required): Workspace ID where the queue should be created
|
|
552
|
-
- `schema_id` (integer, required): Schema ID to assign to the queue
|
|
553
|
-
- `engine_id` (integer, optional): Optional engine ID to assign for document processing
|
|
554
|
-
- Additional optional parameters for automation, locale, training, etc.
|
|
555
|
-
|
|
556
|
-
#### update_queue
|
|
557
|
-
|
|
558
|
-
Updates an existing queue's settings including automation thresholds.
|
|
559
|
-
|
|
560
|
-
**Parameters:**
|
|
561
|
-
- `queue_id` (integer, required): Queue ID to update
|
|
562
|
-
- `queue_data` (object, required): Dictionary containing queue fields to update
|
|
563
|
-
|
|
564
|
-
#### create_schema
|
|
565
|
-
|
|
566
|
-
Creates a new schema with sections and datapoints.
|
|
567
|
-
|
|
568
|
-
**Parameters:**
|
|
569
|
-
- `name` (string, required): Schema name
|
|
570
|
-
- `content` (array, required): Schema content array containing sections with datapoints. Must follow Rossum schema structure with sections containing children.
|
|
571
|
-
|
|
572
|
-
**Example content structure:**
|
|
573
|
-
```json
|
|
574
|
-
[
|
|
575
|
-
{
|
|
576
|
-
"category": "section",
|
|
577
|
-
"id": "document_info",
|
|
578
|
-
"label": "Document Information",
|
|
579
|
-
"children": [
|
|
580
|
-
{
|
|
581
|
-
"category": "datapoint",
|
|
582
|
-
"id": "document_type",
|
|
583
|
-
"label": "Document Type",
|
|
584
|
-
"type": "enum",
|
|
585
|
-
"rir_field_names": [],
|
|
586
|
-
"constraints": {"required": false},
|
|
587
|
-
"options": [
|
|
588
|
-
{"value": "invoice", "label": "Invoice"},
|
|
589
|
-
{"value": "receipt", "label": "Receipt"}
|
|
590
|
-
]
|
|
591
|
-
}
|
|
592
|
-
]
|
|
593
|
-
}
|
|
594
|
-
]
|
|
595
|
-
```
|
|
596
|
-
|
|
597
|
-
**Returns:**
|
|
598
|
-
```json
|
|
599
|
-
{
|
|
600
|
-
"id": 12345,
|
|
601
|
-
"name": "My Schema",
|
|
602
|
-
"url": "https://elis.rossum.ai/api/v1/schemas/12345",
|
|
603
|
-
"content": [...],
|
|
604
|
-
"message": "Schema 'My Schema' created successfully with ID 12345"
|
|
605
|
-
}
|
|
606
|
-
```
|
|
607
|
-
|
|
608
|
-
#### update_schema
|
|
609
|
-
|
|
610
|
-
Updates an existing schema, typically used to set field-level automation thresholds.
|
|
611
|
-
|
|
612
|
-
**Parameters:**
|
|
613
|
-
- `schema_id` (integer, required): Schema ID to update
|
|
614
|
-
- `schema_data` (object, required): Dictionary containing schema fields to update
|
|
615
|
-
|
|
616
|
-
#### patch_schema
|
|
617
|
-
|
|
618
|
-
Patch a schema by adding, updating, or removing individual nodes without replacing the entire content. This is particularly useful for making incremental changes to schemas.
|
|
619
|
-
|
|
620
|
-
**Parameters:**
|
|
621
|
-
- `schema_id` (integer, required): Schema ID to patch
|
|
622
|
-
- `operation` (string, required): One of "add", "update", or "remove"
|
|
623
|
-
- `node_id` (string, required): ID of the node to operate on
|
|
624
|
-
- `node_data` (object, optional): Data for add/update operations. Required for "add" and "update"
|
|
625
|
-
- `parent_id` (string, optional): Parent node ID for add operation. Required for "add"
|
|
626
|
-
- `position` (integer, optional): Position for add operation (appends if not specified)
|
|
627
|
-
|
|
628
|
-
**Operations:**
|
|
629
|
-
- **add**: Add a new datapoint/multivalue to a parent (section or tuple). Requires `parent_id` and `node_data`.
|
|
630
|
-
- **update**: Update properties of an existing node. Requires `node_data` with fields to update.
|
|
631
|
-
- **remove**: Remove a node from the schema. Only `node_id` is required.
|
|
632
|
-
|
|
633
|
-
**Returns:**
|
|
634
|
-
```json
|
|
635
|
-
{
|
|
636
|
-
"id": 123,
|
|
637
|
-
"name": "Invoice Schema",
|
|
638
|
-
"content": [
|
|
639
|
-
{
|
|
640
|
-
"id": "header_section",
|
|
641
|
-
"label": "Header",
|
|
642
|
-
"category": "section",
|
|
643
|
-
"children": [
|
|
644
|
-
{"id": "invoice_number", "label": "Invoice Number", "category": "datapoint"},
|
|
645
|
-
{"id": "vendor_name", "label": "Vendor Name", "category": "datapoint"}
|
|
646
|
-
]
|
|
647
|
-
}
|
|
648
|
-
]
|
|
649
|
-
}
|
|
650
|
-
```
|
|
651
|
-
|
|
652
|
-
**Example usage:**
|
|
653
|
-
```python
|
|
654
|
-
# Add a new datapoint to a section
|
|
655
|
-
patch_schema(
|
|
656
|
-
schema_id=123,
|
|
657
|
-
operation="add",
|
|
658
|
-
node_id="vendor_name",
|
|
659
|
-
parent_id="header_section",
|
|
660
|
-
node_data={"label": "Vendor Name", "type": "string", "category": "datapoint"}
|
|
661
|
-
)
|
|
662
|
-
|
|
663
|
-
# Update a field's label and threshold
|
|
664
|
-
patch_schema(
|
|
665
|
-
schema_id=123,
|
|
666
|
-
operation="update",
|
|
667
|
-
node_id="invoice_number",
|
|
668
|
-
node_data={"label": "Invoice #", "score_threshold": 0.9}
|
|
669
|
-
)
|
|
670
|
-
|
|
671
|
-
# Remove a field
|
|
672
|
-
patch_schema(
|
|
673
|
-
schema_id=123,
|
|
674
|
-
operation="remove",
|
|
675
|
-
node_id="old_field"
|
|
676
|
-
)
|
|
677
|
-
```
|
|
678
|
-
|
|
679
|
-
### Engine Management
|
|
680
|
-
|
|
681
|
-
#### get_engine
|
|
682
|
-
|
|
683
|
-
Retrieves detailed information about a specific engine by its ID.
|
|
684
|
-
|
|
685
|
-
**Parameters:**
|
|
686
|
-
- `engine_id` (integer, required): Engine ID to retrieve
|
|
687
|
-
|
|
688
|
-
**Returns:**
|
|
689
|
-
```json
|
|
690
|
-
{
|
|
691
|
-
"id": 12345,
|
|
692
|
-
"name": "Invoice Extractor",
|
|
693
|
-
"url": "https://elis.rossum.ai/api/v1/engines/12345",
|
|
694
|
-
"type": "extractor",
|
|
695
|
-
"learning_enabled": true,
|
|
696
|
-
"training_queues": ["https://elis.rossum.ai/api/v1/queues/100", "https://elis.rossum.ai/api/v1/queues/200"],
|
|
697
|
-
"description": "Extracts invoice data",
|
|
698
|
-
"agenda_id": "agenda-123",
|
|
699
|
-
"organization": "https://elis.rossum.ai/api/v1/organizations/10",
|
|
700
|
-
"message": "Engine 'Invoice Extractor' (ID 12345) retrieved successfully"
|
|
701
|
-
}
|
|
702
|
-
```
|
|
703
|
-
|
|
704
|
-
**Example usage:**
|
|
705
|
-
```python
|
|
706
|
-
# Get engine details
|
|
707
|
-
engine = get_engine(engine_id=12345)
|
|
708
|
-
```
|
|
709
|
-
|
|
710
|
-
#### list_engines
|
|
711
|
-
|
|
712
|
-
Lists all engines with optional filtering.
|
|
713
|
-
|
|
714
|
-
**Parameters:**
|
|
715
|
-
- `id` (integer, optional): Filter by engine ID
|
|
716
|
-
- `engine_type` (string, optional): Filter by engine type ('extractor' or 'splitter')
|
|
717
|
-
- `agenda_id` (string, optional): Filter by agenda ID
|
|
718
|
-
|
|
719
|
-
**Returns:**
|
|
720
|
-
```json
|
|
721
|
-
{
|
|
722
|
-
"count": 2,
|
|
723
|
-
"results": [
|
|
724
|
-
{
|
|
725
|
-
"id": 12345,
|
|
726
|
-
"name": "My Engine",
|
|
727
|
-
"url": "https://elis.rossum.ai/api/v1/engines/12345",
|
|
728
|
-
"type": "extractor",
|
|
729
|
-
"learning_enabled": true,
|
|
730
|
-
"training_queues": ["https://elis.rossum.ai/api/v1/queues/100"],
|
|
731
|
-
"description": "Engine description",
|
|
732
|
-
"agenda_id": "abc123",
|
|
733
|
-
"organization": "https://elis.rossum.ai/api/v1/organizations/123"
|
|
734
|
-
}
|
|
735
|
-
],
|
|
736
|
-
"message": "Retrieved 2 engine(s)"
|
|
737
|
-
}
|
|
738
|
-
```
|
|
739
|
-
|
|
740
|
-
**Example usage:**
|
|
741
|
-
```python
|
|
742
|
-
# List all engines
|
|
743
|
-
all_engines = list_engines()
|
|
744
|
-
|
|
745
|
-
# List specific engine by ID
|
|
746
|
-
engine = list_engines(id=12345)
|
|
747
|
-
|
|
748
|
-
# List extractors only
|
|
749
|
-
extractors = list_engines(engine_type="extractor")
|
|
750
|
-
|
|
751
|
-
# List engines by agenda
|
|
752
|
-
agenda_engines = list_engines(agenda_id="abc123")
|
|
753
|
-
```
|
|
754
|
-
|
|
755
|
-
#### create_engine
|
|
756
|
-
|
|
757
|
-
Creates a new engine for document processing.
|
|
758
|
-
|
|
759
|
-
**Parameters:**
|
|
760
|
-
- `name` (string, required): Engine name
|
|
761
|
-
- `organization_id` (integer, required): Organization ID where the engine should be created
|
|
762
|
-
- `engine_type` (string, required): Engine type - either 'extractor' or 'splitter'
|
|
763
|
-
|
|
764
|
-
**Returns:**
|
|
765
|
-
```json
|
|
766
|
-
{
|
|
767
|
-
"id": 12345,
|
|
768
|
-
"name": "My Engine",
|
|
769
|
-
"url": "https://elis.rossum.ai/api/v1/engines/12345",
|
|
770
|
-
"type": "extractor",
|
|
771
|
-
"organization": "https://elis.rossum.ai/api/v1/organizations/123",
|
|
772
|
-
"message": "Engine 'My Engine' created successfully with ID 12345"
|
|
773
|
-
}
|
|
774
|
-
```
|
|
775
|
-
|
|
776
|
-
#### update_engine
|
|
777
|
-
|
|
778
|
-
Updates an existing engine's settings including learning and training queues.
|
|
779
|
-
|
|
780
|
-
**Parameters:**
|
|
781
|
-
- `engine_id` (integer, required): Engine ID to update
|
|
782
|
-
- `engine_data` (object, required): Dictionary containing engine fields to update
|
|
783
|
-
- `name` (string): Engine name
|
|
784
|
-
- `description` (string): Engine description
|
|
785
|
-
- `learning_enabled` (boolean): Enable/disable learning
|
|
786
|
-
- `training_queues` (array): List of queue URLs for training
|
|
787
|
-
|
|
788
|
-
**Example:**
|
|
789
|
-
```json
|
|
790
|
-
{
|
|
791
|
-
"learning_enabled": true,
|
|
792
|
-
"training_queues": [
|
|
793
|
-
"https://elis.rossum.ai/api/v1/queues/12345",
|
|
794
|
-
"https://elis.rossum.ai/api/v1/queues/67890"
|
|
795
|
-
]
|
|
796
|
-
}
|
|
797
|
-
```
|
|
798
|
-
|
|
799
|
-
**Returns:**
|
|
800
|
-
```json
|
|
801
|
-
{
|
|
802
|
-
"id": 12345,
|
|
803
|
-
"name": "My Engine",
|
|
804
|
-
"url": "https://elis.rossum.ai/api/v1/engines/12345",
|
|
805
|
-
"type": "extractor",
|
|
806
|
-
"learning_enabled": true,
|
|
807
|
-
"training_queues": [...],
|
|
808
|
-
"description": "Engine description",
|
|
809
|
-
"message": "Engine 'My Engine' (ID 12345) updated successfully"
|
|
810
|
-
}
|
|
811
|
-
```
|
|
812
|
-
|
|
813
|
-
#### get_hook
|
|
814
|
-
|
|
815
|
-
Retrieves details of a specific hook/extension by its ID.
|
|
816
|
-
|
|
817
|
-
**Parameters:**
|
|
818
|
-
- `hook_id` (integer, required): Hook ID
|
|
819
|
-
|
|
820
|
-
**Returns:**
|
|
821
|
-
```json
|
|
822
|
-
{
|
|
823
|
-
"id": 12345,
|
|
824
|
-
"name": "Validation Hook",
|
|
825
|
-
"url": "https://elis.rossum.ai/api/v1/hooks/12345",
|
|
826
|
-
"type": "webhook",
|
|
827
|
-
"active": true,
|
|
828
|
-
"queues": ["https://elis.rossum.ai/api/v1/queues/100"],
|
|
829
|
-
"events": ["annotation_status", "annotation_content"],
|
|
830
|
-
"config": {
|
|
831
|
-
"url": "https://example.com/webhook",
|
|
832
|
-
"secret": "***"
|
|
833
|
-
},
|
|
834
|
-
"settings": {},
|
|
835
|
-
"extension_source": "rossum_store"
|
|
836
|
-
}
|
|
837
|
-
```
|
|
838
|
-
|
|
839
|
-
**Example usage:**
|
|
840
|
-
```python
|
|
841
|
-
# Get hook details
|
|
842
|
-
hook = get_hook(hook_id=12345)
|
|
843
|
-
```
|
|
844
|
-
|
|
845
|
-
#### list_hooks
|
|
846
|
-
|
|
847
|
-
Lists all hooks/extensions configured in your organization. Hooks (also called extensions) are webhooks or serverless functions that respond to Rossum events.
|
|
848
|
-
|
|
849
|
-
**Parameters:**
|
|
850
|
-
- `queue_id` (integer, optional): Filter hooks by queue ID
|
|
851
|
-
- `active` (boolean, optional): Filter by active status (true for active hooks, false for inactive)
|
|
852
|
-
|
|
853
|
-
**Returns:**
|
|
854
|
-
```json
|
|
855
|
-
{
|
|
856
|
-
"count": 2,
|
|
857
|
-
"results": [
|
|
858
|
-
{
|
|
859
|
-
"id": 12345,
|
|
860
|
-
"name": "Validation Hook",
|
|
861
|
-
"url": "https://elis.rossum.ai/api/v1/hooks/12345",
|
|
862
|
-
"type": "webhook",
|
|
863
|
-
"active": true,
|
|
864
|
-
"queues": ["https://elis.rossum.ai/api/v1/queues/100"],
|
|
865
|
-
"events": ["annotation_status", "annotation_content"],
|
|
866
|
-
"config": {
|
|
867
|
-
"url": "https://example.com/webhook",
|
|
868
|
-
"secret": "***"
|
|
869
|
-
},
|
|
870
|
-
"extension_source": "rossum_store"
|
|
871
|
-
}
|
|
872
|
-
]
|
|
873
|
-
}
|
|
874
|
-
```
|
|
875
|
-
|
|
876
|
-
**Example usage:**
|
|
877
|
-
```python
|
|
878
|
-
# List all hooks
|
|
879
|
-
all_hooks = list_hooks()
|
|
880
|
-
|
|
881
|
-
# List hooks for a specific queue
|
|
882
|
-
queue_hooks = list_hooks(queue_id=12345)
|
|
883
|
-
|
|
884
|
-
# List only active hooks
|
|
885
|
-
active_hooks = list_hooks(active=True)
|
|
886
|
-
|
|
887
|
-
# List inactive hooks for a queue
|
|
888
|
-
inactive_queue_hooks = list_hooks(queue_id=12345, active=False)
|
|
889
|
-
```
|
|
890
|
-
|
|
891
|
-
#### create_hook
|
|
892
|
-
|
|
893
|
-
Creates a new hook (webhook or serverless function). Hooks respond to Rossum events and can be used for custom validation, data enrichment, or integration with external systems.
|
|
894
|
-
|
|
895
|
-
**Parameters:**
|
|
896
|
-
- `name` (string, required): Hook name
|
|
897
|
-
- `type` (string, required): Hook type - either 'webhook' or 'function'
|
|
898
|
-
- `queues` (array, optional): List of queue URLs to attach the hook to. If not provided, hook applies to all queues
|
|
899
|
-
- Format: `["https://api.elis.rossum.ai/v1/queues/12345"]`
|
|
900
|
-
- `events` (array, optional): List of events that trigger the hook. Common events:
|
|
901
|
-
- `annotation_content.initialize` - When annotation is first created
|
|
902
|
-
- `annotation_content.confirm` - When annotation is confirmed
|
|
903
|
-
- `annotation_content.export` - When annotation is exported
|
|
904
|
-
- `annotation_status` - When annotation status changes
|
|
905
|
-
- `annotation_content` - When annotation content changes
|
|
906
|
-
- `datapoint_value` - When individual field value changes
|
|
907
|
-
- `config` (object, optional): Hook configuration
|
|
908
|
-
- For webhook: `{"url": "https://example.com/webhook"}`
|
|
909
|
-
- For function: `{"runtime": "python3.12", "function": "import json\ndef rossum_hook_request_handler(payload):\n return {}"}`
|
|
910
|
-
- `settings` (object, optional): Specific settings included in the payload when executing the hook
|
|
911
|
-
- `secret` (string, optional): Secret key for securing webhook requests
|
|
912
|
-
|
|
913
|
-
**Returns:**
|
|
914
|
-
```json
|
|
915
|
-
{
|
|
916
|
-
"id": 12345,
|
|
917
|
-
"name": "My Hook",
|
|
918
|
-
"url": "https://elis.rossum.ai/api/v1/hooks/12345",
|
|
919
|
-
"enabled": true,
|
|
920
|
-
"queues": ["https://elis.rossum.ai/api/v1/queues/100"],
|
|
921
|
-
"events": ["annotation_content.initialize"],
|
|
922
|
-
"config": {"runtime": "python3.12", "function": "..."},
|
|
923
|
-
"settings": {"custom_key": "custom_value"},
|
|
924
|
-
"message": "Hook 'My Hook' created successfully with ID 12345"
|
|
925
|
-
}
|
|
926
|
-
```
|
|
927
|
-
|
|
928
|
-
**Example usage:**
|
|
929
|
-
```python
|
|
930
|
-
# Create a serverless function hook
|
|
931
|
-
create_hook(
|
|
932
|
-
name="Splitting & Sorting",
|
|
933
|
-
type="function",
|
|
934
|
-
queues=["https://api.elis.rossum.ai/v1/queues/12345"],
|
|
935
|
-
events=["annotation_content.initialize", "annotation_content.confirm"],
|
|
936
|
-
config={"runtime": "python3.12", "function": "import json\ndef rossum_hook_request_handler(payload):\n return {}"},
|
|
937
|
-
settings={"sorting_queues": {"A": 1, "B": 2}}
|
|
938
|
-
)
|
|
939
|
-
|
|
940
|
-
# Create a webhook hook
|
|
941
|
-
create_hook(
|
|
942
|
-
name="External Validation",
|
|
943
|
-
type="webhook",
|
|
944
|
-
queues=["https://api.elis.rossum.ai/v1/queues/12345"],
|
|
945
|
-
events=["annotation_content.confirm"],
|
|
946
|
-
config={"url": "https://example.com/validate"},
|
|
947
|
-
secret="webhook_secret_123"
|
|
948
|
-
)
|
|
949
|
-
```
|
|
950
|
-
|
|
951
|
-
#### update_hook
|
|
952
|
-
|
|
953
|
-
Updates an existing hook. Use this to modify hook properties like name, queues, config, events, or settings. Only provide the fields you want to change - other fields will remain unchanged.
|
|
954
|
-
|
|
955
|
-
**Parameters:**
|
|
956
|
-
- `hook_id` (integer, required): The ID of the hook to update
|
|
957
|
-
- `name` (string, optional): New hook name
|
|
958
|
-
- `queues` (array, optional): New list of queue URLs
|
|
959
|
-
- `events` (array, optional): New list of events that trigger the hook
|
|
960
|
-
- `config` (object, optional): New hook configuration
|
|
961
|
-
- `settings` (object, optional): New hook settings
|
|
962
|
-
- `active` (boolean, optional): Enable or disable the hook
|
|
963
|
-
|
|
964
|
-
**Returns:**
|
|
965
|
-
```json
|
|
966
|
-
{
|
|
967
|
-
"id": 12345,
|
|
968
|
-
"name": "Updated Hook Name",
|
|
969
|
-
"url": "https://elis.rossum.ai/api/v1/hooks/12345",
|
|
970
|
-
"active": true,
|
|
971
|
-
"queues": ["https://elis.rossum.ai/api/v1/queues/100"],
|
|
972
|
-
"events": ["annotation_content.initialize", "annotation_content.confirm"],
|
|
973
|
-
"config": {"runtime": "python3.12", "function": "..."},
|
|
974
|
-
"settings": {"updated_key": "updated_value"}
|
|
975
|
-
}
|
|
976
|
-
```
|
|
977
|
-
|
|
978
|
-
**Example usage:**
|
|
979
|
-
```python
|
|
980
|
-
# Update hook name and add a new event
|
|
981
|
-
update_hook(
|
|
982
|
-
hook_id=12345,
|
|
983
|
-
name="Renamed Hook",
|
|
984
|
-
events=["annotation_content.initialize", "annotation_content.confirm"]
|
|
985
|
-
)
|
|
986
|
-
|
|
987
|
-
# Disable a hook
|
|
988
|
-
update_hook(hook_id=12345, active=False)
|
|
989
|
-
|
|
990
|
-
# Update hook settings
|
|
991
|
-
update_hook(hook_id=12345, settings={"new_setting": "value"})
|
|
992
|
-
```
|
|
993
|
-
|
|
994
|
-
#### list_hook_templates
|
|
995
|
-
|
|
996
|
-
Lists available hook templates from Rossum Store. Hook templates provide pre-built extension configurations (e.g., data validation, field mapping, notifications) that can be used to quickly create hooks instead of writing code from scratch.
|
|
997
|
-
|
|
998
|
-
**Parameters:**
|
|
999
|
-
None
|
|
1000
|
-
|
|
1001
|
-
**Returns:**
|
|
1002
|
-
```json
|
|
1003
|
-
[
|
|
1004
|
-
{
|
|
1005
|
-
"id": 5,
|
|
1006
|
-
"url": "https://elis.rossum.ai/api/v1/hook_templates/5",
|
|
1007
|
-
"name": "Document Splitting",
|
|
1008
|
-
"description": "Automatically split multi-page documents into separate annotations",
|
|
1009
|
-
"type": "function",
|
|
1010
|
-
"events": ["annotation_content.initialize"],
|
|
1011
|
-
"config": {"runtime": "python3.12", "function": "..."},
|
|
1012
|
-
"settings_schema": {"type": "object", "properties": {...}},
|
|
1013
|
-
"guide": "https://knowledge-base.rossum.ai/docs/..."
|
|
1014
|
-
}
|
|
1015
|
-
]
|
|
1016
|
-
```
|
|
1017
|
-
|
|
1018
|
-
**Example usage:**
|
|
1019
|
-
```python
|
|
1020
|
-
# List all available hook templates
|
|
1021
|
-
templates = list_hook_templates()
|
|
1022
|
-
|
|
1023
|
-
# Find a template by name
|
|
1024
|
-
for template in templates:
|
|
1025
|
-
if "splitting" in template.name.lower():
|
|
1026
|
-
print(f"Found: {template.name} (ID: {template.id})")
|
|
1027
|
-
```
|
|
1028
|
-
|
|
1029
|
-
#### create_hook_from_template
|
|
1030
|
-
|
|
1031
|
-
Creates a hook from a Rossum Store template. Use `list_hook_templates` first to find available templates and their IDs. This is the recommended way to create hooks as it uses battle-tested configurations from the Rossum Store.
|
|
1032
|
-
|
|
1033
|
-
**Parameters:**
|
|
1034
|
-
- `name` (string, required): Name for the new hook
|
|
1035
|
-
- `hook_template_id` (integer, required): ID of the hook template to use (from `list_hook_templates`)
|
|
1036
|
-
- `queues` (array, required): List of queue URLs to attach the hook to
|
|
1037
|
-
- `events` (array, optional): List of events to trigger the hook (overrides template defaults if provided)
|
|
1038
|
-
- `token_owner` (string, optional): User URL for token ownership. Required when the hook template has `use_token_owner=True`. Use `list_users` to find the user URL by username.
|
|
1039
|
-
|
|
1040
|
-
**Important:** If the hook template has `use_token_owner=True`, you must provide the `token_owner` parameter with a valid user URL. Ask the user for their username and use `list_users` to find the correct user URL.
|
|
1041
|
-
|
|
1042
|
-
**Returns:**
|
|
1043
|
-
```json
|
|
1044
|
-
{
|
|
1045
|
-
"id": 12345,
|
|
1046
|
-
"name": "My Document Splitting Hook",
|
|
1047
|
-
"url": "https://elis.rossum.ai/api/v1/hooks/12345",
|
|
1048
|
-
"hook_template": "https://elis.rossum.ai/api/v1/hook_templates/5",
|
|
1049
|
-
"type": "function",
|
|
1050
|
-
"queues": ["https://elis.rossum.ai/api/v1/queues/100"],
|
|
1051
|
-
"events": ["annotation_content.initialize"],
|
|
1052
|
-
"config": {...},
|
|
1053
|
-
"settings": {...}
|
|
1054
|
-
}
|
|
1055
|
-
```
|
|
1056
|
-
|
|
1057
|
-
**Example usage:**
|
|
1058
|
-
```python
|
|
1059
|
-
# Create a hook from template
|
|
1060
|
-
create_hook_from_template(
|
|
1061
|
-
name="Invoice Splitting",
|
|
1062
|
-
hook_template_id=5,
|
|
1063
|
-
queues=["https://api.elis.rossum.ai/v1/queues/12345"],
|
|
1064
|
-
settings={"split_by": "barcode", "target_queue": 67890}
|
|
1065
|
-
)
|
|
1066
|
-
|
|
1067
|
-
# Create a hook with token_owner (for templates with use_token_owner=True)
|
|
1068
|
-
create_hook_from_template(
|
|
1069
|
-
name="Data Export Hook",
|
|
1070
|
-
hook_template_id=17,
|
|
1071
|
-
queues=["https://api.elis.rossum.ai/v1/queues/12345"],
|
|
1072
|
-
token_owner="https://api.elis.rossum.ai/v1/users/456"
|
|
1073
|
-
)
|
|
1074
|
-
```
|
|
1075
|
-
|
|
1076
|
-
#### list_hook_logs
|
|
1077
|
-
|
|
1078
|
-
Lists hook execution logs for debugging, monitoring performance, and troubleshooting errors. Logs are retained for 7 days and at most 100 logs are returned per call.
|
|
1079
|
-
|
|
1080
|
-
**Parameters:**
|
|
1081
|
-
- `hook_id` (integer, optional): Filter by hook ID
|
|
1082
|
-
- `queue_id` (integer, optional): Filter by queue ID
|
|
1083
|
-
- `annotation_id` (integer, optional): Filter by annotation ID
|
|
1084
|
-
- `email_id` (integer, optional): Filter by email ID
|
|
1085
|
-
- `log_level` (string, optional): Filter by log level - 'INFO', 'ERROR', or 'WARNING'
|
|
1086
|
-
- `status` (string, optional): Filter by execution status
|
|
1087
|
-
- `status_code` (integer, optional): Filter by HTTP status code
|
|
1088
|
-
- `request_id` (string, optional): Filter by request ID
|
|
1089
|
-
- `timestamp_before` (string, optional): ISO 8601 timestamp, filter logs triggered before this time
|
|
1090
|
-
- `timestamp_after` (string, optional): ISO 8601 timestamp, filter logs triggered after this time
|
|
1091
|
-
- `start_before` (string, optional): ISO 8601 timestamp, filter logs started before this time
|
|
1092
|
-
- `start_after` (string, optional): ISO 8601 timestamp, filter logs started after this time
|
|
1093
|
-
- `end_before` (string, optional): ISO 8601 timestamp, filter logs ended before this time
|
|
1094
|
-
- `end_after` (string, optional): ISO 8601 timestamp, filter logs ended after this time
|
|
1095
|
-
- `search` (string, optional): Full-text search across log messages
|
|
1096
|
-
- `page_size` (integer, optional): Number of results per page (default 100, max 100)
|
|
1097
|
-
|
|
1098
|
-
**Returns:**
|
|
1099
|
-
```json
|
|
1100
|
-
{
|
|
1101
|
-
"count": 2,
|
|
1102
|
-
"results": [
|
|
1103
|
-
{
|
|
1104
|
-
"log_level": "INFO",
|
|
1105
|
-
"action": "initialize",
|
|
1106
|
-
"event": "annotation_content",
|
|
1107
|
-
"request_id": "abc123",
|
|
1108
|
-
"organization_id": 100,
|
|
1109
|
-
"hook_id": 12345,
|
|
1110
|
-
"hook_type": "function",
|
|
1111
|
-
"queue_id": 200,
|
|
1112
|
-
"annotation_id": 300,
|
|
1113
|
-
"message": "Hook executed successfully",
|
|
1114
|
-
"start": "2024-01-01T00:00:00Z",
|
|
1115
|
-
"end": "2024-01-01T00:00:01Z",
|
|
1116
|
-
"status": "success",
|
|
1117
|
-
"status_code": 200,
|
|
1118
|
-
"timestamp": "2024-01-01T00:00:00Z",
|
|
1119
|
-
"uuid": "uuid-here"
|
|
1120
|
-
}
|
|
1121
|
-
]
|
|
1122
|
-
}
|
|
1123
|
-
```
|
|
1124
|
-
|
|
1125
|
-
**Example usage:**
|
|
1126
|
-
```python
|
|
1127
|
-
# List all logs for a specific hook
|
|
1128
|
-
logs = list_hook_logs(hook_id=12345)
|
|
1129
|
-
|
|
1130
|
-
# List error logs only
|
|
1131
|
-
error_logs = list_hook_logs(log_level="ERROR")
|
|
1132
|
-
|
|
1133
|
-
# List logs for a specific annotation
|
|
1134
|
-
annotation_logs = list_hook_logs(annotation_id=300)
|
|
1135
|
-
|
|
1136
|
-
# Search logs by message content
|
|
1137
|
-
search_logs = list_hook_logs(search="validation failed")
|
|
1138
|
-
|
|
1139
|
-
# List logs from the last hour
|
|
1140
|
-
from datetime import datetime, timedelta
|
|
1141
|
-
one_hour_ago = (datetime.utcnow() - timedelta(hours=1)).isoformat() + "Z"
|
|
1142
|
-
recent_logs = list_hook_logs(timestamp_after=one_hour_ago)
|
|
1143
|
-
```
|
|
1144
|
-
|
|
1145
|
-
#### create_engine_field
|
|
1146
|
-
|
|
1147
|
-
Creates a new engine field and links it to schemas. Engine fields define what data the engine extracts and must be created for each field in the schema when setting up an engine.
|
|
1148
|
-
|
|
1149
|
-
**Parameters:**
|
|
1150
|
-
- `engine_id` (integer, required): Engine ID to which this field belongs
|
|
1151
|
-
- `name` (string, required): Field name (slug format, max 50 chars)
|
|
1152
|
-
- `label` (string, required): Human-readable label (max 100 chars)
|
|
1153
|
-
- `field_type` (string, required): Field type - 'string', 'number', 'date', or 'enum'
|
|
1154
|
-
- `schema_ids` (array, required): List of schema IDs to link this engine field to (at least one required)
|
|
1155
|
-
- `tabular` (boolean, optional): Whether this field is in a table (default: false)
|
|
1156
|
-
- `multiline` (string, optional): Multiline setting - 'true', 'false', or '' (default: 'false')
|
|
1157
|
-
- `subtype` (string, optional): Optional field subtype (max 50 chars)
|
|
1158
|
-
- `pre_trained_field_id` (string, optional): Optional pre-trained field ID (max 50 chars)
|
|
1159
|
-
|
|
1160
|
-
**Returns:**
|
|
1161
|
-
```json
|
|
1162
|
-
{
|
|
1163
|
-
"id": 12345,
|
|
1164
|
-
"name": "invoice_number",
|
|
1165
|
-
"label": "Invoice Number",
|
|
1166
|
-
"url": "https://elis.rossum.ai/api/v1/engine_fields/12345",
|
|
1167
|
-
"type": "string",
|
|
1168
|
-
"engine": "https://elis.rossum.ai/api/v1/engines/123",
|
|
1169
|
-
"tabular": false,
|
|
1170
|
-
"multiline": "false",
|
|
1171
|
-
"schema_ids": [456, 789],
|
|
1172
|
-
"message": "Engine field 'Invoice Number' created successfully with ID 12345 and linked to 2 schema(s)"
|
|
1173
|
-
}
|
|
1174
|
-
```
|
|
1175
|
-
|
|
1176
|
-
#### get_engine_fields
|
|
1177
|
-
|
|
1178
|
-
Retrieves engine fields for a specific engine or all engine fields.
|
|
1179
|
-
|
|
1180
|
-
**Parameters:**
|
|
1181
|
-
- `engine_id` (integer, optional): Engine ID to filter fields by. If not provided, retrieves all engine fields.
|
|
1182
|
-
|
|
1183
|
-
**Returns:**
|
|
1184
|
-
```json
|
|
1185
|
-
{
|
|
1186
|
-
"count": 2,
|
|
1187
|
-
"results": [
|
|
1188
|
-
{
|
|
1189
|
-
"id": 12345,
|
|
1190
|
-
"url": "https://elis.rossum.ai/api/v1/engine_fields/12345",
|
|
1191
|
-
"engine": "https://elis.rossum.ai/api/v1/engines/123",
|
|
1192
|
-
"name": "invoice_number",
|
|
1193
|
-
"label": "Invoice Number",
|
|
1194
|
-
"type": "string",
|
|
1195
|
-
"subtype": null,
|
|
1196
|
-
"tabular": false,
|
|
1197
|
-
"multiline": "false",
|
|
1198
|
-
"pre_trained_field_id": null,
|
|
1199
|
-
"schemas": ["https://elis.rossum.ai/api/v1/schemas/456"]
|
|
1200
|
-
},
|
|
1201
|
-
{
|
|
1202
|
-
"id": 12346,
|
|
1203
|
-
"url": "https://elis.rossum.ai/api/v1/engine_fields/12346",
|
|
1204
|
-
"engine": "https://elis.rossum.ai/api/v1/engines/123",
|
|
1205
|
-
"name": "invoice_date",
|
|
1206
|
-
"label": "Invoice Date",
|
|
1207
|
-
"type": "date",
|
|
1208
|
-
"subtype": null,
|
|
1209
|
-
"tabular": false,
|
|
1210
|
-
"multiline": "false",
|
|
1211
|
-
"pre_trained_field_id": null,
|
|
1212
|
-
"schemas": ["https://elis.rossum.ai/api/v1/schemas/456"]
|
|
1213
|
-
}
|
|
1214
|
-
]
|
|
1215
|
-
}
|
|
1216
|
-
```
|
|
1217
|
-
|
|
1218
|
-
**Example usage:**
|
|
1219
|
-
```python
|
|
1220
|
-
# Get all engine fields for a specific engine
|
|
1221
|
-
engine_fields = get_engine_fields(engine_id=123)
|
|
1222
|
-
|
|
1223
|
-
# Get all engine fields
|
|
1224
|
-
all_fields = get_engine_fields()
|
|
1225
|
-
```
|
|
1226
|
-
|
|
1227
|
-
### User Management
|
|
1228
|
-
|
|
1229
|
-
#### get_user
|
|
1230
|
-
|
|
1231
|
-
Retrieves a single user by ID. Use `list_users` first to find users by username or email.
|
|
1232
|
-
|
|
1233
|
-
**Parameters:**
|
|
1234
|
-
- `user_id` (integer, required): The user ID to retrieve
|
|
1235
|
-
|
|
1236
|
-
**Returns:**
|
|
1237
|
-
```json
|
|
1238
|
-
{
|
|
1239
|
-
"id": 12345,
|
|
1240
|
-
"url": "https://elis.rossum.ai/api/v1/users/12345",
|
|
1241
|
-
"username": "john.doe@example.com",
|
|
1242
|
-
"first_name": "John",
|
|
1243
|
-
"last_name": "Doe",
|
|
1244
|
-
"email": "john.doe@example.com",
|
|
1245
|
-
"organization": "https://elis.rossum.ai/api/v1/organizations/100",
|
|
1246
|
-
"is_active": true,
|
|
1247
|
-
"date_joined": "2024-01-01T00:00:00Z",
|
|
1248
|
-
"last_login": "2024-01-15T10:30:00Z"
|
|
1249
|
-
}
|
|
1250
|
-
```
|
|
1251
|
-
|
|
1252
|
-
#### list_users
|
|
1253
|
-
|
|
1254
|
-
Lists users in the organization. Use this to find a user's URL when you need it for `token_owner` in `create_hook_from_template`.
|
|
1255
|
-
|
|
1256
|
-
**Parameters:**
|
|
1257
|
-
- `username` (string, optional): Filter by exact username
|
|
1258
|
-
- `email` (string, optional): Filter by email address
|
|
1259
|
-
- `first_name` (string, optional): Filter by first name
|
|
1260
|
-
- `last_name` (string, optional): Filter by last name
|
|
1261
|
-
- `is_active` (boolean, optional): Filter by active status
|
|
1262
|
-
- `is_organization_group_admin` (boolean, optional): Filter by organization group admin role. Use `false` to exclude admin users (e.g., when finding users for `token_owner`)
|
|
1263
|
-
|
|
1264
|
-
**Returns:**
|
|
1265
|
-
```json
|
|
1266
|
-
[
|
|
1267
|
-
{
|
|
1268
|
-
"id": 12345,
|
|
1269
|
-
"url": "https://elis.rossum.ai/api/v1/users/12345",
|
|
1270
|
-
"username": "john.doe@example.com",
|
|
1271
|
-
"first_name": "John",
|
|
1272
|
-
"last_name": "Doe",
|
|
1273
|
-
"email": "john.doe@example.com",
|
|
1274
|
-
"organization": "https://elis.rossum.ai/api/v1/organizations/100",
|
|
1275
|
-
"is_active": true
|
|
1276
|
-
}
|
|
1277
|
-
]
|
|
1278
|
-
```
|
|
1279
|
-
|
|
1280
|
-
**Example usage:**
|
|
1281
|
-
```python
|
|
1282
|
-
# Find user by username to get their URL for token_owner
|
|
1283
|
-
users = list_users(username="john.doe@example.com")
|
|
1284
|
-
if users:
|
|
1285
|
-
user_url = users[0].url
|
|
1286
|
-
# Use user_url in create_hook_from_template
|
|
1287
|
-
|
|
1288
|
-
# Find non-admin users suitable for token_owner
|
|
1289
|
-
non_admin_users = list_users(is_organization_group_admin=False)
|
|
1290
|
-
```
|
|
1291
|
-
|
|
1292
|
-
#### list_user_roles
|
|
1293
|
-
|
|
1294
|
-
Lists all user roles (groups of permissions) in the organization. Useful for understanding what roles are available and identifying users with specific permissions.
|
|
1295
|
-
|
|
1296
|
-
**Parameters:**
|
|
1297
|
-
None
|
|
1298
|
-
|
|
1299
|
-
**Returns:**
|
|
1300
|
-
```json
|
|
1301
|
-
[
|
|
1302
|
-
{
|
|
1303
|
-
"id": 12345,
|
|
1304
|
-
"url": "https://elis.rossum.ai/api/v1/groups/12345",
|
|
1305
|
-
"name": "admin",
|
|
1306
|
-
"organization": "https://elis.rossum.ai/api/v1/organizations/100"
|
|
1307
|
-
},
|
|
1308
|
-
{
|
|
1309
|
-
"id": 12346,
|
|
1310
|
-
"url": "https://elis.rossum.ai/api/v1/groups/12346",
|
|
1311
|
-
"name": "annotator",
|
|
1312
|
-
"organization": "https://elis.rossum.ai/api/v1/organizations/100"
|
|
1313
|
-
}
|
|
1314
|
-
]
|
|
1315
|
-
```
|
|
1316
|
-
|
|
1317
|
-
**Example usage:**
|
|
1318
|
-
```python
|
|
1319
|
-
# List all available roles
|
|
1320
|
-
roles = list_user_roles()
|
|
1321
|
-
```
|
|
1322
|
-
|
|
1323
|
-
### Rules Management
|
|
1324
|
-
|
|
1325
|
-
#### get_rule
|
|
1326
|
-
|
|
1327
|
-
Retrieves details of a specific business rule by its ID.
|
|
1328
|
-
|
|
1329
|
-
**Parameters:**
|
|
1330
|
-
- `rule_id` (integer, required): Rule ID
|
|
1331
|
-
|
|
1332
|
-
**Returns:**
|
|
1333
|
-
```json
|
|
1334
|
-
{
|
|
1335
|
-
"id": 12345,
|
|
1336
|
-
"name": "Auto-calculate Total",
|
|
1337
|
-
"url": "https://elis.rossum.ai/api/v1/rules/12345",
|
|
1338
|
-
"enabled": true,
|
|
1339
|
-
"organization": "https://elis.rossum.ai/api/v1/organizations/100",
|
|
1340
|
-
"schema": "https://elis.rossum.ai/api/v1/schemas/200",
|
|
1341
|
-
"trigger_condition": "field.amount_total.changed",
|
|
1342
|
-
"created_by": "https://elis.rossum.ai/api/v1/users/300",
|
|
1343
|
-
"created_at": "2024-01-01T00:00:00Z",
|
|
1344
|
-
"modified_by": "https://elis.rossum.ai/api/v1/users/300",
|
|
1345
|
-
"modified_at": "2024-01-01T00:00:00Z",
|
|
1346
|
-
"rule_template": null,
|
|
1347
|
-
"synchronized_from_template": false,
|
|
1348
|
-
"actions": [
|
|
1349
|
-
{
|
|
1350
|
-
"id": 54321,
|
|
1351
|
-
"type": "set_datapoint_value",
|
|
1352
|
-
"payload": {
|
|
1353
|
-
"datapoint_id": "tax_amount",
|
|
1354
|
-
"value": "field.amount_total.value * 0.2"
|
|
1355
|
-
},
|
|
1356
|
-
"event": "trigger",
|
|
1357
|
-
"enabled": true
|
|
1358
|
-
}
|
|
1359
|
-
]
|
|
1360
|
-
}
|
|
1361
|
-
```
|
|
1362
|
-
|
|
1363
|
-
**Example usage:**
|
|
1364
|
-
```python
|
|
1365
|
-
# Get rule details
|
|
1366
|
-
rule = get_rule(rule_id=12345)
|
|
1367
|
-
```
|
|
1368
|
-
|
|
1369
|
-
#### list_rules
|
|
1370
|
-
|
|
1371
|
-
Lists all business rules configured in your organization. Rules define custom business logic with trigger conditions (TxScript formulas) and actions that execute when conditions are met.
|
|
1372
|
-
|
|
1373
|
-
**Parameters:**
|
|
1374
|
-
- `schema_id` (integer, optional): Filter rules by schema ID
|
|
1375
|
-
- `organization_id` (integer, optional): Filter rules by organization ID
|
|
1376
|
-
- `enabled` (boolean, optional): Filter by enabled status (true for enabled rules, false for disabled)
|
|
1377
|
-
|
|
1378
|
-
**Returns:**
|
|
1379
|
-
```json
|
|
1380
|
-
{
|
|
1381
|
-
"count": 2,
|
|
1382
|
-
"results": [
|
|
1383
|
-
{
|
|
1384
|
-
"id": 12345,
|
|
1385
|
-
"name": "Auto-calculate Total",
|
|
1386
|
-
"url": "https://elis.rossum.ai/api/v1/rules/12345",
|
|
1387
|
-
"enabled": true,
|
|
1388
|
-
"organization": "https://elis.rossum.ai/api/v1/organizations/100",
|
|
1389
|
-
"schema": "https://elis.rossum.ai/api/v1/schemas/200",
|
|
1390
|
-
"trigger_condition": "field.amount_total.changed",
|
|
1391
|
-
"created_by": "https://elis.rossum.ai/api/v1/users/300",
|
|
1392
|
-
"created_at": "2024-01-01T00:00:00Z",
|
|
1393
|
-
"modified_by": "https://elis.rossum.ai/api/v1/users/300",
|
|
1394
|
-
"modified_at": "2024-01-01T00:00:00Z",
|
|
1395
|
-
"rule_template": null,
|
|
1396
|
-
"synchronized_from_template": false,
|
|
1397
|
-
"actions": [
|
|
1398
|
-
{
|
|
1399
|
-
"id": 54321,
|
|
1400
|
-
"type": "set_datapoint_value",
|
|
1401
|
-
"payload": {
|
|
1402
|
-
"datapoint_id": "tax_amount",
|
|
1403
|
-
"value": "field.amount_total.value * 0.2"
|
|
1404
|
-
},
|
|
1405
|
-
"event": "trigger",
|
|
1406
|
-
"enabled": true
|
|
1407
|
-
}
|
|
1408
|
-
]
|
|
1409
|
-
}
|
|
1410
|
-
]
|
|
1411
|
-
}
|
|
1412
|
-
```
|
|
1413
|
-
|
|
1414
|
-
**Example usage:**
|
|
1415
|
-
```python
|
|
1416
|
-
# List all rules
|
|
1417
|
-
all_rules = list_rules()
|
|
1418
|
-
|
|
1419
|
-
# List rules for a specific schema
|
|
1420
|
-
schema_rules = list_rules(schema_id=12345)
|
|
1421
|
-
|
|
1422
|
-
# List only enabled rules
|
|
1423
|
-
enabled_rules = list_rules(enabled=True)
|
|
1424
|
-
|
|
1425
|
-
# List enabled rules for a specific organization
|
|
1426
|
-
org_enabled_rules = list_rules(organization_id=100, enabled=True)
|
|
1427
|
-
```
|
|
1428
|
-
|
|
1429
|
-
### Relations Management
|
|
1430
|
-
|
|
1431
|
-
#### get_relation
|
|
1432
|
-
|
|
1433
|
-
Retrieves details of a specific relation by its ID. Relations introduce common relations between annotations.
|
|
1434
|
-
|
|
1435
|
-
**Parameters:**
|
|
1436
|
-
- `relation_id` (integer, required): Relation ID
|
|
1437
|
-
|
|
1438
|
-
**Returns:**
|
|
1439
|
-
```json
|
|
1440
|
-
{
|
|
1441
|
-
"id": 12345,
|
|
1442
|
-
"type": "duplicate",
|
|
1443
|
-
"key": "abc123def456",
|
|
1444
|
-
"parent": "https://elis.rossum.ai/api/v1/annotations/100",
|
|
1445
|
-
"annotations": [
|
|
1446
|
-
"https://elis.rossum.ai/api/v1/annotations/100",
|
|
1447
|
-
"https://elis.rossum.ai/api/v1/annotations/101"
|
|
1448
|
-
],
|
|
1449
|
-
"url": "https://elis.rossum.ai/api/v1/relations/12345"
|
|
1450
|
-
}
|
|
1451
|
-
```
|
|
1452
|
-
|
|
1453
|
-
**Example usage:**
|
|
1454
|
-
```python
|
|
1455
|
-
# Get relation details
|
|
1456
|
-
relation = get_relation(relation_id=12345)
|
|
1457
|
-
```
|
|
1458
|
-
|
|
1459
|
-
#### list_relations
|
|
1460
|
-
|
|
1461
|
-
Lists all relations between annotations with optional filters. Relations introduce common relations between annotations:
|
|
1462
|
-
- **edit**: Created after editing annotation in user interface (rotation or split of the document)
|
|
1463
|
-
- **attachment**: One or more documents are attachments to another document
|
|
1464
|
-
- **duplicate**: Created after importing the same document that already exists in Rossum
|
|
1465
|
-
|
|
1466
|
-
**Parameters:**
|
|
1467
|
-
- `id` (integer, optional): Filter by relation ID
|
|
1468
|
-
- `type` (string, optional): Filter by relation type ('edit', 'attachment', 'duplicate')
|
|
1469
|
-
- `parent` (integer, optional): Filter by parent annotation ID
|
|
1470
|
-
- `key` (string, optional): Filter by relation key
|
|
1471
|
-
- `annotation` (integer, optional): Filter by annotation ID
|
|
1472
|
-
|
|
1473
|
-
**Returns:**
|
|
1474
|
-
```json
|
|
1475
|
-
{
|
|
1476
|
-
"count": 2,
|
|
1477
|
-
"results": [
|
|
1478
|
-
{
|
|
1479
|
-
"id": 12345,
|
|
1480
|
-
"type": "duplicate",
|
|
1481
|
-
"key": "abc123def456",
|
|
1482
|
-
"parent": "https://elis.rossum.ai/api/v1/annotations/100",
|
|
1483
|
-
"annotations": [
|
|
1484
|
-
"https://elis.rossum.ai/api/v1/annotations/100",
|
|
1485
|
-
"https://elis.rossum.ai/api/v1/annotations/101"
|
|
1486
|
-
],
|
|
1487
|
-
"url": "https://elis.rossum.ai/api/v1/relations/12345"
|
|
1488
|
-
},
|
|
1489
|
-
{
|
|
1490
|
-
"id": 12346,
|
|
1491
|
-
"type": "edit",
|
|
1492
|
-
"key": null,
|
|
1493
|
-
"parent": "https://elis.rossum.ai/api/v1/annotations/200",
|
|
1494
|
-
"annotations": [
|
|
1495
|
-
"https://elis.rossum.ai/api/v1/annotations/201",
|
|
1496
|
-
"https://elis.rossum.ai/api/v1/annotations/202"
|
|
1497
|
-
],
|
|
1498
|
-
"url": "https://elis.rossum.ai/api/v1/relations/12346"
|
|
1499
|
-
}
|
|
1500
|
-
]
|
|
1501
|
-
}
|
|
1502
|
-
```
|
|
1503
|
-
|
|
1504
|
-
**Example usage:**
|
|
1505
|
-
```python
|
|
1506
|
-
# List all relations
|
|
1507
|
-
all_relations = list_relations()
|
|
1508
|
-
|
|
1509
|
-
# List duplicate relations
|
|
1510
|
-
duplicate_relations = list_relations(type="duplicate")
|
|
1511
|
-
|
|
1512
|
-
# List relations for a specific parent annotation
|
|
1513
|
-
parent_relations = list_relations(parent=12345)
|
|
1514
|
-
|
|
1515
|
-
# List relations containing a specific annotation
|
|
1516
|
-
annotation_relations = list_relations(annotation=12345)
|
|
1517
|
-
```
|
|
1518
|
-
|
|
1519
|
-
#### get_document_relation
|
|
1520
|
-
|
|
1521
|
-
Retrieves details of a specific document relation by its ID. Document relations introduce additional relations between annotations and documents.
|
|
1522
|
-
|
|
1523
|
-
**Parameters:**
|
|
1524
|
-
- `document_relation_id` (integer, required): Document relation ID
|
|
1525
|
-
|
|
1526
|
-
**Returns:**
|
|
1527
|
-
```json
|
|
1528
|
-
{
|
|
1529
|
-
"id": 12345,
|
|
1530
|
-
"type": "export",
|
|
1531
|
-
"annotation": "https://elis.rossum.ai/api/v1/annotations/100",
|
|
1532
|
-
"key": "exported_file_key",
|
|
1533
|
-
"documents": [
|
|
1534
|
-
"https://elis.rossum.ai/api/v1/documents/200",
|
|
1535
|
-
"https://elis.rossum.ai/api/v1/documents/201"
|
|
1536
|
-
],
|
|
1537
|
-
"url": "https://elis.rossum.ai/api/v1/document_relations/12345"
|
|
1538
|
-
}
|
|
1539
|
-
```
|
|
1540
|
-
|
|
1541
|
-
**Example usage:**
|
|
1542
|
-
```python
|
|
1543
|
-
# Get document relation details
|
|
1544
|
-
doc_relation = get_document_relation(document_relation_id=12345)
|
|
1545
|
-
```
|
|
1546
|
-
|
|
1547
|
-
#### list_document_relations
|
|
1548
|
-
|
|
1549
|
-
Lists all document relations with optional filters. Document relations introduce additional relations between annotations and documents:
|
|
1550
|
-
- **export**: Documents generated from exporting an annotation
|
|
1551
|
-
- **einvoice**: Electronic invoice documents associated with an annotation
|
|
1552
|
-
|
|
1553
|
-
**Parameters:**
|
|
1554
|
-
- `id` (integer, optional): Filter by document relation ID
|
|
1555
|
-
- `type` (string, optional): Filter by relation type ('export', 'einvoice')
|
|
1556
|
-
- `annotation` (integer, optional): Filter by annotation ID
|
|
1557
|
-
- `key` (string, optional): Filter by relation key
|
|
1558
|
-
- `documents` (integer, optional): Filter by document ID
|
|
1559
|
-
|
|
1560
|
-
**Returns:**
|
|
1561
|
-
```json
|
|
1562
|
-
{
|
|
1563
|
-
"count": 2,
|
|
1564
|
-
"results": [
|
|
1565
|
-
{
|
|
1566
|
-
"id": 12345,
|
|
1567
|
-
"type": "export",
|
|
1568
|
-
"annotation": "https://elis.rossum.ai/api/v1/annotations/100",
|
|
1569
|
-
"key": "exported_file_key",
|
|
1570
|
-
"documents": [
|
|
1571
|
-
"https://elis.rossum.ai/api/v1/documents/200",
|
|
1572
|
-
"https://elis.rossum.ai/api/v1/documents/201"
|
|
1573
|
-
],
|
|
1574
|
-
"url": "https://elis.rossum.ai/api/v1/document_relations/12345"
|
|
1575
|
-
},
|
|
1576
|
-
{
|
|
1577
|
-
"id": 12346,
|
|
1578
|
-
"type": "einvoice",
|
|
1579
|
-
"annotation": "https://elis.rossum.ai/api/v1/annotations/102",
|
|
1580
|
-
"key": null,
|
|
1581
|
-
"documents": [
|
|
1582
|
-
"https://elis.rossum.ai/api/v1/documents/300"
|
|
1583
|
-
],
|
|
1584
|
-
"url": "https://elis.rossum.ai/api/v1/document_relations/12346"
|
|
1585
|
-
}
|
|
1586
|
-
]
|
|
1587
|
-
}
|
|
1588
|
-
```
|
|
1589
|
-
|
|
1590
|
-
**Example usage:**
|
|
1591
|
-
```python
|
|
1592
|
-
# List all document relations
|
|
1593
|
-
all_doc_relations = list_document_relations()
|
|
1594
|
-
|
|
1595
|
-
# List export-type document relations
|
|
1596
|
-
export_relations = list_document_relations(type="export")
|
|
1597
|
-
|
|
1598
|
-
# List document relations for a specific annotation
|
|
1599
|
-
annotation_doc_relations = list_document_relations(annotation=100)
|
|
1600
|
-
|
|
1601
|
-
# List document relations containing a specific document
|
|
1602
|
-
document_relations = list_document_relations(documents=200)
|
|
1603
|
-
```
|
|
1604
|
-
|
|
1605
|
-
### Email Templates
|
|
1606
|
-
|
|
1607
|
-
#### get_email_template
|
|
1608
|
-
|
|
1609
|
-
Retrieves details of a specific email template by its ID.
|
|
1610
|
-
|
|
1611
|
-
**Parameters:**
|
|
1612
|
-
- `email_template_id` (integer, required): Email template ID
|
|
1613
|
-
|
|
1614
|
-
**Returns:**
|
|
1615
|
-
```json
|
|
1616
|
-
{
|
|
1617
|
-
"id": 1500,
|
|
1618
|
-
"name": "Rejection Email",
|
|
1619
|
-
"url": "https://elis.rossum.ai/api/v1/email_templates/1500",
|
|
1620
|
-
"queue": "https://elis.rossum.ai/api/v1/queues/8199",
|
|
1621
|
-
"organization": "https://elis.rossum.ai/api/v1/organizations/1",
|
|
1622
|
-
"subject": "Document Rejected",
|
|
1623
|
-
"message": "<p>Your document has been rejected.</p>",
|
|
1624
|
-
"type": "rejection",
|
|
1625
|
-
"enabled": true,
|
|
1626
|
-
"automate": false,
|
|
1627
|
-
"triggers": [],
|
|
1628
|
-
"to": [{"type": "annotator", "value": ""}],
|
|
1629
|
-
"cc": [],
|
|
1630
|
-
"bcc": []
|
|
1631
|
-
}
|
|
1632
|
-
```
|
|
1633
|
-
|
|
1634
|
-
**Example usage:**
|
|
1635
|
-
```python
|
|
1636
|
-
# Get email template details
|
|
1637
|
-
template = get_email_template(email_template_id=1500)
|
|
1638
|
-
```
|
|
1639
|
-
|
|
1640
|
-
#### list_email_templates
|
|
1641
|
-
|
|
1642
|
-
Lists all email templates with optional filters. Email templates define automated or manual email responses sent from Rossum queues.
|
|
1643
|
-
|
|
1644
|
-
**Parameters:**
|
|
1645
|
-
- `queue_id` (integer, optional): Filter by queue ID
|
|
1646
|
-
- `type` (string, optional): Filter by template type ('rejection', 'rejection_default', 'email_with_no_processable_attachments', 'custom')
|
|
1647
|
-
- `name` (string, optional): Filter by template name
|
|
1648
|
-
- `first_n` (integer, optional): Limit results to first N templates
|
|
1649
|
-
|
|
1650
|
-
**Returns:**
|
|
1651
|
-
```json
|
|
1652
|
-
{
|
|
1653
|
-
"count": 2,
|
|
1654
|
-
"results": [
|
|
1655
|
-
{
|
|
1656
|
-
"id": 1500,
|
|
1657
|
-
"name": "Rejection Email",
|
|
1658
|
-
"type": "rejection",
|
|
1659
|
-
"queue": "https://elis.rossum.ai/api/v1/queues/8199",
|
|
1660
|
-
"automate": false
|
|
1661
|
-
},
|
|
1662
|
-
{
|
|
1663
|
-
"id": 1501,
|
|
1664
|
-
"name": "No Attachments Notification",
|
|
1665
|
-
"type": "email_with_no_processable_attachments",
|
|
1666
|
-
"queue": "https://elis.rossum.ai/api/v1/queues/8199",
|
|
1667
|
-
"automate": true
|
|
1668
|
-
}
|
|
1669
|
-
]
|
|
1670
|
-
}
|
|
1671
|
-
```
|
|
1672
|
-
|
|
1673
|
-
**Example usage:**
|
|
1674
|
-
```python
|
|
1675
|
-
# List all email templates
|
|
1676
|
-
all_templates = list_email_templates()
|
|
1677
|
-
|
|
1678
|
-
# List email templates for a specific queue
|
|
1679
|
-
queue_templates = list_email_templates(queue_id=8199)
|
|
1680
|
-
|
|
1681
|
-
# List rejection templates
|
|
1682
|
-
rejection_templates = list_email_templates(type="rejection")
|
|
1683
|
-
|
|
1684
|
-
# List first 5 templates
|
|
1685
|
-
first_templates = list_email_templates(first_n=5)
|
|
1686
|
-
```
|
|
1687
|
-
|
|
1688
|
-
#### create_email_template
|
|
1689
|
-
|
|
1690
|
-
Creates a new email template. Templates can be automated to send emails automatically on specific triggers, or manual for user-initiated sending.
|
|
1691
|
-
|
|
1692
|
-
**Parameters:**
|
|
1693
|
-
- `name` (string, required): Name of the email template
|
|
1694
|
-
- `queue` (string, required): URL of the queue to associate with
|
|
1695
|
-
- `subject` (string, required): Email subject line
|
|
1696
|
-
- `message` (string, required): Email body (HTML supported)
|
|
1697
|
-
- `type` (string, optional): Template type - 'rejection', 'rejection_default', 'email_with_no_processable_attachments', 'custom' (default: 'custom')
|
|
1698
|
-
- `automate` (boolean, optional): If true, email is sent automatically on trigger (default: false)
|
|
1699
|
-
- `to` (array, optional): List of recipient objects with 'type' and 'value' keys
|
|
1700
|
-
- `cc` (array, optional): List of CC recipient objects
|
|
1701
|
-
- `bcc` (array, optional): List of BCC recipient objects
|
|
1702
|
-
- `triggers` (array, optional): List of trigger URLs
|
|
1703
|
-
|
|
1704
|
-
**Recipient object types:**
|
|
1705
|
-
- `{"type": "annotator", "value": ""}` - Send to the document annotator
|
|
1706
|
-
- `{"type": "constant", "value": "email@example.com"}` - Send to a fixed email address
|
|
1707
|
-
- `{"type": "datapoint", "value": "email_field_id"}` - Send to email from a datapoint field
|
|
1708
|
-
|
|
1709
|
-
**Returns:**
|
|
1710
|
-
```json
|
|
1711
|
-
{
|
|
1712
|
-
"id": 1502,
|
|
1713
|
-
"name": "Custom Notification",
|
|
1714
|
-
"url": "https://elis.rossum.ai/api/v1/email_templates/1502",
|
|
1715
|
-
"queue": "https://elis.rossum.ai/api/v1/queues/8199",
|
|
1716
|
-
"subject": "Document Processed",
|
|
1717
|
-
"message": "<p>Your document has been processed.</p>",
|
|
1718
|
-
"type": "custom",
|
|
1719
|
-
"automate": true,
|
|
1720
|
-
"to": [{"type": "constant", "value": "notifications@example.com"}]
|
|
1721
|
-
}
|
|
1722
|
-
```
|
|
1723
|
-
|
|
1724
|
-
**Example usage:**
|
|
1725
|
-
```python
|
|
1726
|
-
# Create a simple custom email template
|
|
1727
|
-
template = create_email_template(
|
|
1728
|
-
name="Processing Complete",
|
|
1729
|
-
queue="https://elis.rossum.ai/api/v1/queues/8199",
|
|
1730
|
-
subject="Document Processing Complete",
|
|
1731
|
-
message="<p>Your document has been successfully processed.</p>"
|
|
1732
|
-
)
|
|
1733
|
-
|
|
1734
|
-
# Create an automated rejection template
|
|
1735
|
-
template = create_email_template(
|
|
1736
|
-
name="Auto Rejection",
|
|
1737
|
-
queue="https://elis.rossum.ai/api/v1/queues/8199",
|
|
1738
|
-
subject="Document Rejected",
|
|
1739
|
-
message="<p>Your document could not be processed.</p>",
|
|
1740
|
-
type="rejection",
|
|
1741
|
-
automate=True,
|
|
1742
|
-
to=[{"type": "annotator", "value": ""}]
|
|
1743
|
-
)
|
|
1744
|
-
|
|
1745
|
-
# Create template with multiple recipients
|
|
1746
|
-
template = create_email_template(
|
|
1747
|
-
name="Team Notification",
|
|
1748
|
-
queue="https://elis.rossum.ai/api/v1/queues/8199",
|
|
1749
|
-
subject="New Document",
|
|
1750
|
-
message="<p>A new document has arrived.</p>",
|
|
1751
|
-
to=[{"type": "constant", "value": "team@example.com"}],
|
|
1752
|
-
cc=[{"type": "datapoint", "value": "sender_email"}]
|
|
1753
|
-
)
|
|
1754
|
-
```
|
|
1755
|
-
|
|
1756
|
-
### Tool Discovery
|
|
1757
|
-
|
|
1758
|
-
#### list_tool_categories
|
|
1759
|
-
|
|
1760
|
-
Lists all available tool categories with their descriptions, tool names, and keywords. This enables dynamic tool loading where agents can discover and load only the tools they need for a specific task.
|
|
1761
|
-
|
|
1762
|
-
**Parameters:**
|
|
1763
|
-
None
|
|
1764
|
-
|
|
1765
|
-
**Returns:**
|
|
1766
|
-
```json
|
|
1767
|
-
[
|
|
1768
|
-
{
|
|
1769
|
-
"name": "annotations",
|
|
1770
|
-
"description": "Document processing: upload, retrieve, update, and confirm annotations",
|
|
1771
|
-
"tool_count": 6,
|
|
1772
|
-
"tools": [
|
|
1773
|
-
{"name": "upload_document", "description": "Upload document to queue"},
|
|
1774
|
-
{"name": "get_annotation", "description": "Retrieve annotation with extracted data"}
|
|
1775
|
-
],
|
|
1776
|
-
"keywords": ["annotation", "document", "upload", "extract", "confirm", "review"]
|
|
1777
|
-
},
|
|
1778
|
-
{
|
|
1779
|
-
"name": "queues",
|
|
1780
|
-
"description": "Queue management: create, configure, and list document processing queues",
|
|
1781
|
-
"tool_count": 8,
|
|
1782
|
-
"tools": [
|
|
1783
|
-
{"name": "get_queue", "description": "Retrieve queue details"},
|
|
1784
|
-
{"name": "list_queues", "description": "List all queues"}
|
|
1785
|
-
],
|
|
1786
|
-
"keywords": ["queue", "inbox", "connector"]
|
|
1787
|
-
}
|
|
1788
|
-
]
|
|
1789
|
-
```
|
|
1790
|
-
|
|
1791
|
-
**Available Categories:**
|
|
1792
|
-
- `annotations` - Document processing tools (6 tools)
|
|
1793
|
-
- `queues` - Queue management tools (8 tools)
|
|
1794
|
-
- `schemas` - Schema management tools (7 tools)
|
|
1795
|
-
- `engines` - AI engine management tools (6 tools)
|
|
1796
|
-
- `hooks` - Extensions/webhooks tools (7 tools)
|
|
1797
|
-
- `email_templates` - Email template tools (3 tools)
|
|
1798
|
-
- `document_relations` - Document relation tools (2 tools)
|
|
1799
|
-
- `relations` - Annotation relation tools (2 tools)
|
|
1800
|
-
- `rules` - Validation rule tools (2 tools)
|
|
1801
|
-
- `users` - User management tools (3 tools)
|
|
1802
|
-
- `workspaces` - Workspace management tools (3 tools)
|
|
1803
|
-
|
|
1804
|
-
**Example usage:**
|
|
1805
|
-
```python
|
|
1806
|
-
# Discover all tool categories
|
|
1807
|
-
categories = list_tool_categories()
|
|
1808
|
-
|
|
1809
|
-
# Find categories by keyword matching
|
|
1810
|
-
for category in categories:
|
|
1811
|
-
if "schema" in category["keywords"]:
|
|
1812
|
-
print(f"Found: {category['name']} with {category['tool_count']} tools")
|
|
1813
|
-
```
|
|
1814
|
-
|
|
1815
|
-
## Annotation Status Workflow
|
|
1816
|
-
|
|
1817
|
-
When a document is uploaded, the annotation progresses through various states:
|
|
1818
|
-
|
|
1819
|
-
1. **importing** - Initial state after upload. Document is being processed.
|
|
1820
|
-
2. **to_review** - Extraction complete, ready for user validation.
|
|
1821
|
-
3. **reviewing** - Annotation is being reviewed (triggered by `start_annotation`). This state is required before you can update annotation fields.
|
|
1822
|
-
4. **confirmed** - The annotation has been validated and confirmed (via `confirm_annotation`).
|
|
1823
|
-
5. **exporting** - The annotation is being exported.
|
|
1824
|
-
6. **exported** - Final state for successfully processed documents.
|
|
1825
|
-
|
|
1826
|
-
Other possible states include: `created`, `failed_import`, `split`, `in_workflow`, `rejected`, `failed_export`, `postponed`, `deleted`, `purged`.
|
|
1827
|
-
|
|
1828
|
-
**Important Notes:**
|
|
1829
|
-
- After uploading documents, agents should wait for annotations to transition from `importing` to `to_review` (or later states) before considering them fully processed.
|
|
1830
|
-
- To update annotation field values, you must first call `start_annotation` to move the annotation to 'reviewing' status.
|
|
1831
|
-
- After updating fields with `bulk_update_annotation_fields`, you can call `confirm_annotation` to move to 'confirmed' status.
|
|
1832
|
-
|
|
1833
|
-
## Example Workflows
|
|
1834
|
-
|
|
1835
|
-
<details>
|
|
1836
|
-
<summary>Single Document Upload</summary>
|
|
1837
|
-
|
|
1838
|
-
1. Upload a document using `upload_document`
|
|
1839
|
-
2. Get the annotation ID using `list_annotations`
|
|
1840
|
-
3. Check annotation status using `get_annotation`
|
|
1841
|
-
4. Wait until status is `to_review`, `confirmed`, or `exported`
|
|
1842
|
-
|
|
1843
|
-
</details>
|
|
1844
|
-
|
|
1845
|
-
<details>
|
|
1846
|
-
<summary>Document Upload with Field Updates</summary>
|
|
1847
|
-
|
|
1848
|
-
1. Upload a document using `upload_document`
|
|
1849
|
-
2. Get the annotation ID using `list_annotations`
|
|
1850
|
-
3. Wait until status is `importing` or `to_review`
|
|
1851
|
-
4. Start the annotation using `start_annotation` (moves to 'reviewing')
|
|
1852
|
-
5. Get annotation content using `get_annotation` with `sideloads=['content']`
|
|
1853
|
-
6. Update field values using `bulk_update_annotation_fields` with datapoint IDs from content
|
|
1854
|
-
7. Confirm the annotation using `confirm_annotation` (moves to 'confirmed')
|
|
1855
|
-
|
|
1856
|
-
</details>
|
|
1857
|
-
|
|
1858
|
-
<details>
|
|
1859
|
-
<summary>Bulk Document Upload</summary>
|
|
1860
|
-
|
|
1861
|
-
1. Upload all documents in bulk using `upload_document` for each file
|
|
1862
|
-
2. Check status of all annotations using `list_annotations`
|
|
1863
|
-
3. Monitor until all documents finish processing
|
|
1864
|
-
|
|
1865
|
-
</details>
|
|
1866
|
-
|
|
1867
|
-
<details>
|
|
1868
|
-
<summary>Create Queue with Engine</summary>
|
|
1869
|
-
|
|
1870
|
-
1. Create a schema using `create_schema` with sections and datapoints
|
|
1871
|
-
2. Create an engine using `create_engine` with type 'extractor' or 'splitter'
|
|
1872
|
-
3. Create engine fields using `create_engine_field` for each schema field
|
|
1873
|
-
4. Create a queue using `create_queue` linking the schema and engine
|
|
1874
|
-
5. Optionally update engine training queues using `update_engine`
|
|
1875
|
-
|
|
1876
|
-
</details>
|
|
1877
|
-
|
|
1878
|
-
## Error Handling
|
|
1879
|
-
|
|
1880
|
-
The server provides detailed error messages for common issues:
|
|
1881
|
-
- Missing API token
|
|
1882
|
-
- File not found
|
|
1883
|
-
- Upload failures
|
|
1884
|
-
- API errors
|
|
1885
|
-
|
|
1886
|
-
## License
|
|
1887
|
-
|
|
1888
|
-
MIT License - see LICENSE file for details
|
|
1889
|
-
|
|
1890
|
-
## Resources
|
|
1891
|
-
|
|
1892
|
-
- [Rossum API Documentation](https://elis.rossum.ai/api/docs/)
|
|
1893
|
-
- [Model Context Protocol](https://modelcontextprotocol.io/)
|
|
1894
|
-
- [Rossum SDK](https://github.com/rossumai/rossum-sdk)
|
|
1895
|
-
- [Main Repository](https://github.com/stancld/rossum-mcp)
|