Vendor bills

Start a vendor bill file upload

Asks for a pre-signed upload target for one file. Upload the bytes to it yourself, then attach the session to the bill. Requires the vendor_bills:write permission.

POST
https://services.magicdoor.com/accounting/company-portal/vendor-bills/{vendorBillId}/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

vendorBillIdstringrequired

Snowflake id of the vendor bill.

example: 1830472847398404200

Body

application/json

fileNamestringrequired

The file's name, kept as metadata.

example: invoice-20481.pdf
contentTypestringrequired

The file's MIME type. Vendor bill files must be a PDF or an image, so application/pdf or image/*.

example: application/pdf
fileSizeintegerrequired

The file's size in bytes. Vendor bill files are capped at 20 MB.

example: 184320

Response

200 · A pre-signed upload target. It is single-use and expires.

sessionIdstring

Snowflake id of the session. Pass this as uploadSessionId when attaching the file.

endpointstring

The URL to upload the bytes to. It belongs to the storage provider, not to the MagicDoor API.

methodstring

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

fieldsobject

Form fields the storage provider requires alongside the file. Send them exactly as given; the names and values are provider-specific.

expiresstring · date-time

When the session stops accepting an upload, in the company's timezone.

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

403 · The caller does not hold the `vendor_bills:write` permission.

404 · No vendor bill with this id belongs to the caller's company, or it has been deleted.

  1. Ask for a session

    Call this endpoint. You get back an endpoint, an HTTP method, and a map of form fields.

  2. Upload the bytes yourself

    Send the file to endpoint using method, including every entry of fields in the form. This request does not go to the MagicDoor API and does not take your access token.

  3. Attach it to the bill

    Call Attach files to a vendor bill with the sessionId. The file only becomes part of the bill at that point.