Skip to content

Knowledge Namespaces ​

Knowledge namespaces are named, visibility-controlled records for organizing knowledge in an account. Every list, get, update, and delete enforces the namespace's declared visibility.

Current limitation

Namespaces are not a retrieval scope: AI retrieval does not search by namespace, and knowledge contexts cannot be assigned to a namespace. Use workspace files and project knowledge to scope what the AI can use. See Current limitations.

Base path: /api/v1/accounts/{accountId}/knowledge-namespaces

Authentication: JWT Bearer token


Visibility Levels ​

LevelWho can see, update, or delete it
privateOnly the creator
workspaceMembers who can open the namespace's workspace (default)
accountAll account members

Roles never widen visibility: an owner or admin cannot see, rename, or delete another member's private namespace, or a workspace namespace in a workspace they cannot open. A namespace you cannot see returns the same 404 as one that does not exist.


List Namespaces ​

GET /accounts/{accountId}/knowledge-namespaces

Request ​

Path ParameterDescription
accountIdAccount UUID
Query ParameterTypeDescription
workspaceIduuidNarrow the visible namespaces to one workspace

Response ​

Returns the namespaces the caller can see. The workspaceId filter only narrows that set; it never adds namespaces the caller cannot see.

Code Example ​

curl "https://api.chainabit.com/api/v1/accounts/$ACCOUNT_ID/knowledge-namespaces" \
  -H "Authorization: Bearer $TOKEN"

Get Namespace ​

GET /accounts/{accountId}/knowledge-namespaces/{id}

Request ​

Path ParameterDescription
accountIdAccount UUID
idNamespace UUID

Response ​

Returns a single namespace object if the caller can see it; otherwise 404.


Create Namespace ​

POST /accounts/{accountId}/knowledge-namespaces

Requires owner or admin role.

Request ​

Path ParameterDescription
accountIdAccount UUID

Request body:

FieldTypeRequiredDescription
namestringYesDisplay name (max 120 chars)
slugstringYesURL-safe identifier [a-z0-9-]+, unique per account
visibilitystringNoprivate | workspace | account (default: workspace)

The body has no workspace field. A workspace or private namespace belongs to the workspace selected for the request (the x-workspace-id header); an account namespace belongs to no workspace. Unknown body fields are rejected. | retentionDays | integer | No | Retention period in days (1–3650). Stored and returned with the namespace. |

Response ​

Returns the created namespace object.

Code Example ​

curl -X POST "https://api.chainabit.com/api/v1/accounts/$ACCOUNT_ID/knowledge-namespaces" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Engineering Docs",
    "slug": "engineering-docs",
    "visibility": "workspace",
    "retentionDays": 365
  }'

Update Namespace ​

PATCH /accounts/{accountId}/knowledge-namespaces/{id}

Requires owner or admin role and a workspace context (x-workspace-id) that you can open. Slug cannot be changed after creation. You can only update a namespace you can see.

Request ​

Path ParameterDescription
accountIdAccount UUID
idNamespace UUID

Request body: all fields optional

FieldTypeDescription
namestringNew display name
visibilitystringprivate | workspace | account
retentionDaysinteger or nullNew retention period; null to remove.

Visibility changes:

  • Changing to account removes the namespace's workspace.
  • Changing to workspace or private requires access to the namespace's workspace, or to the request's workspace if the namespace has none.
  • Only the creator can make a namespace private.

Response ​

Returns the updated namespace object.


Delete Namespace ​

DELETE /accounts/{accountId}/knowledge-namespaces/{id}

Soft-deletes the namespace. Requires owner or admin role, and you can only delete a namespace you can see. Associated contexts are not deleted.

Request ​

Path ParameterDescription
accountIdAccount UUID
idNamespace UUID

Response ​

Namespace is soft-deleted. Associated contexts are not deleted.


Errors ​

StatusDescription
400Invalid slug format (must match [a-z0-9-]+), or a workspace/private namespace without a workspace context
403Caller does not have owner or admin role, cannot open the target workspace, or is not the creator when making a namespace private
404Namespace not found, or not visible to the caller
409Slug already exists in this account (including deleted namespaces)

Current limitations ​

  • Not a retrieval scope. AI retrieval does not search by namespace, and knowledge contexts cannot be assigned to a namespace.
  • Retention is informational. retentionDays is stored and returned with the namespace; it does not delete content.
  • Slugs are account-wide. A slug stays reserved after its namespace is deleted, and creating a namespace with a slug held by a namespace you cannot see still returns 409.

Built with purpose. chainabit.com