Skip to main content

Consolidated expense documents

Attach supporting documents (invoice, calculation memo, contract, bankslip) to an expense of the fund class and query the documents already attached. The expense_key comes from the consolidated expense query.

The file is sent in two steps: the API registers the document and returns an upload URL; then you send the file directly to that URL.

Attach a document​

Available on
ProfileHostRequired permission
Managermanager-apiWrite

Base URL for each host: Environments (Hosts).

ENDPOINT
/expense/fund_class/{fund_class_key}/expense/{expense_key}/document
METHOD
POST

Path params​

ParameterTypeDescription
fund_class_keystringFund class key (UUID).
expense_keystringExpense key (UUID).

Body attributes​

FieldTypeRequiredDescription
namestringrequiredDocument name. Maximum of 255 characters.
document_typestringrequiredinvoice (invoice), calculation_memory (calculation memo), contract (contract) or bank_slip (bankslip).

No other field is accepted.

Request Body
{
"name": "NF-e 001234 - Auditoria jun/2026",
"document_type": "invoice"
}

Response​

STATUS
201
Response Body
{
"name": "NF-e 001234 - Auditoria jun/2026",
"document_key": "d4e5f6a7-b8c9-0123-def4-567890abcdef",
"expense_key": "3571e292-3a83-4011-904d-20ee963022ef",
"document_type": "invoice",
"upload_url": {
"url": "https://<link-temporario-de-envio>",
"fields": {
"key": "d4e5f6a7-b8c9-0123-def4-567890abcdef",
"policy": "<policy>",
"x-amz-algorithm": "AWS4-HMAC-SHA256",
"x-amz-credential": "<credential>",
"x-amz-date": "20260701T120000Z",
"x-amz-signature": "<signature>"
}
}
}
FieldTypeDescription
document_keystringDocument key (UUID). Use it to query the document later.
expense_keystringKey of the expense the document belongs to.
upload_url.urlstringAddress to which the file must be sent.
upload_url.fieldsobjectFields that must accompany the file. Send all of them, without changing names or values; the exact set of fields may vary.

File upload​

Make a multipart/form-data POST to upload_url.url, with all the fields of upload_url.fields and the file in the file field (the last one in the form). The URL expires in 10 minutes and accepts files of up to 50 MB. This call goes straight to storage: it does not carry QI Tech authentication headers.

import requests

upload = response_body["upload_url"]

with open("nfe_001234.pdf", "rb") as arquivo:
resposta = requests.post(
upload["url"],
data=upload["fields"],
files={"file": arquivo},
)

resposta.raise_for_status() # 204 indica upload concluído

If the URL expires before the upload, attach the document again to receive a new URL.

List the documents of an expense​

An expense_key that does not exist in the fund class returns an empty data, not 404.

Available on
ProfileHostRequired permission
Managermanager-apiRead

Base URL for each host: Environments (Hosts).

ENDPOINT
/expense/fund_class/{fund_class_key}/expense/{expense_key}/documents
METHOD
GET

The listing is not paginated and does not include the download URL; to download a file, query the document by its key.

Response Body
{
"data": [
{
"name": "NF-e 001234 - Auditoria jun/2026",
"document_key": "d4e5f6a7-b8c9-0123-def4-567890abcdef",
"expense_key": "3571e292-3a83-4011-904d-20ee963022ef",
"document_type": "invoice"
}
]
}

Query a document by key​

Available on
ProfileHostRequired permission
Managermanager-apiRead

Base URL for each host: Environments (Hosts).

ENDPOINT
/expense/fund_class/{fund_class_key}/expense/{expense_key}/document/{document_key}
METHOD
GET
Response Body
{
"name": "NF-e 001234 - Auditoria jun/2026",
"document_key": "d4e5f6a7-b8c9-0123-def4-567890abcdef",
"expense_key": "3571e292-3a83-4011-904d-20ee963022ef",
"document_type": "invoice",
"document_url": "https://<link-temporario-de-download>"
}
FieldTypeDescription
document_urlstringPre-signed URL to download the file, valid for 24 hours. Query the document again to get a new one.

Errors​

StatusCodeWhen it happens
400EXP000069The fund class does not belong to the manager of your API key.
400QIT000001Invalid body: name or document_type is missing, document_type is not in the list, or an unexpected field was sent.
404EXP000072The expense is canceled (canceled) and does not accept new documents.
404EXP000071The document_key does not exist for this expense.
500QIT000500Attach document: the expense_key does not exist in this fund class. Check the key in the expense query.

Authentication, permission and host errors: see API Errors.