About UploadAttachment
Documents can be uploaded to organization's Bill.com Inbox. The API can associate documents with bills, vendor credits, invoices, bill payments, invoice payments, vendors, customers, or chart of account.
When uploaded to Inbox, Bill.com automatically processes the document. If Bill.com object ID is passed, the document is attached to that object on upload. If no "Id", the document is uploaded to the Bill.com Inbox. The documentUploadedId
is returned. This document ID is required in order to GetDocumentPages
On Bill.com UI, common file formats can be viewed (i.e., Microsoft Office, PDF, text and some image files).
To upload a file to Bill.com Inbox or to attach a document to an object, set content-type to multipart/form-data
(RFC 1867). API User must have permissions to either Use Inbox, View & Manage Company Info or Approve Bills/ Vendor Credits.
When uploaded, the document is attached to the specified object.
- The file MUST be less than 20 MB.
- The uploaded file extension that is passed MUST match the actual file extension.
- If object id is invalid, an error is returned and the document is not uploaded.
- Single or Multi-page documents can only be associated with a single specified object ID.
Example
Request
<API_URL_EndPoint>/UploadAttachment.json
HTTP request format
POST UploadAttachment.json HTTP/1.1
Host: api.bill.com
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="devKey"
{your_developer_key}
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="sessionId"
{your_session_ID}
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="invoice.pdf"
Content-Type: application/pdf
{file_binary_information}
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data"
{"id":"","fileName":"newinvoice.pdf"}
----WebKitFormBoundary7MA4YWxkTrZu0gW
Response
{
"response_status" : 0,
"response_message" : "Success",
"response_data" : {
"documentUploadedId" : "0du01MDBVGXJQUF1e4ab"
}
}
Resources
Parameters
Request parameters
Field name | Description | Required? |
---|---|---|
id | Object Id to associate document. If document upload is to Bill.com Inbox, do NOT pass this field. | N |
fileName | Name of file uploaded. Note: actual file extension must match entered file extension. | Y |
multipart/form-data request parameters
Field name | Description | Required? |
---|---|---|
file | Binary content of file uploaded. Do not use Base64 encoding. | Y |