curl --request POST \
--url https://api.nextlevelmca.com/v1/documents/{id}/finalize \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"file_size": 2
}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({file_size: 2})
};
fetch('https://api.nextlevelmca.com/v1/documents/{id}/finalize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.nextlevelmca.com/v1/documents/{id}/finalize"
payload = { "file_size": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "<string>",
"deal_id": "<string>",
"name": "<string>",
"type": "application",
"mime_type": "<string>",
"file_size": 123,
"upload_pending": true,
"variant": "original",
"source": "<string>",
"ocr_status": "<string>",
"shared_with_merchant": true,
"uploaded_by_id": "<string>",
"uploaded_at": "<string>",
"created_at": "<string>",
"download_url": "<string>",
"download_url_expires_at": "<string>"
},
"meta": {}
}{
"error": {
"type": "validation_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "validation_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "validation_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "validation_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "validation_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "validation_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>"
}
}Finalize an upload
Confirms the file was uploaded to the presigned URL, records its size, makes the document visible in the app and, for bank-statement documents, recomputes statement coverage and, for a PDF, adds the watermarked copy that is sent to lenders (listed as its own document with variant: "watermarked"). Returns 409 upload_not_found when nothing was uploaded yet, and 409 upload_empty when the uploaded file has no bytes (the empty file is removed, so PUT the real file to the same upload_url and finalize again). Safe to call more than once. A bank-statement whose file is already on the deal (the same bytes, under any name) is not added twice: the new upload is dropped and the document already there is returned, so check the returned id. Statement analysis itself is started from the app (it is billed per file).
curl --request POST \
--url https://api.nextlevelmca.com/v1/documents/{id}/finalize \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"file_size": 2
}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({file_size: 2})
};
fetch('https://api.nextlevelmca.com/v1/documents/{id}/finalize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.nextlevelmca.com/v1/documents/{id}/finalize"
payload = { "file_size": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "<string>",
"deal_id": "<string>",
"name": "<string>",
"type": "application",
"mime_type": "<string>",
"file_size": 123,
"upload_pending": true,
"variant": "original",
"source": "<string>",
"ocr_status": "<string>",
"shared_with_merchant": true,
"uploaded_by_id": "<string>",
"uploaded_at": "<string>",
"created_at": "<string>",
"download_url": "<string>",
"download_url_expires_at": "<string>"
},
"meta": {}
}{
"error": {
"type": "validation_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "validation_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "validation_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "validation_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "validation_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "validation_error",
"message": "<string>",
"request_id": "<string>",
"code": "<string>",
"param": "<string>"
}
}Body
Was this page helpful?