Open Platform

Knowledges API

Manage your knowledge base programmatically via PAT-authenticated API endpoints.

The Knowledges API lets PAT-authenticated users manage knowledge entries programmatically. All requests require the Authorization: Bearer <pat_token> header and use the base path /personal/v1/knowledge/.

Endpoint Overview

MethodPathDescription
POST/personal/v1/knowledge/listList knowledge entries
GET/personal/v1/knowledge/{id}Get knowledge details
POST/personal/v1/knowledge/createCreate a knowledge entry
POST/personal/v1/knowledge/updateUpdate a knowledge entry
POST/personal/v1/knowledge/upsertSave a knowledge entry (create or update)

Common Response Structure

{
  "code": 200,
  "message": "common.success",
  "data": { ... }
}
FieldTypeDescription
codeintStatus code, 200 indicates success
messagestringInternationalized message key
dataobject/nullResponse data

Pagination data structure for list endpoints:

FieldTypeDescription
pageobject/nullPagination info, null when no pagination params sent
page.totalintTotal record count
page.page_numintCurrent page number (starts from 1)
page.page_sizeintRecords per page
itemsarrayList of KnowledgeResponse objects

Knowledge Object (KnowledgeResponse)

FieldTypeDescription
idintAuto-increment primary key
namestringKnowledge name
typestringKnowledge type: default or document
triggerstringTrigger condition type (see enum below)
trigger_configobjectTrigger configuration (varies by trigger type)
descriptionstring/nullKnowledge description
dataobjectKnowledge content data (varies by type)
labelsobject/nullLabel key-value pairs, e.g. {"env": "prod"}
metadataobject/nullMetadata information
application_idstring/nullCompat field derived from trigger_config.application_id
application_namestring/nullDisplay name from application trigger config
workspace_idstring/nullWorkspace ID
is_publicboolWhether it's public knowledge
is_readonlyboolWhether it's read-only
is_appliedboolWhether the workspace has subscribed
sourcestringKnowledge source, defaults to "custom"
forked_fromint/nullFork source knowledge ID, NULL means original
created_atintCreation timestamp (milliseconds)
updated_atintUpdate timestamp (milliseconds)

Trigger Enum (KnowledgeTrigger)

ValueDescriptiontrigger_config Requirement
smartSmart triggerNo config beyond application_id
alwaysAlways activeNo config beyond application_id
applicationApplication-boundMust provide application_id
serviceService-boundMust provide service_id
infrastructureInfrastructure-boundMust provide infrastructure_id
connectorConnector-boundMust provide connector_id
bridge_nodeBridge node-boundMust provide bridge_node_client_id
proxyProxy node-boundMust provide proxy_id
alertAlert-boundMust provide non-empty match_patterns array

KnowledgeType Enum

ValueDescriptiondata Requirement
defaultSimple knowledgeMust provide content field
documentDocument knowledgeMust provide document_content or document_id field

FilterOperator Enum

ValueDescription
eqExact match
includeAnyInclude any (OR)
excludeAnyExclude any
likeFuzzy match

Endpoint Details

List Knowledge

POST /personal/v1/knowledge/list
Authorization: Bearer <pat_token>
Content-Type: application/json

Request body:

FieldTypeRequiredDescription
filtersobjectNoFilter conditions
filters.nameFilterValueNoFilter by knowledge name
filters.typeFilterValueNoFilter by knowledge type
filters.triggerFilterValueNoFilter by trigger type
filters.labelsLabelFilterNoFilter by labels
filters.application_idFilterValueNoFilter by application_id
filters.service_idFilterValueNoFilter by service_id
filters.infrastructure_idFilterValueNoFilter by infrastructure_id
filters.connector_idFilterValueNoFilter by connector_id
filters.bridge_node_client_idFilterValueNoFilter by bridge_node_client_id
filters.proxy_idFilterValueNoFilter by proxy_id
filters.workspace_idFilterValueNoFilter by workspace_id
filters.is_publicFilterValueNoFilter by public status
filters.is_readonlyFilterValueNoFilter by read-only status
filters.sourceFilterValueNoFilter by source
sortobjectNoSort configuration
sort.order_bystringYesSort field
sort.orderstringYesSort direction: desc, asc
pageobjectNoPagination configuration
page.page_nointNoPage number, starts from 1, default 1
page.page_sizeintNoRecords per page, 1~200, default 20
include_publicboolNoInclude public knowledge, default false
context_visible_onlyboolNoUse context visible set only, default true

FilterValue structure:

FieldTypeRequiredDescription
operatorstringYesOperator: eq, includeAny, excludeAny, like
valuesarrayNoValues list for array operations
valuestringNoValue for single-value operations

LabelFilter structure:

FieldTypeRequiredDescription
operatorstringYesFilter operator
valuesarrayYesLabel filter item list
values.keystringYesLabel key
values.valuestring/nullNoLabel value, empty means match by key only

curl examples:

# List without filters
curl -s -X POST 'http://localhost:8000/personal/v1/knowledge/list' \
  -H 'Authorization: Bearer <pat_token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "page": {
      "page_no": 1,
      "page_size": 20
    },
    "sort": {
      "order_by": "created_at",
      "order": "desc"
    }
  }' | jq .

# Fuzzy search by name
curl -s -X POST 'http://localhost:8000/personal/v1/knowledge/list' \
  -H 'Authorization: Bearer <pat_token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "filters": {
      "name": {
        "operator": "like",
        "value": "alert"
      }
    },
    "page": {
      "page_no": 1,
      "page_size": 20
    }
  }' | jq .

# Filter by trigger type
curl -s -X POST 'http://localhost:8000/personal/v1/knowledge/list' \
  -H 'Authorization: Bearer <pat_token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "filters": {
      "trigger": {
        "operator": "eq",
        "value": "alert"
      }
    },
    "page": {
      "page_no": 1,
      "page_size": 50
    }
  }' | jq .

Get Knowledge Details

GET /personal/v1/knowledge/{id}
Authorization: Bearer <pat_token>

Path parameters:

ParameterTypeDescription
idintKnowledge primary key ID

curl example:

curl -s 'http://localhost:8000/personal/v1/knowledge/1' \
  -H 'Authorization: Bearer <pat_token>' | jq .

Response example:

{
  "code": 200,
  "message": "common.success",
  "data": {
    "id": 1,
    "name": "MySQL Connection Alert Handling",
    "type": "default",
    "trigger": "alert",
    "trigger_config": {
      "match_patterns": ["MySQL connection"]
    },
    "description": "Standard handling procedure for MySQL connection limit alerts",
    "data": {
      "content": "1. Log into MySQL and run SHOW PROCESSLIST\n2. Identify long-running transactions or slow queries\n3. Kill blocking sessions"
    },
    "labels": {"env": "prod"},
    "application_id": null,
    "application_name": null,
    "workspace_id": "wks-xxx",
    "is_public": false,
    "is_readonly": false,
    "is_applied": false,
    "source": "custom",
    "forked_from": null,
    "created_at": 1717000000000,
    "updated_at": 1717000000000
  }
}

Create Knowledge

POST /personal/v1/knowledge/create
Authorization: Bearer <pat_token>
Content-Type: application/json

Request body:

FieldTypeRequiredDescription
namestringYesKnowledge name, max 255 characters, cannot be empty or whitespace
typestringYesKnowledge type: default or document
triggerstringYesTrigger condition type
trigger_configobjectYesTrigger configuration, must match trigger type
descriptionstring/nullNoKnowledge description
dataobjectYesKnowledge content data
labelsobject/nullNoLabel key-value pairs, key cannot be empty
metadataobject/nullNoMetadata information

curl examples:

# Create simple knowledge (default type + alert trigger)
curl -s -X POST 'http://localhost:8000/personal/v1/knowledge/create' \
  -H 'Authorization: Bearer <pat_token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "MySQL Connection Alert Handling",
    "type": "default",
    "trigger": "alert",
    "trigger_config": {
      "match_patterns": ["MySQL connection"]
    },
    "description": "Standard handling procedure for MySQL connection limit alerts",
    "data": {
      "content": "1. Log into MySQL and run SHOW PROCESSLIST\n2. Identify long-running transactions or slow queries\n3. Kill blocking sessions"
    },
    "labels": {
      "env": "prod",
      "team": "dba"
    }
  }' | jq .

# Create application-triggered knowledge
curl -s -X POST 'http://localhost:8000/personal/v1/knowledge/create' \
  -H 'Authorization: Bearer <pat_token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Order Service Restart Procedure",
    "type": "document",
    "trigger": "application",
    "trigger_config": {
      "application_id": "app-order-service"
    },
    "data": {
      "document_content": "# Order Service Restart\n\n1. Confirm no pending orders\n2. Perform graceful shutdown\n3. Wait for health check to pass"
    }
  }' | jq .

Update Knowledge

POST /personal/v1/knowledge/update
Authorization: Bearer <pat_token>
Content-Type: application/json

All fields except id are optional. When updating data, type must also be provided. When updating trigger_config, trigger must also be provided.

Request body:

FieldTypeRequiredDescription
idintYesKnowledge primary key ID
namestring/nullNoKnowledge name
typestring/nullNoKnowledge type
triggerstring/nullNoTrigger condition type
trigger_configobject/nullNoTrigger config (must provide trigger along with it)
descriptionstring/nullNoKnowledge description
dataobject/nullNoKnowledge content data (must provide type along with it)
labelsobject/nullNoLabel key-value pairs
metadataobject/nullNoMetadata information

curl example:

# Update knowledge name and content
curl -s -X POST 'http://localhost:8000/personal/v1/knowledge/update' \
  -H 'Authorization: Bearer <pat_token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "id": 1,
    "name": "MySQL Connection Alert Handling v2",
    "type": "default",
    "data": {
      "content": "Updated handling procedure..."
    }
  }' | jq .

Upsert Knowledge

POST /personal/v1/knowledge/upsert
Authorization: Bearer <pat_token>
Content-Type: application/json

Uses name + trigger + trigger_config as the unique identifier. Updates if exists, creates if not.

Request body:

FieldTypeRequiredDescription
namestringYesKnowledge name
triggerstringYesTrigger condition type
trigger_configobjectYesTrigger configuration
typestring/nullNoKnowledge type
descriptionstring/nullNoKnowledge description
dataobject/nullNoKnowledge content data
labelsobject/nullNoLabel key-value pairs
metadataobject/nullNoMetadata information

curl example:

curl -s -X POST 'http://localhost:8000/personal/v1/knowledge/upsert' \
  -H 'Authorization: Bearer <pat_token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "MySQL Connection Alert Handling",
    "type": "default",
    "trigger": "alert",
    "trigger_config": {
      "match_patterns": ["MySQL connection"]
    },
    "data": {
      "content": "Latest handling procedure..."
    },
    "labels": {
      "env": "staging"
    }
  }' | jq .