Skip to main content
Server path: /affinda-documents | Type: Application | PCID required: Yes

Tools

ToolDescription
affinda_documents_batch_create_annotationsBatch create annotations
affinda_documents_batch_create_validation_resultsBatch create validation results
affinda_documents_batch_delete_annotationsBatch delete annotations
affinda_documents_batch_delete_validation_resultsBatch delete validation results
affinda_documents_batch_update_annotationsBatch update annotations
affinda_documents_create_annotationCreate a annotation
affinda_documents_create_documentUpload a document for parsing
affinda_documents_create_document_typeCreate a document type
affinda_documents_create_validation_resultCreate a validation result
affinda_documents_delete_annotationDelete an annotation
affinda_documents_delete_documentDelete a document
affinda_documents_delete_document_typeDelete a document type
affinda_documents_delete_validation_resultDelete a validation result
affinda_documents_get_all_annotationsGet list of all annotations
affinda_documents_get_all_documentsGet list of all documents
affinda_documents_get_all_validation_resultsGet list of all validation results
affinda_documents_get_annotationGet specific annotation
affinda_documents_get_documentGet specific document
affinda_documents_get_document_typeGet a document type
affinda_documents_get_document_typesList document types
affinda_documents_get_redacted_documentGet redacted document
affinda_documents_get_validation_resultGet specific validation result
affinda_documents_json_schema_from_document_typeGenerate JSON schema from a document type
affinda_documents_pydantic_models_from_document_typeGenerate Pydantic models from a document type
affinda_documents_update_annotationUpdate an annotation
affinda_documents_update_documentUpdate a document
affinda_documents_update_document_typeUpdate a document type
affinda_documents_update_validation_resultUpdate a validation result

affinda_documents_batch_create_annotations

Batch create annotations Parameters:
ParameterTypeRequiredDefaultDescription
bodyobject[]YesRequest body

affinda_documents_batch_create_validation_results

Batch create validation results Parameters:
ParameterTypeRequiredDefaultDescription
bodyobject[]YesRequest body

affinda_documents_batch_delete_annotations

Batch delete annotations Parameters:
ParameterTypeRequiredDefaultDescription
bodyinteger[]YesArray of annotation IDs to be deleted

affinda_documents_batch_delete_validation_results

Batch delete validation results Parameters:
ParameterTypeRequiredDefaultDescription
idsinteger[]YesList of validation result IDs to delete.

affinda_documents_batch_update_annotations

Batch update annotations Parameters:
ParameterTypeRequiredDefaultDescription
bodyobject[]YesRequest body

affinda_documents_create_annotation

Create a annotation Parameters:
ParameterTypeRequiredDefaultDescription
dataPointstringNoData point’s identifier
documentstringYesUnique identifier for the document
fieldstringNoField’s identifier
isClientVerifiedbooleanNoIndicates whether the data has been validated by a human
pageIndexintegerYesThe page number within the document, starting from 0.
parentintegerNoThe parent annotation’s ID
parsedobjectNoThe parsed value
rawstringNoRaw data extracted from the before any post-processing
rectanglesobject[]Nox/y coordinates for the rectangles containing the data. An annotation can be contained within multiple rectangles.
validationResultsobject[]NoThe validation results created, changed or deleted as a result of creating the annotation.

affinda_documents_create_document

Upload a document for parsing Parameters:
ParameterTypeRequiredDefaultDescription
snake_casebooleanNoWhether to return the response in snake_case instead of camelCase. Default is false.
collectionstringNoUniquely identify a collection.
compactbooleanNoIf true, the returned parse result (assuming wait is also true) will be a compact version of the full result.
customIdentifierstringNoSpecify a custom identifier for the document if you need one, not required to be unique.
deleteAfterParsebooleanNoIf true, no data will be stored after parsing. Only compatible with requests where wait: True.
documentTypestringNoThe document type’s identifier. Provide if you already know the document type.
enableValidationToolbooleanNoIf true, the document will be viewable in the Affinda Validation Tool. Set to False to optimize parsing speed.
expiryTimestringNoThe date/time in ISO-8601 format when the document will be automatically deleted. Defaults to no expiry.
filestringNoFile as binary data blob. Supported formats: PDF, DOC, DOCX, TXT, RTF, HTML, PNG, JPG, TIFF, ODT, XLS, XLSX
fileNamestringNoOptional filename of the file
identifierstringNoDeprecated in favor of customIdentifier.
languagestringNoLanguage code in ISO 639-1 format. Must specify zh-cn or zh-tw for Chinese.
limitToExamplesstring[]NoRestrict LLM example selection to the specified document identifiers.
llmHintstringNoOptional hint inserted into the LLM prompt when processing this document.
lowPrioritybooleanNoExplicitly mark this document as low priority.
regionBiasstringNoA JSON representation of the RegionBias object.
rejectDuplicatesbooleanNoIf “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.
urlstringNoURL to download the document.
useOcrbooleanNoIf 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.
waitbooleanNoIf “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.
warningMessagesobject[]NoWarning Messages
workspacestringNoUniquely identify a workspace.

affinda_documents_create_document_type

Create a document type Parameters:
ParameterTypeRequiredDefaultDescription
descriptionstringNoA description of the document type.
namestringYesThe name of the document type.
organizationstringYesThe identifier of the organization this document type belongs to.

affinda_documents_create_validation_result

Create a validation result Parameters:
ParameterTypeRequiredDefaultDescription
annotationsinteger[]YesList of annotation ids that were validated
documentstringYesUnique identifier for the document
messagestringYesMessage explaining why the validation failed
passedbooleanNoWhether the validation passed or not, null if the validation was not applicable
ruleSlugstringYesThe kebab-case slug of the validation rule that was applied

affinda_documents_delete_annotation

Delete an annotation Parameters:
ParameterTypeRequiredDefaultDescription
idintegerYesAnnotation’s ID

affinda_documents_delete_document

Delete a document Parameters:
ParameterTypeRequiredDefaultDescription
identifierstringYesDocument’s identifier

affinda_documents_delete_document_type

Delete a document type Parameters:
ParameterTypeRequiredDefaultDescription
identifierstringYesDocument type identifier

affinda_documents_delete_validation_result

Delete a validation result Parameters:
ParameterTypeRequiredDefaultDescription
idintegerYesValidation result’s ID.

affinda_documents_get_all_annotations

Get list of all annotations Parameters:
ParameterTypeRequiredDefaultDescription
documentstringYesFilter by document.

affinda_documents_get_all_documents

Get list of all documents Parameters:
ParameterTypeRequiredDefaultDescription
offsetintegerNoThe number of documents to skip before starting to collect the result set.
limitintegerNoThe numbers of results to return.
workspacestringNoFilter by workspace.
collectionstringNoFilter by collection.
statestringNoFilter by the document’s state.
tagsinteger[]NoFilter by tag’s IDs.
created_dtstringNoFilter by created datetime.
searchstringNoPartial, case-insensitive match with file name or tag name.
orderingstring[]NoSort 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_databooleanNoBy 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/&#123;identifier&#125; endpoint.
excludestring[]NoExclude some documents from the result.
in_reviewbooleanNoExclude documents that are currently being reviewed.
failedbooleanNoFilter by failed status.
readybooleanNoFilter by ready status.
validatablebooleanNoFilter for validatable documents.
has_challengesbooleanNoFilter for documents with challenges.
custom_identifierstringNoFilter for documents with this custom identifier.
compactbooleanNoIf “true”, the response is compacted to annotations’ parsed data. Annotations’ meta data are excluded. Default is “false”.
countbooleanNoIf “false”, the documents count is not computed, thus saving time for large collections. Default is “true”.
snake_casebooleanNoWhether 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:
ParameterTypeRequiredDefaultDescription
offsetintegerNoThe number of documents to skip before starting to collect the result set.
limitintegerNoThe numbers of results to return.
documentstringYesFilter by document.

affinda_documents_get_annotation

Get specific annotation Parameters:
ParameterTypeRequiredDefaultDescription
idintegerYesAnnotation’s ID

affinda_documents_get_document

Get specific document Parameters:
ParameterTypeRequiredDefaultDescription
identifierstringYesDocument’s identifier
formatstringNoSpecify which format you want the response to be. Default is “json”
compactbooleanNoIf “true”, the response is compacted to annotations’ parsed data. Annotations’ meta data are excluded. Default is “false”.
snake_casebooleanNoWhether to return the response in snake_case instead of camelCase. Default is false.

affinda_documents_get_document_type

Get a document type Parameters:
ParameterTypeRequiredDefaultDescription
identifierstringYesDocument type identifier

affinda_documents_get_document_types

List document types Parameters:
ParameterTypeRequiredDefaultDescription
organizationstringNoFilter by organization identifier
workspacestringNoFilter by workspace identifier

affinda_documents_get_redacted_document

Get redacted document Parameters:
ParameterTypeRequiredDefaultDescription
identifierstringYesDocument identifier

affinda_documents_get_validation_result

Get specific validation result Parameters:
ParameterTypeRequiredDefaultDescription
idintegerYesValidation result’s ID.

affinda_documents_json_schema_from_document_type

Generate JSON schema from a document type Parameters:
ParameterTypeRequiredDefaultDescription
identifierstringYesDocument type’s identifier
titlestringNoTitle for the JSON schema

affinda_documents_pydantic_models_from_document_type

Generate Pydantic models from a document type Parameters:
ParameterTypeRequiredDefaultDescription
identifierstringYesDocument type’s identifier
model_namestringNoName for the Pydantic model

affinda_documents_update_annotation

Update an annotation Parameters:
ParameterTypeRequiredDefaultDescription
idintegerYesAnnotation’s ID
dataPointstringNoData point’s identifier
documentstringNoUnique identifier for the document
fieldstringNoField’s identifier
isClientVerifiedbooleanNoIndicates whether the data has been validated by a human
pageIndexintegerNoThe page number within the document, starting from 0.
parentintegerNoThe parent annotation’s ID
parsedobjectNoThe parsed value
rawstringNoRaw data extracted from the before any post-processing
rectanglesobject[]Nox/y coordinates for the rectangles containing the data. An annotation can be contained within multiple rectangles.
validationResultsobject[]NoThe validation results created, changed or deleted as a result of updating the annotation.

affinda_documents_update_document

Update a document Parameters:
ParameterTypeRequiredDefaultDescription
identifierstringYesDocument’s identifier
compactbooleanNoIf “true”, the response is compacted to annotations’ parsed data. Annotations’ meta data are excluded. Default is “false”.
snake_casebooleanNoWhether to return the response in snake_case instead of camelCase. Default is false.
collectionstringNoUniquely identify a collection.
customIdentifierstringNoSpecify a custom identifier for the document if you need one, not required to be unique.
documentTypestringNoThe document type’s identifier. Provide if you already know the document type.
expiryTimestringNoThe date/time in ISO-8601 format when the document will be automatically deleted. Defaults to no expiry.
fileNamestringNoOptional filename of the file
isArchivedbooleanNoIs Archived
isConfirmedbooleanNoIs Confirmed
isRejectedbooleanNoIs Rejected
languagestringNoLanguage code in ISO 639-1 format. Must specify zh-cn or zh-tw for Chinese.
llmHintstringNoOptional hint inserted into the LLM prompt when processing this document.
skipParsebooleanNoSkip Parse
warningMessagesobject[]NoWarning Messages
workspacestringNoUniquely identify a workspace.

affinda_documents_update_document_type

Update a document type Parameters:
ParameterTypeRequiredDefaultDescription
identifierstringYesDocument type identifier
descriptionstringNoA new description of the document type.
namestringNoThe new name of the document type.

affinda_documents_update_validation_result

Update a validation result Parameters:
ParameterTypeRequiredDefaultDescription
idintegerYesValidation result’s ID.
annotationsinteger[]NoList of annotation ids that were validated
documentstringNoUnique identifier for the document
messagestringNoMessage explaining why the validation failed
passedbooleanNoWhether the validation passed or not, null if the validation was not applicable
ruleSlugstringNoThe kebab-case slug of the validation rule that was applied