Work orders

Start a file upload for a draft bill

Asks for a one-time upload slot for an invoice or receipt you want to attach to a draft bill. This endpoint does not take the file — it hands back where to send the bytes, and a session id you then pass to Attach files to a draft bill. Requires the work_orders:write permission.

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

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

Body

application/json

fileNamestringrequired

The file's name, kept as the stored name. Between 1 and 250 characters.

fileSizeintegerrequired

Size of the file in bytes. At least 1, and at most 10485760 (10 MB) for a draft bill file.

contentTypestringrequired

The file's MIME type. Draft bill files accept any image/* type and application/pdf — a narrower set than work order files. Between 1 and 200 characters.

Response

200 · Where to send the bytes.

sessionIdstringrequired

The upload session. Pass this as uploadSessionId once the bytes are up.

endpointstringrequired

The URL to send the file to. It is pre-signed and belongs to the storage provider, not to this API.

methodstringrequired

The HTTP method to use against endpoint, for example PUT or POST.

fieldsobjectrequired

Extra form fields the storage provider needs, as name-to-value pairs. Send them with the file when method is POST; the object is empty when none are needed.

expiresstring · date-timerequired

When the slot stops accepting the file, in the company's timezone and without an offset.

400 · The file name, size or content type is missing or outside the allowed range.

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, it belongs to another company, or the work order has no draft bill with that id.