Skip to content

Knowledge Namespaces

Knowledge namespaces are named containers for your AI knowledge contexts. They add a visibility layer so you can control which team members can access which knowledge bases.

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

Authentication: JWT Bearer token


Visibility Levels

LevelWho can access
privateOnly the creator
workspaceAll members of the associated workspace
accountAll account members

List Namespaces

GET /accounts/{accountId}/knowledge-namespaces

Request

Path ParameterDescription
accountIdAccount UUID
Query ParameterTypeDescription
workspaceIduuidFilter to a specific workspace

Response

Returns an array of namespace objects scoped to the account (optionally filtered to workspaceId).

Code Example

bash
curl "https://api.chainabit.com/api/v1/accounts/$ACCOUNT_ID/knowledge-namespaces" \
  -H "Authorization: Bearer $TOKEN"
javascript
const response = await fetch(
  `${BASE_URL}/accounts/${accountId}/knowledge-namespaces`,
  { headers: { Authorization: `Bearer ${TOKEN}` } }
);
const { data } = await response.json();
python
import httpx
result = httpx.get(
    f"{BASE_URL}/accounts/{account_id}/knowledge-namespaces",
    headers={"Authorization": f"Bearer {token}"},
).json()

Get Namespace

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

Request

Path ParameterDescription
accountIdAccount UUID
idNamespace UUID

Response

Returns a single namespace object.


Create Namespace

POST /accounts/{accountId}/knowledge-namespaces

Requires owner or admin role.

Request

Path ParameterDescription
accountIdAccount UUID

Request body:

FieldTypeRequiredDescription
namestringYesDisplay name
slugstringYesURL-safe identifier [a-z0-9-]+, unique per account
visibilitystringNoprivate | workspace | account (default: workspace)
workspaceIduuidNoAssociate with a workspace
retentionDaysintegerNoAuto-purge TTL (1–3650 days)

Response

Returns the created namespace object.

Code Example

bash
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
  }'
javascript
const response = await fetch(
  `${BASE_URL}/accounts/${accountId}/knowledge-namespaces`,
  {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      name: 'Engineering Docs',
      slug: 'engineering-docs',
      visibility: 'workspace',
      retentionDays: 365,
    }),
  }
);
python
httpx.post(
    f"{BASE_URL}/accounts/{account_id}/knowledge-namespaces",
    json={
        "name": "Engineering Docs",
        "slug": "engineering-docs",
        "visibility": "workspace",
        "retentionDays": 365,
    },
    headers={"Authorization": f"Bearer {token}"},
)

Update Namespace

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

Requires owner or admin role. Slug cannot be changed after creation.

Request

Path ParameterDescription
accountIdAccount UUID
idNamespace UUID

Request body: all fields optional

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

Response

Returns the updated namespace object.


Delete Namespace

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

Soft-deletes the namespace. Requires owner or admin role. 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-]+)
403Caller does not have owner or admin role
404Namespace not found
409Slug already exists in this account

Built with purpose.