Documents

Create an upload grant

A short-lived token for uploading one file straight to the document service, into the workspace workspace_id names, or, without one, for your document jobs. Free, and works at any balance.

  1. POST the file to upload_url as multipart form data, with the header X-Upload-Token: <token> and two parts:
    • file: the file.
    • metadata (required): JSON such as {"path": "..."}. Add total_size_bytes for files of 32 MiB or more.
  2. The upload's response carries the file under result.file.
  3. Pass its workspace_id and file_id as the job's source: {"type":"workspace_file","workspace_id":...,"file_id":...}.

The bytes never pass through Drex, so there is no 4.5 MB limit.

post/v1/documents/upload-grants

Request

Request body

workspace_idstring

Optional. A workspace from the Workspaces API that this key may use; the file goes into that workspace. Leave it out to upload a file for your document jobs (parse, extract, classify, split, ground).

pathstring

Pin the upload to exactly this path in the workspace.

max_bytesinteger

Refuse uploads larger than this.

total_size_bytesinteger

The exact size the upload must have.

ttl_secondsinteger

How long the token works.

Response

The grant.

workspace_idstring uuid required

The workspace the file goes into.

upload_urlstring uri required

Where to POST the file. A document-service URL, not Drex's.

tokenstring required

Send as X-Upload-Token. Meant for one upload.

expires_atstring date-time required
max_bytesinteger nullable required

The cap you set, or null for the document service's cap for the file type.

Changes

No recorded changes to this operation across all 1 revision of this API.