For the complete documentation index, see llms.txt. This page is also available as Markdown.

File Upload and Download Contracts

File APIs separate uploading bytes from passing a usable file reference to a workflow. Complete every required upload stage before starting the dependent operation.

Upload a knowledge-base resource

This example uses the direct multipart knowledge-base upload contract. A 202 response accepts the upload; inspect indexing status before retrieval. Presigned upload flows have separate allocation and finalization steps.

Copy the example
curl -X POST \
  "$STACKAI_BASE_URL/v2/knowledge-bases/$KB_ID/resources" \
  -H "Authorization: Bearer $STACKAI_API_KEY" \
  -F "file=@policy.pdf"

# Then inspect the resource returned by the upload.
curl \
  "$STACKAI_BASE_URL/v2/knowledge-bases/$KB_ID/resources/$RESOURCE_ID" \
  -H "Authorization: Bearer $STACKAI_API_KEY"

Before you begin

The public upload contract and a file within its stated limits.

Key concepts

Term
Definition

Upload

Transfer of file bytes through a supported interface or API. Upload acceptance does not establish parsing or indexing completion.

Finalization

A required confirmation step for upload methods that separate allocation from completion. Do not use an allocated upload URL as if the file were already ready.

File reference

An identifier or URL used to pass a file to a supported operation. It must be accessible and use the format expected by that operation.

Signed URL

A temporary link authorizing access under its issuance conditions. It can expire and may remain usable until expiration after other permissions change.

Request body

The payload transmitted with an HTTP request. Interpret it using the content type expected by the endpoint.

Upload a file and use its reference

  1. Create the upload request with the required file metadata.

  2. Upload bytes using the returned method and headers, then finalize if the contract requires it.

  3. Use the completed file reference in the workflow input and inspect the resulting file output.

The workflow receives an accessible file in the required input format.

Behavior and limitations

An allocated upload URL is not a completed file. Use the documented checksum format rather than substituting a hexadecimal digest for base64. Signed URLs can expire and should not serve as permanent identifiers. File size limits differ between upload methods.

API Versions and Compatibility

Was this helpful?