Skip to content
ajan.io

Docs menu

On this page

Update Knowledge base

Rename a Knowledge base or update its description

Updates the name or description of an existing Knowledge base. This is not the file replace route. To replace a file, use Update a file.

Before You Start

  • API key scope: Requires an API key with the KNOWLEDGE_FOLDER_API scope. The API key itself needs the Editor role on the Knowledge base. See Share Knowledge bases with the API for setup instructions.
  • Knowledge bases: The Knowledge Folder API manages resources that appear as Knowledge bases in the Library.

Base URL

https://api.ajan.io

Request Format

This endpoint accepts application/json.

Path Parameters

ParameterTypeRequiredDescription
folderIdstringYesThe ID of the Knowledge base

Request Body

FieldTypeRequiredDescription
namestringNoNew name. Cannot be empty after trimming.
descriptionstringNoNew description.

Include at least one field. There is no public endpoint to create or delete a Knowledge base.

Examples

Update with cURL

bash
curl -X PATCH "https://api.ajan.io/knowledge/{folderId}/folder" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product handbook",
    "description": "Internal product documentation"
  }'

Update with JavaScript

javascript
const axios = require("axios");

async function updateKnowledgeBase(folderId, data) {
  const response = await axios.patch(
    `https://api.ajan.io/knowledge/${folderId}/folder`,
    data,
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
      },
    }
  );

  return response.data;
}

const result = await updateKnowledgeBase(
  "550e8400-e29b-41d4-a716-446655440000",
  { name: "Product handbook" }
);
console.log("Updated:", result.result.name);

Response Format

Success Response (200 OK)

typescript
{
  status: "success";
  result: {
    id: string;
    name: string;
    description: string | null;
    createdAt: string;
    updatedAt: string;
  };
}

Example Response

json
{
  "status": "success",
  "result": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Product handbook",
    "description": "Internal product documentation",
    "createdAt": "2026-08-12T09:15:00.000Z",
    "updatedAt": "2026-09-01T10:22:00.000Z"
  }
}

Error Handling

StatusMeaning
400Invalid body, empty name, or no fields provided
401Invalid or missing API key
403Missing KNOWLEDGE_FOLDER_API scope, or the key is not Editor on this Knowledge base
404Knowledge base not found
429Rate limit exceeded
500Unexpected server error

OpenAPI

openapi: 3.0.0
info:
  title: ajan API
  version: 3.0.0
servers:
  - url: https://api.ajan.io
    description: Production
security:
  - bearerAuth: []
paths:
  /knowledge/{folderId}/folder:
    patch:
      summary: Update a Knowledge base name or description
      parameters:
        - name: folderId
          in: path
          required: true
          description: The ID of the knowledge folder
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                description:
                  type: string
      responses:
        '200':
          description: Knowledge base updated successfully
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key as Bearer token. Format "Bearer YOUR_API_KEY"