Finalize an upload
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
}'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)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));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nextlevelmca.com/v1/documents/{id}/finalize",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'file_size' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nextlevelmca.com/v1/documents/{id}/finalize"
payload := strings.NewReader("{\n \"file_size\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nextlevelmca.com/v1/documents/{id}/finalize")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"file_size\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nextlevelmca.com/v1/documents/{id}/finalize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"file_size\": 2\n}"
response = http.request(request)
puts response.read_body{
"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>"
}
}Documents
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. Returns 409 upload_not_found when nothing was uploaded yet. Safe to call more than once. Statement analysis itself is started from the app (it is billed per file).
POST
/
v1
/
documents
/
{id}
/
finalize
Finalize an upload
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
}'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)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));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nextlevelmca.com/v1/documents/{id}/finalize",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'file_size' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nextlevelmca.com/v1/documents/{id}/finalize"
payload := strings.NewReader("{\n \"file_size\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nextlevelmca.com/v1/documents/{id}/finalize")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"file_size\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nextlevelmca.com/v1/documents/{id}/finalize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"file_size\": 2\n}"
response = http.request(request)
puts response.read_body{
"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>"
}
}Authorizations
API key (nlmca_live_…) or OAuth access token
Path Parameters
Document id returned by the upload step
Body
application/json
Size in bytes of the uploaded file. Falls back to the stored object size.
Required range:
x >= 1Was this page helpful?