Work orders

Convert a draft bill into a vendor bill

Posts a draft bill into the accounting ledger as a real vendor bill, copying its files across. After this the draft carries a billId and cannot be converted again. Requires the work_orders:write permission.

POST
https://services.magicdoor.com/maintenance/company-portal/work-orders/{workOrderId}/draft-bills/{draftBillId}/convert

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.

Path parameters

workOrderIdstringrequired

The work order to act on. A Snowflake id, sent as a decimal string.

example: 1841200938471029248
draftBillIdstringrequired

The draft bill on this work order. A Snowflake id, sent as a decimal string.

example: 1841500938471029248

Response

200 · The bill was posted. The response has no body — fetch the work order to see the resulting vendor bill in `bills`.

401 · The request carried no valid access token.

403 · The token is not a property manager token, or it lacks the `work_orders:write` permission.

404 · No such work order, or it belongs to another company.

409 · The draft is not ready to post: it has no vendor, it has no lines, one of its lines has no chart of account, or it has already been converted. The response says which.

422 · The work order has no draft bill with that id.

All four must hold, or the call is rejected with a 409:

  • a vendorId on the draft bill;
  • at least one line item;
  • a chartOfAccountId on every line item;
  • no billId yet — a draft can only be posted once.