Upload a file for an invoice
curl --request POST \
--url https://api.tilta.io/v1/invoices/{external_id}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'files={
"type": "file",
"fieldname": "<string>",
"filename": "<string>",
"encoding": "<string>",
"mimetype": "<string>"
}' \
--form 'types={
"type": "field",
"fieldname": "<string>",
"mimetype": "<string>",
"encoding": "<string>",
"fieldnameTruncated": true,
"valueTruncated": true
}'const form = new FormData();
form.append('files', '{
"type": "file",
"fieldname": "<string>",
"filename": "<string>",
"encoding": "<string>",
"mimetype": "<string>"
}');
form.append('types', '{
"type": "field",
"fieldname": "<string>",
"mimetype": "<string>",
"encoding": "<string>",
"fieldnameTruncated": true,
"valueTruncated": true
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.tilta.io/v1/invoices/{external_id}/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tilta.io/v1/invoices/{external_id}/files"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n{\r\n \"type\": \"file\",\r\n \"fieldname\": \"<string>\",\r\n \"filename\": \"<string>\",\r\n \"encoding\": \"<string>\",\r\n \"mimetype\": \"<string>\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"types\"\r\n\r\n{\r\n \"type\": \"field\",\r\n \"fieldname\": \"<string>\",\r\n \"mimetype\": \"<string>\",\r\n \"encoding\": \"<string>\",\r\n \"fieldnameTruncated\": true,\r\n \"valueTruncated\": true\r\n}\r\n-----011000010111000001101001--"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tilta.io/v1/invoices/{external_id}/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n{\r\n \"type\": \"file\",\r\n \"fieldname\": \"<string>\",\r\n \"filename\": \"<string>\",\r\n \"encoding\": \"<string>\",\r\n \"mimetype\": \"<string>\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"types\"\r\n\r\n{\r\n \"type\": \"field\",\r\n \"fieldname\": \"<string>\",\r\n \"mimetype\": \"<string>\",\r\n \"encoding\": \"<string>\",\r\n \"fieldnameTruncated\": true,\r\n \"valueTruncated\": true\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}"<string>"{
"code": "BAD_REQUEST",
"error": "Request validation failed. 1 issue found.",
"issues": [
{
"code": "INVALID_TYPE",
"path": "body.registered_at",
"message": "Invalid type"
}
]
}{
"error": "Unauthorized",
"code": "UNAUTHORIZED"
}Invoices
Upload an invoice file
Attach a file to an invoice – such as the PDF invoice document. Uploaded files are associated with the invoice and stored securely by Tilta.
POST
/
v1
/
invoices
/
{external_id}
/
files
Upload a file for an invoice
curl --request POST \
--url https://api.tilta.io/v1/invoices/{external_id}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'files={
"type": "file",
"fieldname": "<string>",
"filename": "<string>",
"encoding": "<string>",
"mimetype": "<string>"
}' \
--form 'types={
"type": "field",
"fieldname": "<string>",
"mimetype": "<string>",
"encoding": "<string>",
"fieldnameTruncated": true,
"valueTruncated": true
}'const form = new FormData();
form.append('files', '{
"type": "file",
"fieldname": "<string>",
"filename": "<string>",
"encoding": "<string>",
"mimetype": "<string>"
}');
form.append('types', '{
"type": "field",
"fieldname": "<string>",
"mimetype": "<string>",
"encoding": "<string>",
"fieldnameTruncated": true,
"valueTruncated": true
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.tilta.io/v1/invoices/{external_id}/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tilta.io/v1/invoices/{external_id}/files"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n{\r\n \"type\": \"file\",\r\n \"fieldname\": \"<string>\",\r\n \"filename\": \"<string>\",\r\n \"encoding\": \"<string>\",\r\n \"mimetype\": \"<string>\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"types\"\r\n\r\n{\r\n \"type\": \"field\",\r\n \"fieldname\": \"<string>\",\r\n \"mimetype\": \"<string>\",\r\n \"encoding\": \"<string>\",\r\n \"fieldnameTruncated\": true,\r\n \"valueTruncated\": true\r\n}\r\n-----011000010111000001101001--"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tilta.io/v1/invoices/{external_id}/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n{\r\n \"type\": \"file\",\r\n \"fieldname\": \"<string>\",\r\n \"filename\": \"<string>\",\r\n \"encoding\": \"<string>\",\r\n \"mimetype\": \"<string>\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"types\"\r\n\r\n{\r\n \"type\": \"field\",\r\n \"fieldname\": \"<string>\",\r\n \"mimetype\": \"<string>\",\r\n \"encoding\": \"<string>\",\r\n \"fieldnameTruncated\": true,\r\n \"valueTruncated\": true\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}"<string>"{
"code": "BAD_REQUEST",
"error": "Request validation failed. 1 issue found.",
"issues": [
{
"code": "INVALID_TYPE",
"path": "body.registered_at",
"message": "Invalid type"
}
]
}{
"error": "Unauthorized",
"code": "UNAUTHORIZED"
}You can attach files to an invoice to provide supporting documentation for the financing transaction. The most common use case is uploading the actual PDF invoice document so that Tilta and the buyer have access to the official commercial invoice associated with the financed amount. Files are stored securely and linked to the invoice record. Uploads use
multipart/form-data encoding – include both the file binary and a document type classification in the same request.
Do not set a
Content-Type: application/json header on this request. The multipart/form-data content type is set
automatically by your HTTP client when you include --form fields.Upload the PDF invoice document immediately after creating the invoice to ensure Tilta has the supporting documentation
available for the full financing lifecycle, including any potential disputes or audits.
Authorizations
Your Tilta API key, sent as Bearer <key>.
Path Parameters
Unique identifier of an invoice.
Maximum string length:
100Pattern:
^[a-zA-Z0-9-_]+$Body
multipart/form-data
Response
The response is of type string.