Skip to main content
POST
Upload a document for parsing

Authorizations

Authorization
string
header
required

Basic authentication using an API key, e.g. {Authorization: Bearer aff_0bb4fbdf97b7e4111ff6c0015471094155f91}. You can find your API key within the Settings page of the Affinda web app. You can obtain an API key by signing up for a free trial.

Query Parameters

snake_case
boolean

Whether to return the response in snake_case instead of camelCase. Default is false.

Body

multipart/form-data

Document to upload, either via file upload or URL to a file

file
file

File as binary data blob. Supported formats: PDF, DOC, DOCX, TXT, RTF, HTML, PNG, JPG, TIFF, ODT, XLS, XLSX

url
string | null

URL to download the document.

Example:

"https://api.affinda.com/static/sample_resumes/example.docx"

collection
string

Uniquely identify a collection.

Example:

"mEFayXdO"

documentType
string | null

The document type's identifier. Provide if you already know the document type.

workspace
string

Uniquely identify a workspace.

Example:

"mEFayXdO"

wait
boolean
default:true

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.

Example:

true

identifier
string
deprecated

Deprecated in favor of customIdentifier.

customIdentifier
string

Specify a custom identifier for the document if you need one, not required to be unique.

fileName
string | null

Optional filename of the file

Example:

"Document.pdf"

expiryTime
string<date-time> | null

The date/time in ISO-8601 format when the document will be automatically deleted. Defaults to no expiry.

language
string | null

Language code in ISO 639-1 format. Must specify zh-cn or zh-tw for Chinese.

Example:

"en"

rejectDuplicates
boolean | null

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.

Example:

true

regionBias
string

A JSON representation of the RegionBias object.

Example:

"{\"country\": \"vn\"}"

lowPriority
boolean

Explicitly mark this document as low priority.

Example:

true

compact
boolean

If true, the returned parse result (assuming wait is also true) will be a compact version of the full result.

Example:

true

deleteAfterParse
boolean

If true, no data will be stored after parsing. Only compatible with requests where wait: True.

Example:

true

enableValidationTool
boolean

If true, the document will be viewable in the Affinda Validation Tool. Set to False to optimize parsing speed.

Example:

true

useOcr
boolean | null

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.

llmHint
string | null

Optional hint inserted into the LLM prompt when processing this document.

limitToExamples
string[] | null

Restrict LLM example selection to the specified document identifiers.

warningMessages
object[]

Response

Only returned when wait=True, will return the created document

extractor
string
required
meta
object
required
data
object
error
object
warnings
object[]