Tone docs
API referenceKnowledge bases

Get a presigned URL to upload a document

Phase one of a two-phase upload: declare the file, PUT the bytes to the URL you get back, then confirm. contentLength is signed into the URL and must match exactly — a presigned PUT that does not pin the length is an unbounded write.

Requires the write scope. A key with less gets 403 insufficient_scope.

POST
/v1/knowledge-bases/{id}/documents/upload-url
AuthorizationBearer <token>

Authorization: Bearer tone_live_… or tone_test_…. The prefix IS the environment: a test key reaches only the sandbox, and no request field bridges the two.

In: header

Path Parameters

id*string

The knowledge base's id.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/knowledge-bases/string/documents/upload-url" \  -H "Content-Type: application/json" \  -d '{    "contentLength": 248311,    "contentType": "application/pdf",    "filename": "returns-policy.pdf",    "kind": "file"  }'
{  "data": {    "documentId": "9f1c2d84-4e3a-4f6c-b902-7d1e8a33c451",    "expiresInSeconds": 0,    "headers": {},    "url": "https://uploads.usetone.ai/kb/9f1c2d84…?signature=…"  }}
Was this page helpful?