PerceptionDocs

Start a chunked upload

A resumable upload of a large file into your account's workspace, in parts of chunk_size bytes. Takes an Idempotency-Key header.

POST
/v1/documents/upload-sessions

Send each call below straight to the document service, with X-Upload-Token: <session_token>:

  1. PUT {upload_session_url}/parts/{n} for each part, numbered from 0.
  2. POST {upload_session_url}/complete?wait_seconds=60 with an Idempotency-Key. It assembles the file in the background and answers 202 while it runs.
  3. Repeat step 2 with the same key until it answers 200 with result.file (workspace_id, file_id).

GET {upload_session_url} shows progress, and DELETE {upload_session_url} aborts.

Other errors (500, 502, 503, 504, 529) are on Errors.

Authorization

bearerAuth
AuthorizationBearer <token>

Your API key from the dashboard's API Keys page: nace_sk_ followed by 43 URL-safe characters (A-Z, a-z, 0-9, _ and -), shown once when you create it. Send it as Authorization: Bearer nace_sk_... Any other value returns 401 authentication_error. An account can hold at most 3 active keys.

In: header

Header Parameters

Idempotency-Key?string

Scoped to your account. Retry with the same key to get the same session.

Lengthlength <= 200

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/documents/upload-sessions" \  -H "Content-Type: application/json" \  -d '{    "path": "string",    "total_size_bytes": 1  }'
{  "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9",  "session_id": "string",  "session_token": "string",  "chunk_size": 0,  "total_parts": 0,  "expires_at": "2019-08-24T14:15:22Z",  "upload_session_url": "http://example.com"}