API reference

Libraries

Knowledge libraries and their files, the context a turn can attach.

List libraries

GETapi.niucore.com/api/v1/libraries

Scope: libraries:read

Libraries accessible to the credential, ordered by name.

Query

pageintegerdefaults to 1

Page number, starting at 1.

sizeintegerdefaults to 50

Items per page. Maximum 200.

Returns

idinteger

Identifier.

slugstring

Internal slug.

namestring

Name.

descriptionstring | null

Description.

area_idsinteger[]

Areas it is assigned to.

created_atstring (date-time)

Created.

updated_atstring (date-time)

Last edit.

curl -sS -X GET 'https://api.niucore.com/api/v1/libraries' \
  -H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"
Response
{
  "status": "success",
  "message": "Operación exitosa",
  "message_code": "api_v1_ok",
  "data": [
    {
      "id": 31,
      "slug": "procedimientos-de-soporte",
      "name": "Procedimientos de soporte",
      "description": "Manuales internos del equipo de soporte.",
      "area_ids": [
        4,
        9
      ],
      "created_at": "2026-06-11T09:31:00Z",
      "updated_at": "2026-08-30T18:12:04Z"
    }
  ],
  "meta": {
    "request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77",
    "page": 1,
    "size": 50,
    "total": 1
  }
}

Create a library

POSTapi.niucore.com/api/v1/libraries

Scope: libraries:write

Creates the library, its area assignment and its default prompt in a single transaction. Returns 201.

Note

The embedding model is set by the server, not the client: choosing it from outside would break parity with the service that indexes documents.

Heads up

Uploading and deleting files is not in v1.0. The API reads libraries and files, and creates or edits libraries; document ingestion still belongs to the application.

Request body

namestringrequired

Between 2 and 100 characters.

descriptionstring

Up to 2000 characters.

area_idsinteger[]

Areas it is assigned to. All of them must be within the credential's scope.

Errors

  • 403api_v1_resource_policy_create_deniedThe credential is limited to specific resources (allowlist) and cannot create new ones of this type.
  • 403api_v1_resource_not_allowedAn area_id is outside the scope. Here it is 403 and not 404: the client named the resource explicitly.
  • 503api_v1_library_embedding_unavailableNo embedding model is available to create libraries.
curl -sS -X POST 'https://api.niucore.com/api/v1/libraries' \
  -H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Procedimientos de soporte",
    "description": "Manuales internos del equipo de soporte.",
    "area_ids": [
      4,
      9
    ]
  }'
Response
{
  "status": "success",
  "message": "Operación exitosa",
  "message_code": "api_v1_ok",
  "data": {
    "id": 31,
    "slug": "procedimientos-de-soporte",
    "name": "Procedimientos de soporte",
    "description": "Manuales internos del equipo de soporte.",
    "area_ids": [
      4,
      9
    ],
    "created_at": "2026-06-11T09:31:00Z",
    "updated_at": "2026-08-30T18:12:04Z"
  },
  "meta": {
    "request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
  }
}

Retrieve a library

GETapi.niucore.com/api/v1/libraries/{library_id}

Scope: libraries:read

Detail of one library.

Path

library_idintegerrequired

Identifier.

Errors

  • 404api_v1_not_foundIt does not exist, or it is outside the credential's scope. Both cases answer the same: a 403 would confirm the resource exists.
curl -sS -X GET 'https://api.niucore.com/api/v1/libraries/31' \
  -H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"
Response
{
  "status": "success",
  "message": "Operación exitosa",
  "message_code": "api_v1_ok",
  "data": {
    "id": 31,
    "slug": "procedimientos-de-soporte",
    "name": "Procedimientos de soporte",
    "description": "Manuales internos del equipo de soporte.",
    "area_ids": [
      4,
      9
    ],
    "created_at": "2026-06-11T09:31:00Z",
    "updated_at": "2026-08-30T18:12:04Z"
  },
  "meta": {
    "request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
  }
}

Update a library

PATCHapi.niucore.com/api/v1/libraries/{library_id}

Scope: libraries:write

Updates name, description and area assignment. Omitted fields are left untouched.

Path

library_idintegerrequired

Identifier.

Request body

namestring

New name.

descriptionstring

New description.

area_idsinteger[]

Replaces the whole list of areas.

Errors

  • 404api_v1_not_foundIt does not exist, or it is outside the credential's scope. Both cases answer the same: a 403 would confirm the resource exists.
curl -sS -X PATCH 'https://api.niucore.com/api/v1/libraries/31' \
  -H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Manuales internos del equipo de soporte (rev. 2026-09)."
  }'
Response
{
  "status": "success",
  "message": "Operación exitosa",
  "message_code": "api_v1_ok",
  "data": {
    "id": 31,
    "slug": "procedimientos-de-soporte",
    "name": "Procedimientos de soporte",
    "description": "Manuales internos del equipo de soporte (rev. 2026-09).",
    "area_ids": [
      4,
      9
    ],
    "created_at": "2026-06-11T09:31:00Z",
    "updated_at": "2026-08-30T18:12:04Z"
  },
  "meta": {
    "request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
  }
}

List files

GETapi.niucore.com/api/v1/libraries/{library_id}/files

Scope: libraries:read

Files in the library, newest first.

Path

library_idintegerrequired

Library identifier.

Query

pageintegerdefaults to 1

Page number, starting at 1.

sizeintegerdefaults to 50

Items per page. Maximum 200.

Returns

idinteger

Identifier.

library_idinteger

Owning library.

namestring

Internal document name.

file_namestring

Original file name.

titlestring | null

Title.

document_typestring

Document type.

sizeinteger

Size in bytes.

Errors

  • 404api_v1_not_foundIt does not exist, or it is outside the credential's scope. Both cases answer the same: a 403 would confirm the resource exists.
curl -sS -X GET 'https://api.niucore.com/api/v1/libraries/31/files' \
  -H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"
Response
{
  "status": "success",
  "message": "Operación exitosa",
  "message_code": "api_v1_ok",
  "data": [
    {
      "id": 902,
      "library_id": 31,
      "name": "DOC2149_902.txt",
      "file_name": "politica-devoluciones.pdf",
      "title": "Política de devoluciones",
      "description": "Vigente desde 2026-01",
      "document_type": "pdf",
      "size": 184320,
      "created_at": "2026-06-12T10:02:44Z"
    }
  ],
  "meta": {
    "request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77",
    "page": 1,
    "size": 50,
    "total": 1
  }
}

Retrieve a file

GETapi.niucore.com/api/v1/files/{file_id}

Scope: libraries:read

Detail of one file. It inherits its library's scope: without that library allowed, the file does not exist for the credential.

Path

file_idintegerrequired

File identifier.

Errors

  • 404api_v1_not_foundIt does not exist, or it is outside the credential's scope. Both cases answer the same: a 403 would confirm the resource exists.
curl -sS -X GET 'https://api.niucore.com/api/v1/files/902' \
  -H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"
Response
{
  "status": "success",
  "message": "Operación exitosa",
  "message_code": "api_v1_ok",
  "data": {
    "id": 902,
    "library_id": 31,
    "name": "DOC2149_902.txt",
    "file_name": "politica-devoluciones.pdf",
    "title": "Política de devoluciones",
    "description": "Vigente desde 2026-01",
    "document_type": "pdf",
    "size": 184320,
    "created_at": "2026-06-12T10:02:44Z"
  },
  "meta": {
    "request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
  }
}