Skip to main content

Submitting a Document

Submitting a Document for Standard Analysis

To start document analysis, send a POST request to the /document endpoint using the multipart/form-data format.

Endpoint: https://api.caas.qitech.app/document_analysis/document

Request Format

The request must be sent as multipart/form-data and include data fields and a file field. The required fields for an analysis are id, document_analysis_type, and document_bytes.

Request example:

curl -X POST "https://api.caas.qitech.app/document_analysis/document" \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F "id=request-abc-12345" \
-F "document_analysis_type=proof_of_address" \
-F "document_bytes=@/path/to/your/proof.pdf"

Submission Attributes Description

AttributeDescription
id (required)A unique identifier for the request, provided by you. This ID can be used later to retrieve the analysis results.
document_analysis_type (required)A string that specifies the type of analysis to be performed on the document. See the table below for supported types.
document_bytes (required)The document file to be analyzed. Must be sent as a file in the multipart request body. Note: Do not send this field as a base64-encoded string.
async (optional, default=false)A boolean (true or false) that defines the processing mode.
- false (synchronous): The API will attempt to process the document and return the result in the same request.
- true (asynchronous): The API will acknowledge receipt and process in the background. The result will be sent via webhook to a previously configured URL (see more in the webhooks section).
Attention

The async field must be used to indicate an asynchronous request. Synchronous requests should only be used for small documents and quick analyses where an immediate response is critical. If a request takes longer than 30 seconds it will be automatically redirected to a queue, the return status will be 202 Accepted, and the analysis result will be sent to the previously configured webhook URL (see more in the webhooks section).

Supported Analysis Types

The document_analysis_type field determines which data extraction model will be applied to your document. Below are the types currently supported.

Analysis TypeDocument TypeDescription
company_statute_defaultContract/Articles of AssociationPerforms basic extraction and validation of articles of association. Extracts general company and partner information.
company_statute_credit_assignmentContract/Articles of AssociationPerforms advanced extraction of articles of association, including validation of signing authority for credit assignment agreements.
proof_of_address_defaultProof of Address (utility bills, gas, internet, government letters, declarations, among others)Extracts and validates proof of address information, such as postal code, full address, name and date.
invoiceInvoices, DANFEsExtracts key information from invoices, including supplier/customer details, totals and line items.
bankslipBank SlipsExtracts information from bank slips, such as payee, amount and due date.
ccb_defaultBank Credit Notes (CCBs)Extracts data from Bank Credit Notes.

For analysis types not listed here, contact our support team at suporte.caas@qitech.com.br to inquire about custom implementations.

Responses

Success Response (200 OK)

If the document in a synchronous analysis is processed successfully, the API will return an HTTP 200 OK status and a JSON object containing the extracted data. The structure of this JSON object will vary depending on the requested document_analysis_type. If the request times out, the API will return an HTTP 202 Accepted status and the request will be processed asynchronously. After a short time you can retrieve the document analysis using a GET request, as described below.

Accepted Response (202 Accepted)

If the document is processed asynchronously, the API will return an HTTP 202 Accepted status and the request will be processed asynchronously. After a short time you can retrieve the document analysis using a GET request, as described below.

Error Response (4xx)

If there is a problem with the request or the document, the API will return a 4xx status code with a JSON body describing the error.

Error Code Reference

The following tables list all possible error codes returned by the API. You can use these codes to implement robust error handling in your application.

Category 1: Request Errors (DOC001xx)

CodeTitleDescription
DOC00100Missing required fieldThe request does not contain a required field in the multipart/form-data body.
DOC00101Invalid field lengthThe length of a value in a form-data field is invalid.
DOC00102Invalid content type at requestThe request Content-Type header is not multipart/form-data.
DOC00103Invalid field at requestThe request contains an unexpected or invalid field in the form-data body.

Category 2: File Processing Errors (DOC002xx)

These errors occur when the file itself has issues that prevent its processing.

CodeTitleDescription
DOC00200Invalid Document Analysis TypeThe document_analysis_type is not valid for the document sent. (e.g. a company_statute_default analysis from a utility bill.)
DOC00201Invalid File SizeThe size of the document sent exceeds the maximum allowed limit.
DOC00202Invalid File TypeThe file could not be processed due to inconsistencies in its type or format (e.g. a .jpg file was sent with type application/pdf).
DOC00203PDF exceeds page limitThe provided PDF file contains more pages than the maximum limit allowed for processing (the current limit is 200 pages).

Category 3: Document Analysis Errors (DOC003xx)

These errors occur during the data extraction and analysis phase, after the file has been successfully opened.

CodeTitleDescription
DOC00300Missing InformationThe document does not contain the essential information required for the analysis to be completed.
DOC00301Bad QualityThe document quality (e.g. resolution, legibility, sharpness) is too low to be analyzed accurately.
DOC00302Invalid DataThe document contains inconsistent or invalid data (e.g. incorrect checksums, contradictory fields).
DOC00303Incorrect Document TypeThe document content does not match the expected document type for the selected document_analysis_type.
DOC00304Invalid PDF FileThe provided file is not a valid or well-formed PDF and could not be opened.
DOC00305Password Protected PDFThe submitted PDF is encrypted with a password and cannot be processed.
DOC00306Parsing ErrorThe document analysis could not be processed.

Retrieve a Document Analysis

You can retrieve the results of a previously submitted document analysis at any time using its unique id.

https://api.caas.qitech.app/document_analysis/document/{document_id}

Replace document_id with the same value you used for the POST request.