For AI agents: markdown of this page — /docs-content-en/note/collections/create.md documentation index — /llms.txt

Create a knowledge base

POST /v1/note/collections

Creates a knowledge base — a container for documents in Bitrix24 Knowledge Base 2.0. The body is passed flat, without a fields wrapper.

Request fields (body)

Field Type Required Description
name string yes Knowledge base name
position integer no Position in the list. Sorted by descending value. Defaults to 0 — the knowledge base is placed at the top of the list

Examples

curl — personal key

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/note/collections \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product documentation",
    "position": 100
  }'

curl — OAuth application

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/note/collections \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product documentation",
    "position": 100
  }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/note/collections', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'Product documentation',
    position: 100,
  }),
})

const { success, data } = await res.json()
console.log('Knowledge base ID:', data.id)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/note/collections', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'Product documentation',
    position: 100,
  }),
})

const { success, data } = await res.json()

Response fields

Field Type Description
data.id number Identifier of the created knowledge base

Response example

JSON
{
  "success": true,
  "data": {
    "id": 42
  }
}

Error response example

400 — name not provided:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "`name` is required and must be a non-empty string"
  }
}

Errors

HTTP Code Description
400 INVALID_PARAMS name not provided, or position is not a non-negative integer
403 BITRIX_ACCESS_DENIED No permission to create knowledge bases on the Bitrix24 portal
502 BITRIX_UNAVAILABLE Bitrix24 is unavailable
403 SCOPE_DENIED The key is missing the note scope
403 WRITE_BLOCKED_READONLY_KEY The key operates in read-only mode
401 TOKEN_MISSING The key has no configured tokens

Full list of common API errors — Errors.

See also