/affinda-documents | Type: Application | PCID required: Yes
Tools
affinda_documents_batch_create_annotations
Batch create annotations Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
body | object[] | Yes | — | Request body |
affinda_documents_batch_create_validation_results
Batch create validation results Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
body | object[] | Yes | — | Request body |
affinda_documents_batch_delete_annotations
Batch delete annotations Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
body | integer[] | Yes | — | Array of annotation IDs to be deleted |
affinda_documents_batch_delete_validation_results
Batch delete validation results Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
ids | integer[] | Yes | — | List of validation result IDs to delete. |
affinda_documents_batch_update_annotations
Batch update annotations Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
body | object[] | Yes | — | Request body |
affinda_documents_create_annotation
Create a annotation Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
dataPoint | string | No | — | Data point’s identifier |
document | string | Yes | — | Unique identifier for the document |
field | string | No | — | Field’s identifier |
isClientVerified | boolean | No | — | Indicates whether the data has been validated by a human |
pageIndex | integer | Yes | — | The page number within the document, starting from 0. |
parent | integer | No | — | The parent annotation’s ID |
parsed | object | No | — | The parsed value |
raw | string | No | — | Raw data extracted from the before any post-processing |
rectangles | object[] | No | — | x/y coordinates for the rectangles containing the data. An annotation can be contained within multiple rectangles. |
validationResults | object[] | No | — | The validation results created, changed or deleted as a result of creating the annotation. |
affinda_documents_create_document
Upload a document for parsing Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
snake_case | boolean | No | — | Whether to return the response in snake_case instead of camelCase. Default is false. |
collection | string | No | — | Uniquely identify a collection. |
compact | boolean | No | — | If true, the returned parse result (assuming wait is also true) will be a compact version of the full result. |
customIdentifier | string | No | — | Specify a custom identifier for the document if you need one, not required to be unique. |
deleteAfterParse | boolean | No | — | If true, no data will be stored after parsing. Only compatible with requests where wait: True. |
documentType | string | No | — | The document type’s identifier. Provide if you already know the document type. |
enableValidationTool | boolean | No | — | If true, the document will be viewable in the Affinda Validation Tool. Set to False to optimize parsing speed. |
expiryTime | string | No | — | The date/time in ISO-8601 format when the document will be automatically deleted. Defaults to no expiry. |
file | string | No | — | File as binary data blob. Supported formats: PDF, DOC, DOCX, TXT, RTF, HTML, PNG, JPG, TIFF, ODT, XLS, XLSX |
fileName | string | No | — | Optional filename of the file |
identifier | string | No | — | Deprecated in favor of customIdentifier. |
language | string | No | — | Language code in ISO 639-1 format. Must specify zh-cn or zh-tw for Chinese. |
limitToExamples | string[] | No | — | Restrict LLM example selection to the specified document identifiers. |
llmHint | string | No | — | Optional hint inserted into the LLM prompt when processing this document. |
lowPriority | boolean | No | — | Explicitly mark this document as low priority. |
regionBias | string | No | — | A JSON representation of the RegionBias object. |
rejectDuplicates | boolean | No | — | If “true”, parsing will fail when the uploaded document is duplicate of an existing document, no credits will be consumed. If “false”, will parse the document normally whether its a duplicate or not. If not provided, will fallback to the workspace settings. |
url | string | No | — | URL to download the document. |
useOcr | boolean | No | — | If true, the document will be treated like an image, and the text will be extracted using OCR. If false, the document will be treated like a PDF, and the text will be extracted using the parser. If not set, we will determine whether to use OCR based on whether words are found in the document. |
wait | boolean | No | — | If “true” (default), will return a response only after processing has completed. If “false”, will return an empty data object which can be polled at the GET endpoint until processing is complete. |
warningMessages | object[] | No | — | Warning Messages |
workspace | string | No | — | Uniquely identify a workspace. |
affinda_documents_create_document_type
Create a document type Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
description | string | No | — | A description of the document type. |
name | string | Yes | — | The name of the document type. |
organization | string | Yes | — | The identifier of the organization this document type belongs to. |
affinda_documents_create_validation_result
Create a validation result Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
annotations | integer[] | Yes | — | List of annotation ids that were validated |
document | string | Yes | — | Unique identifier for the document |
message | string | Yes | — | Message explaining why the validation failed |
passed | boolean | No | — | Whether the validation passed or not, null if the validation was not applicable |
ruleSlug | string | Yes | — | The kebab-case slug of the validation rule that was applied |
affinda_documents_delete_annotation
Delete an annotation Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id | integer | Yes | — | Annotation’s ID |
affinda_documents_delete_document
Delete a document Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
identifier | string | Yes | — | Document’s identifier |
affinda_documents_delete_document_type
Delete a document type Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
identifier | string | Yes | — | Document type identifier |
affinda_documents_delete_validation_result
Delete a validation result Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id | integer | Yes | — | Validation result’s ID. |
affinda_documents_get_all_annotations
Get list of all annotations Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
document | string | Yes | — | Filter by document. |
affinda_documents_get_all_documents
Get list of all documents Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
offset | integer | No | — | The number of documents to skip before starting to collect the result set. |
limit | integer | No | — | The numbers of results to return. |
workspace | string | No | — | Filter by workspace. |
collection | string | No | — | Filter by collection. |
state | string | No | — | Filter by the document’s state. |
tags | integer[] | No | — | Filter by tag’s IDs. |
created_dt | string | No | — | Filter by created datetime. |
search | string | No | — | Partial, case-insensitive match with file name or tag name. |
ordering | string[] | No | — | Sort the result set. A ”-” at the beginning denotes DESC sort, e.g. -created_dt. Sort by multiple fields is supported. Supported values include: ‘file_name’, ‘extractor’, ‘created_dt’, ‘validated_dt’, ‘archived_dt’ and ‘parsed__<dataPointSlug>’. |
include_data | boolean | No | — | By default, this endpoint returns only the meta data of the documents. Set this to true will return a summary of the data that was parsed. If you want to retrieve the full set of data for a document, use the GET /documents/{identifier} endpoint. |
exclude | string[] | No | — | Exclude some documents from the result. |
in_review | boolean | No | — | Exclude documents that are currently being reviewed. |
failed | boolean | No | — | Filter by failed status. |
ready | boolean | No | — | Filter by ready status. |
validatable | boolean | No | — | Filter for validatable documents. |
has_challenges | boolean | No | — | Filter for documents with challenges. |
custom_identifier | string | No | — | Filter for documents with this custom identifier. |
compact | boolean | No | — | If “true”, the response is compacted to annotations’ parsed data. Annotations’ meta data are excluded. Default is “false”. |
count | boolean | No | — | If “false”, the documents count is not computed, thus saving time for large collections. Default is “true”. |
snake_case | boolean | No | — | Whether to return the response in snake_case instead of camelCase. Default is false. |
affinda_documents_get_all_validation_results
Get list of all validation results Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
offset | integer | No | — | The number of documents to skip before starting to collect the result set. |
limit | integer | No | — | The numbers of results to return. |
document | string | Yes | — | Filter by document. |
affinda_documents_get_annotation
Get specific annotation Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id | integer | Yes | — | Annotation’s ID |
affinda_documents_get_document
Get specific document Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
identifier | string | Yes | — | Document’s identifier |
format | string | No | — | Specify which format you want the response to be. Default is “json” |
compact | boolean | No | — | If “true”, the response is compacted to annotations’ parsed data. Annotations’ meta data are excluded. Default is “false”. |
snake_case | boolean | No | — | Whether to return the response in snake_case instead of camelCase. Default is false. |
affinda_documents_get_document_type
Get a document type Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
identifier | string | Yes | — | Document type identifier |
affinda_documents_get_document_types
List document types Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
organization | string | No | — | Filter by organization identifier |
workspace | string | No | — | Filter by workspace identifier |
affinda_documents_get_redacted_document
Get redacted document Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
identifier | string | Yes | — | Document identifier |
affinda_documents_get_validation_result
Get specific validation result Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id | integer | Yes | — | Validation result’s ID. |
affinda_documents_json_schema_from_document_type
Generate JSON schema from a document type Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
identifier | string | Yes | — | Document type’s identifier |
title | string | No | — | Title for the JSON schema |
affinda_documents_pydantic_models_from_document_type
Generate Pydantic models from a document type Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
identifier | string | Yes | — | Document type’s identifier |
model_name | string | No | — | Name for the Pydantic model |
affinda_documents_update_annotation
Update an annotation Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id | integer | Yes | — | Annotation’s ID |
dataPoint | string | No | — | Data point’s identifier |
document | string | No | — | Unique identifier for the document |
field | string | No | — | Field’s identifier |
isClientVerified | boolean | No | — | Indicates whether the data has been validated by a human |
pageIndex | integer | No | — | The page number within the document, starting from 0. |
parent | integer | No | — | The parent annotation’s ID |
parsed | object | No | — | The parsed value |
raw | string | No | — | Raw data extracted from the before any post-processing |
rectangles | object[] | No | — | x/y coordinates for the rectangles containing the data. An annotation can be contained within multiple rectangles. |
validationResults | object[] | No | — | The validation results created, changed or deleted as a result of updating the annotation. |
affinda_documents_update_document
Update a document Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
identifier | string | Yes | — | Document’s identifier |
compact | boolean | No | — | If “true”, the response is compacted to annotations’ parsed data. Annotations’ meta data are excluded. Default is “false”. |
snake_case | boolean | No | — | Whether to return the response in snake_case instead of camelCase. Default is false. |
collection | string | No | — | Uniquely identify a collection. |
customIdentifier | string | No | — | Specify a custom identifier for the document if you need one, not required to be unique. |
documentType | string | No | — | The document type’s identifier. Provide if you already know the document type. |
expiryTime | string | No | — | The date/time in ISO-8601 format when the document will be automatically deleted. Defaults to no expiry. |
fileName | string | No | — | Optional filename of the file |
isArchived | boolean | No | — | Is Archived |
isConfirmed | boolean | No | — | Is Confirmed |
isRejected | boolean | No | — | Is Rejected |
language | string | No | — | Language code in ISO 639-1 format. Must specify zh-cn or zh-tw for Chinese. |
llmHint | string | No | — | Optional hint inserted into the LLM prompt when processing this document. |
skipParse | boolean | No | — | Skip Parse |
warningMessages | object[] | No | — | Warning Messages |
workspace | string | No | — | Uniquely identify a workspace. |
affinda_documents_update_document_type
Update a document type Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
identifier | string | Yes | — | Document type identifier |
description | string | No | — | A new description of the document type. |
name | string | No | — | The new name of the document type. |
affinda_documents_update_validation_result
Update a validation result Parameters:| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id | integer | Yes | — | Validation result’s ID. |
annotations | integer[] | No | — | List of annotation ids that were validated |
document | string | No | — | Unique identifier for the document |
message | string | No | — | Message explaining why the validation failed |
passed | boolean | No | — | Whether the validation passed or not, null if the validation was not applicable |
ruleSlug | string | No | — | The kebab-case slug of the validation rule that was applied |

