Zum Hauptinhalt springen

Datei in einen Space hochladen

Upload a file using multipart/form-data. The response is an NDJSON stream (newline-delimited JSON). Each line is a JSON object of one of three types:

typeDescription
progressPeriodic upload-progress update.
completeUpload finished. The url field (e.g. /f/abc123) is the permanent reference to the file.
errorUpload failed. The error field contains a human-readable message.

Computing the hash field — calculate the SHA-256 of the raw file bytes and encode it with base64url (no padding). Most languages ship this natively. Example in Node.js:

import crypto from 'crypto';
const hash = crypto.createHash('sha256').update(buffer).digest('base64url');

The server re-calculates the hash after receiving the file and rejects the request if the values differ, so the hash also acts as an integrity check.

Deduplication — if a file with the same hash already exists in the target space the server returns a complete event immediately without re-uploading the bytes (alreadyExisted: true).

Request Body REQUIRED
file binary REQUIRED

The file to upload.

hash string REQUIRED

SHA-256 of the file bytes, base64url-encoded (no padding). Used for integrity verification and deduplication.

spaceId string

ID of the space to upload the file into. Defaults to the authenticated user's personal space.

shareWith string

ID of an additional space to share the file with.

chunkId uuid

Optional: UUIDv7 to use as the card/chunk ID. Auto-generated when omitted.

cardId uuid

Alias for chunkId (deprecated, prefer chunkId).

chatId string

Verknüpft den Upload mit einer bestehenden Chat-ID.

botId integer

When set, the file is treated as a source for this bot.

facets string

JSON-encoded object of string key/value facets to attach to the file (e.g. {"project":"acme"}).

Responses
200

NDJSON stream. Each line is one of the objects described below. The final line has type: "complete" or type: "error".

Schema OPTIONAL
undefined
401

Unauthorized — missing or invalid bearer token.

Schema OPTIONAL
type string

Possible values: [error]

error string

Human-readable error message.