File Attachments
You may want to track file attachments alongside your Payables and Receivables, for example, a CSV of the inventory received on a purchase order or a PDF of an invoice. These files will be attached to the invoice record both in Routable and in your integrated accounting software. There is no limit to the number of files attached, but the total size of these files may not exceed 25 megabytes.
File attachments are formatted as Data URLs. We typically recommend a library to help facilitate the process of creating these URLs. Here's a few snippets to get you started:
from datauri import DataURI
const attachment_for_routable_api = {
# => data:application/pdf;base64,JVBERi0xLjMNJeLjz9 (truncated)
"data_uri": str(DataURI.from_file('test.pdf'))
"name": "test.pdf"
}const Datauri = require('datauri/sync');
const attachment_for_routable_api = {
// data:application/pdf;base64,JVBE Ri0xLjMNJ (truncated)
"data_uri": Datauri('test.pdf').content,
"name": "test.pdf"
}$filename = 'test.pdf';
$mime_type = mime_content_type($filename)
$data = file_get_contents($filename);
$attachment_for_routable_api = {
// data:application/pdf;base64,JVBE Ri0xLjMNJ (truncated)
"data_uri": 'data:' . $mime_type . ';base64,' . base64_encode($data),
"name": $filename
}We currently support attaching the following file types:
CSVDOCXJPGPDFPNGTXTXLSX
Be extra careful with file attachments uploaded from users!Certain file formats such as
DOCXand
To attach the Data URI to a Payable or Receivable, add an Attachment object in the attachments array of the Create a Payable or Create a Receivable request:
{
"data_uri": "data:application/pdf;base64,JVBERi0xLjMNJeLjz9...",
"name": "filename_to_save_as_on_Routable.pdf"
}Updated 20 days ago
