“Search only this customer’s documents.” “Answer using just the engineering team’s files.”Where tags and facets layer labels and metadata across your corpus, workspaces draw hard boundaries through it.
The workspace endpoints are in alpha and may change. Creating and managing workspaces from the API requires the appropriate role; some companies provision workspaces through the console instead. You can always upload into and search existing workspaces by
workspace_id.Workspaces, tags, or facets?
All three organise documents, but at different layers. They compose: a file lives in one workspace, can carry several tags, and can be classified with facets.| Workspaces | Tags | Facets | |
|---|---|---|---|
| What it is | A container; every file lives in exactly one | Flat, reusable labels | Typed, hierarchical metadata with a schema |
| A file belongs to | exactly one workspace | many tags, across workspaces | many content types, across workspaces |
| Best for | Isolating teams, customers, tenants | Cross-cutting collections (project, topic) | Precise structured queries |
| Setup cost | Create a workspace | Create a tag | Design a content-type tree |
| Scope a query with | workspace_id | tag_id | content_type / attribute |
| Access control | Yes: API keys can be scoped to a workspace with a per-key role | No: not a permission boundary | No: not a permission boundary |
workspace_id and tag_id can be combined in a search or ask to narrow within a workspace; file_id is mutually exclusive with both. The rest of this tutorial covers workspaces.
Step 1: Create a workspace
A workspace needs aname. The caller is automatically added as its owner.
create_workspace.py
201 returns the new workspace with its id. You’ll pass that ID when uploading files and when scoping queries.
403 means workspace creation is disabled for your company and you’re not an admin: create it from the console instead, or ask an admin.
Step 2: Find a workspace’s ID
List the workspaces you’re a member of to grab an ID. Filter byname, or by workspace_type, user_role, and document_upload_method.
list_workspaces.py
files_count and your user_role (owner, editor, or viewer).
Step 3: Put files in a workspace
A file is assigned to its workspace at upload time: passworkspace_id in the upload payload. A file’s workspace is fixed; there’s no “move file” operation. See Uploading & managing files for the full upload flow.
To pull back every file in a workspace, filter the file listing:
list_files_in_workspace.py
Step 4: Scope search and ask to a workspace
BothPOST /api/v3/search and POST /api/v3/ask accept a workspace_id array that restricts the query to those workspaces. Pass several IDs to query across a set of them.
Search within a workspace:
search_by_workspace.py
ask_by_workspace.py
workspace_id with tag_id to scope to a tagged collection within a workspace.
Step 5: Rename or delete a workspace
Only custom workspaces can be updated, and only by their owner. Personal and company workspaces are managed by the platform.rename_workspace.py
delete_workspace.py
204 confirms the workspace and its contents are gone.
Segmenting access with scoped API keys
Workspaces aren’t only an organisational boundary, they’re a permission boundary. You can mint an API key that is scoped to specific workspaces, so the key can only read or write the documents in those workspaces and nothing else. This is what makes workspaces the right tool when different data needs different permission levels. Pass ascopes list to POST /api/v3/keys. Each entry pairs a workspace_id with a role, one of viewer, editor, or owner. The requested role on a workspace is capped at the role you currently hold there, so you can’t hand out more access than you have.
create_scoped_api_key.py
key value is returned only once, on creation, so store it immediately.
A few patterns this unlocks:
- Multi-tenant isolation: give each customer a key scoped to their own workspace. A request made with that key can never reach another tenant’s documents, even if your application code has a bug.
- Read-only integrations: issue a
viewer-scoped key to a dashboard or analytics job that should search and ask but never upload or delete. - Per-environment separation: scope staging and production keys to different workspaces so a misconfigured job can’t touch the wrong corpus.
editor on one workspace and viewer on another with one key. An unscoped key, by contrast, inherits the full permissions of its owner across every workspace, so prefer scoped keys whenever a credential is handed to a narrower-trust consumer.
Tags and facets don’t carry their own permissions: a key that can see a workspace can see every tag and facet on the files inside it. When access control is the goal, segment with workspaces.
Next steps
Uploading & managing files
Upload documents into a workspace and manage file metadata
Organizing documents with tags
Group files into collections that cut across workspaces
Searching documents
Rank passages, then scope the search by workspace
Asking questions
Get grounded answers over a workspace