Business info

Create an upload session for a draft document

Reserves a one-time upload target for a document you are about to attach to the open draft. Requires the business_info:write permission.

POST
https://services.magicdoor.com/companies/company-portal/business-info/{businessInfoId}/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

businessInfoIdstringrequired

The business legal entity, as a Snowflake id in decimal string form.

example: 1842095537184571392

Body

application/json

fileNamestringrequired

The file's name, kept as the document's description. 1 to 250 characters.

fileSizeintegerrequired

Size of the file in bytes. Must be at least 1, and business info documents are capped at 20 MB.

contentTypestringrequired

The file's MIME type. Business info documents accept application/pdf and any image/* type. 1 to 200 characters.

Response

200 · The reserved upload target.

sessionIdstringrequired

The upload session, as a Snowflake id in decimal string form. Send it back as uploadSessionId when attaching the document.

endpointstringrequired

The pre-signed storage URL to upload the file to.

methodstringrequired

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

fieldsobjectrequired

Form fields the storage provider requires with the upload, as name and value pairs. Send all of them.

expiresstring · date-timerequired

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

400 · `fileName`, `fileSize` or `contentType` is missing or out of range.

401 · The request carried no valid access token.

403 · The caller is not a property manager, or is missing the `business_info:write` permission.

422 · This legal entity has no open draft, the draft is not editable, or the file's type or size is not allowed.

Upload the file yourself to the returned endpoint, using the returned method and sending every entry of fields as a form field alongside the file. Then call Attach a document to the draft with sessionId as its uploadSessionId.