Bill Documents
Instead of creating Bills through the API, you can upload the bill or invoice a Business received from a vendor, such as a PDF or an image. Asset reads it and creates the Bill for you.
Call Upload Documents for a Business with document_type set to bill:
curl --request POST \
--url https://api.sandbox.getasset.com/v0/business/biz_GA6EG2qFxA97NZHtxeLPUy/document \
--header 'Authorization: Bearer <token>' \
--form 'files=@vendor-invoice.pdf' \
--form 'document_type=bill'document_type is optional for bills. If you leave it out, Asset works out
the type from the file, and a bill or invoice received from a vendor is
recognized as a Bill. Send it anyway when you know what the file is. For the
Invoices a Business sends to its customers, see Invoice
Documents, where it is required.
What Asset does with it
- Reads the document. Asset extracts the vendor, the bill number, the dates, the line items and the total.
- Finds or creates the Vendor. Asset looks for an existing Vendor with the same name, allowing for small differences such as "ACME Corp" and "Acme Corporation". If there is none, it creates one.
- Creates the Bill. It uses the number on the document, the document's date as
issued_at, and its due date asdue_at. If the document has no due date, Asset uses 30 days after the issue date. Each line item becomes a Bill line. If a document holds several Bills, each one is created separately. - Picks Ledgers for the lines. Asset proposes ledger assignments from the business's Chart of Accounts. Lines it cannot confidently place, and tax lines, are initially left without a ledger and pass through the usual categorization workflow.
- Books it like any other Bill. Asset creates the usual Journal Entry, which debits the line Ledgers and credits Accounts Payable. It links the document to the Bill, and then categorizes the lines that still have no Ledger.
From there the Bill works like one created through the API. See Accounts Payable for paying it, editing it and voiding it.
Result
Follow the outcome on the Document's status:
| Status | Meaning |
|---|---|
| processing | Asset is reading the document. |
| processed | Asset finished reading the document. Check bill_id to see whether a Bill was created. |
| failed | Asset couldn't read the document. The status_reason says why. |
When a Bill was created, the Document's bill_id holds its ID. A processed Document with no bill_id means Asset read the file but didn't create a Bill, for example because the number is already used by another Bill. Create that Bill yourself with Create Bills.
A DOCUMENT_PROCESSED webhook is sent when processing finishes, whatever the outcome.
- Duplicates: a file that matches one already uploaded for the Business is rejected, and the error names the existing document.
- Unsupported files: a file type that isn't supported, or a file that is too large, is rejected at upload.
- Check the result: review the Vendor, Ledgers and amounts on the new Bill, and correct them with Update a Bill.
Questions? Reach out via our Contact form.