Skip to main content

Document Upload

Add supporting documents to an expense or contract. The documents go through QI Tech analysis and are required for the expense submission.

Shortcut at creation

You can include documents directly in the body of the expense creation — in that case, the expense already enters pending_adm_approval without having to call this endpoint separately.

Accepted document types
  • invoice — Electronic invoice (NF-e)
  • calculation_memory — Calculation memo or computation spreadsheet
  • contract — Contract of the service provided
  • bank_slip — Bankslip

Document upload to an expense​

ENDPOINT
/expense_submission/fund_class/{fund_class_key}/contract/{contract_key}/expense/{expense_key}/document
METHOD
POST

Path params​

ParameterTypeDescription
fund_class_keystringUnique key of the fund (UUID)
contract_keystringUnique key of the contract
expense_keystringUnique key of the expense (UUID)
Request Body
{
"name": "NF-e 001234 - Auditoria jun/2026",
"document_type": "invoice",
"document_b64": "JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwKL0xlbmd0aCAzIDAgUgo..."
}

Body attributes​

FieldTypeRequiredDescription
namestringrequiredDocument name. Maximum of 255 characters.
document_typestringrequiredDocument type: invoice, calculation_memory, contract or bank_slip.
document_b64stringrequiredFile content encoded in Base64.

Response​

STATUS
201
Response Body
{
"name": "NF-e 001234 - Auditoria jun/2026",
"expense_document_key": "d4e5f6a7-b8c9-0123-def4-567890abcdef",
"expense_key": "7f3e9a1b-2c4d-5e6f-8901-abcdef234567",
"document_type": "invoice",
"status": "pending_adm_approval"
}

Response attributes​

FieldTypeDescription
namestringDocument name.
expense_document_keystringUnique key of the document (UUID).
expense_keystringKey of the expense the document belongs to.
document_typestringDocument type.
statusstringInitial status of the document. Always returns pending_adm_approval.

Document upload to a contract​

Documents can also be linked directly to the contract (e.g. the contract of the service provided).

ENDPOINT
/expense_submission/fund_class/{fund_class_key}/contract/{contract_key}/document
METHOD
POST

Path params​

ParameterTypeDescription
fund_class_keystringUnique key of the fund (UUID)
contract_keystringUnique key of the contract

The body and the response attributes follow the same structure as the upload to an expense, with the contract_document_key and contract_key fields in place of expense_document_key and expense_key.

Response Body
{
"name": "Contrato de Prestação de Serviços - Auditoria 2026",
"contract_document_key": "e5f6a7b8-c9d0-1234-ef56-7890abcdef12",
"contract_key": "contrato-auditoria-2026",
"document_type": "contract",
"status": "pending_adm_approval"
}

Query document by key​

Retrieve the data of a document and access the file download link.

Expense document​

ENDPOINT
/expense_submission/fund_class/{fund_class_key}/contract/{contract_key}/expense/{expense_key}/document/{document_key}
METHOD
GET
Response Body
{
"name": "NF-e 001234 - Auditoria jun/2026",
"expense_document_key": "d4e5f6a7-b8c9-0123-def4-567890abcdef",
"expense_key": "7f3e9a1b-2c4d-5e6f-8901-abcdef234567",
"document_type": "invoice",
"status": "approved",
"document_url": "https://storage.example.com/documents/NF-001234.pdf?X-Amz-Expires=3600&..."
}
FieldTypeDescription
document_urlstringPre-signed URL to download the file. Valid for a limited time.
statusstringDocument status: pending_adm_approval, approved or rejected.

Possible errors​

STATUS
404
Expense not found

The set of keys in the URL does not correspond to any registered expense.

{
"title": "Expense Not Found",
"description": "Expense with key {expense_key} was not found.",
"translation": "A despesa com chave {expense_key} não foi encontrada.",
"code": "ESB000016"
}
Document not found

The provided document_key does not correspond to any document registered for this expense.

{
"title": "Document Not Found",
"description": "Document with key {document_key} was not found.",
"translation": "O documento com chave {document_key} não foi encontrado.",
"code": "ESB000015"
}
STATUS
400
Invalid document format

The content in document_b64 is not valid Base64 or the file format is not supported.

{
"title": "Invalid Document Format",
"description": "The document format is invalid.",
"translation": "Formato do documento invalido.",
"code": "ESB000014"
}

Next steps​

With at least one document in pending_adm_approval or approved, the expense is ready to be submitted:

Submit the expense — forward it for QI Tech analysis.