Concepts
Slugs, docpaths, and the company/account/org hierarchy.
Slugs, docpaths, and the company/account/org hierarchy.
Every API call carries enough context to resolve a path through this tree:
This is the single most common source of 400 and 404 errors. Slugs are encoded two different ways depending on where they appear:
Used in URL path parameters:
/v1/org/{orgSlug} — {orgSlug} is hex-encoded/v1/workspace/{slug} — {slug} is hex-encoded/v1/org/{orgSlug}/document/... — {orgSlug} is hex-encodedYou get hex-encoded slugs from the slug field on:
GET /v1/orgsGET /v1/org/{orgSlug}/workspacesUsed in:
addToWorkspaces)You get original slugs from the originalSlug field on the same responses above.
Rule of thumb: if it’s between / and / in the URL, use the hex form. Everywhere else, use the original form.
A docpath identifies a document within an organization’s storage. It always has the shape:
Example:
Docpaths appear in:
adds / deletes arrays on POST /v1/workspace/{slug}/update-embeddingsfrom / to on POST /v1/org/{orgSlug}/document/move-filesfiles array on DELETE /v1/org/{orgSlug}/document/remove-filesTwo important rules:
400.If you don’t specify a folder when uploading, the document lands in custom-documents/ under the org. That folder cannot be deleted — it’s the catch-all for unfiled docs.
Uploading a document does not automatically make it queryable. To use a document in a workspace, either:
addToWorkspaces (comma-separated original slugs) at upload time, orPOST /v1/workspace/{slug}/update-embeddings later with the docpath in adds.Both paths require the workspace and document to belong to the same organization.