Vendor bills

Create a vendor bill

Records a bill from a vendor and returns it as draft. Every line item is booked to an expense account and must be a positive amount. Requires the vendor_bills:write permission, plus vendor_bills:read, because the endpoint reads the bill back to return it.

POST
https://services.magicdoor.com/accounting/company-portal/vendor-bills

Authorization

Authorizationstringrequired
Bearer token — Send your API token in the Authorization header as Bearer <token>. Requests without a valid token are rejected with 401 Unauthorized.

Body

application/json

propertyId, unitId and leaseId set the property context for the whole bill, not per line: whichever you send is resolved to a portfolio/property/unit/lease set and stamped onto every line item. One of them is required unless companyBill is true.

companyBillbooleanrequired

true when the management company owes the bill itself. false when a property owner does — then a property context is required. true is only accepted for companies that have the company ledger enabled.

example: false
billDatestring · daterequired

The date the vendor issued the bill.

example: 2026-07-31
dueDatestring · daterequired

The date the vendor expects payment.

example: 2026-08-30
vendorIdstringrequired

The vendor who issued the bill. It must exist in this company.

example: 1830472847398404400
memostring

Free-text note, up to 1000 characters.

referencestring

The vendor's own invoice number, up to 150 characters.

portfolioIdstring

Accepted by the endpoint but not used when resolving the property context — send propertyId, unitId or leaseId instead.

propertyIdstring

The property the whole bill is for.

unitIdstring

The unit the whole bill is for.

leaseIdstring

The lease the whole bill is for.

lineItemsLineItem[]required

At least one line. Their order in the array becomes each line's order.

Response

200 · The vendor bill that was created, read back in full.

idstring

Snowflake id of the vendor bill.

createdstring · date-time

When the bill was recorded, in the company's timezone.

updatedstring · date-time

When the bill was last changed, in the company's timezone.

companyBillboolean

true when the management company owes this bill itself; false when a property owner does, in which case every line carries a property context.

billDatestring · date

The date the vendor issued the bill.

dueDatestring · date

The date the vendor expects payment.

memostring

Free-text note on the bill. Absent when none was set.

referencestring

The vendor's own invoice number or reference. Absent when none was set.

sourceTypeenum<string>

What the bill was raised from. Absent when it is not linked to anything.

workOrder
sourceIdstring

Id of the record named by sourceType. Absent when sourceType is.

vendorIdstring

The vendor who issued the bill.

statusenum<string>

Where the bill sits in the approval flow. Bills created through this API start as draft; none of these endpoints move it on.

draftpendingapprovedrejectedwithdrawn
assignedToIdstring

The property manager the bill is waiting on. Absent while nobody is assigned.

assignedByIdstring

The property manager who assigned it. Absent while nobody is assigned.

assignedAtstring · date-time

When it was assigned, in the company's timezone. Absent while nobody is assigned.

totalAmountnumber

Sum of every line item's amount, as a decimal.

allocatedAmountnumber

Sum of every line item's allocatedAmount — how much of the bill has been paid.

dueAmountnumber

totalAmount minus allocatedAmount — what is still outstanding on the bill.

lineItemsLineItem[]

The bill's lines, in order. There is always at least one.

filesFile[]

Scanned invoices and other attachments.

creatorobject

Who recorded the bill. Deprecated mirrors of id — propertyManagerId, tenantId, vendorId, ownerId — are also present, whichever matches type.

400 · `lineItems` is empty, a line amount is zero or negative, or `companyBill` is `false` and none of `propertyId`, `unitId` or `leaseId` was sent.

401 · The access token is missing, expired, or not for this company.

403 · The caller does not hold both the `vendor_bills:write` and `vendor_bills:read` permissions. A caller holding only `vendor_bills:write` gets a 403 **after the change has been applied**, because the response is read back through the read-gated path.

404 · The `vendorId` names no vendor, or a `chartOfAccountId` names no account visible to this company.

422 · A `chartOfAccountId` is not an expense account, or `companyBill` is `true` for a company that does not have the company ledger enabled.