Skip to content

Management API

Purpose

Management endpoints let an integration configure Kitemesh objects through the public API: secrets, tools, API resources, files, custom models, and group models.

Use them only with API tokens that need to change configuration. Keep these capabilities disabled for chat-only integrations.

Authentication and capabilities

All endpoints require:

http
Authorization: Bearer km_your_token_here

The token must belong to the team where the objects are managed. It must also have the matching capability:

ResourceRequired capability
SecretsmanageSecrets
ToolsmanageTools
API resourcesmanageResources
FilesuploadFiles for upload; resource access for read and delete
Custom modelsmanageCustomModels
Group modelsmanageGroups

Share scopes must also be allowed by the token scope policy. A share scope has this shape:

json
{
  "type": "team",
  "id": "123e4567-e89b-12d3-a456-426614174000"
}

Accepted type values are team, customModel, and groupModel.

List endpoints

List endpoints return objects visible to the token. Pagination fields depend on the resource family.

EndpointUseful query fields
GET /v1/secretsscope, teamId, q, limit, cursor
GET /v1/toolsscopeType, scopeId, page, pageSize
GET /v1/api-resourcesscopeType, scopeId, page, pageSize
GET /v1/filesscopeType, scopeId, resourceType, status, search, page, pageSize
GET /v1/custom-modelsscope, teamId, search, category, tags, sort, credentialMode, limit, cursor
GET /v1/group-modelsscope, teamId, search, category, tags, sort, mode, limit, cursor

Common limits:

  • limit: 1 to 100 on secrets and model lists
  • pageSize: 1 to 100 on tools, API resources, and files
  • scope: mine, team, public, or all on model lists
  • sort: updated, created, name, or author on model lists

Secrets

Secrets store sensitive values used by tools and BYOK custom models. Secret values can be written or rotated, but clients should not expect list and read responses to reveal the value.

Method and pathPurpose
POST /v1/secretscreate a secret
GET /v1/secretslist visible secrets
PATCH /v1/secrets/:idupdate metadata or rotate the value
DELETE /v1/secrets/:iddelete a secret

Create fields:

FieldTypeRequiredNotes
namestringyes1 to 160 characters
descriptionstringnoup to 2000 characters
providerstringnoup to 80 characters
scopestringyesuser or team
teamIdstringnoUUID; required for a team-scoped secret
valuestringyessecret value

Update accepts name, description, provider, and value.

bash
curl -X POST "https://your-kitemesh.example.com/v1/secrets" \
  -H "Authorization: Bearer km_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Customer API key",
    "provider": "customer-api",
    "scope": "team",
    "teamId": "123e4567-e89b-12d3-a456-426614174000",
    "value": "secret_value_here"
  }'

Tools

Tools are HTTP actions. Use them for operations that create, update, or delete data, or for reads that need user approval controls.

Method and pathPurpose
POST /v1/toolscreate a tool
GET /v1/toolslist visible tools
GET /v1/tools/:idread one tool
PATCH /v1/tools/:idupdate a tool
DELETE /v1/tools/:iddelete a tool

Create fields:

FieldTypeRequiredNotes
namestringyes1 to 120 characters
descriptionstringyes1 to 4000 characters
methodstringyesPOST, PATCH, PUT, or DELETE
needUserValidationbooleannodefaults to true when omitted
argsSchemaobjectnoJSON schema-like object for arguments
urlTemplatestringyestarget URL template
staticHeadersNonSecretobjectnonon-secret headers only
timeoutMsintegerno0 to 120000
authFieldsarraynoentries with key and secretId
scopesarraynoshare scopes
tagsarray<string>notag labels
versionstringnocaller-defined version label

Update accepts the mutable tool fields. method, scopes, tags, and version are create-time fields for the public contract.

bash
curl -X POST "https://your-kitemesh.example.com/v1/tools" \
  -H "Authorization: Bearer km_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Create support ticket",
    "description": "Creates a support ticket for the current customer.",
    "method": "POST",
    "needUserValidation": true,
    "urlTemplate": "https://api.example.com/tickets",
    "argsSchema": {
      "type": "object",
      "properties": {
        "priority": { "type": "string" },
        "summary": { "type": "string" }
      },
      "required": ["summary"]
    },
    "authFields": [
      {
        "key": "Authorization",
        "secretId": "123e4567-e89b-12d3-a456-426614174222"
      }
    ],
    "scopes": [
      {
        "type": "groupModel",
        "id": "123e4567-e89b-12d3-a456-426614174000"
      }
    ]
  }'

API resources

API resources expose read-only HTTP context. They are GET resources and are separate from action tools.

Method and pathPurpose
POST /v1/api-resourcescreate an API resource
GET /v1/api-resourceslist visible API resources
GET /v1/api-resources/:idread one API resource
PATCH /v1/api-resources/:idupdate an API resource
DELETE /v1/api-resources/:iddelete an API resource

Create fields:

FieldTypeRequiredNotes
namestringyes1 to 120 characters
descriptionstringyes1 to 4000 characters
urlTemplatestringyesGET URL template
staticHeadersNonSecretobjectnonon-secret headers only
timeoutMsintegerno0 to 120000
cacheTtlSecondsintegerno0 or greater
scopesarraynoshare scopes

Update accepts name, description, urlTemplate, staticHeadersNonSecret, timeoutMs, and cacheTtlSeconds.

Files

Files are uploaded as multipart form data. The form must contain one file part and one metadata field containing JSON.

Method and pathPurpose
POST /v1/filesupload a file
GET /v1/fileslist visible files
GET /v1/files/vectorization-statusread processing status for one or more files
GET /v1/files/:idread one file resource
DELETE /v1/files/:iddelete one file resource

metadata fields:

FieldTypeRequiredNotes
resourceTypestringyestext, image, audio, or video
scopestringnouser or conversation
conversationIdstringnoUUID for a conversation-scoped upload
scopesarraynoshare scopes
fileNamestringnoup to 255 characters

The default upload limit is 5 MB. The metadata field is limited to 64 KB by default.

bash
curl -X POST "https://your-kitemesh.example.com/v1/files" \
  -H "Authorization: Bearer km_your_token_here" \
  -F "file=@./brief.pdf" \
  -F 'metadata={
    "resourceType": "text",
    "scope": "user",
    "fileName": "brief.pdf",
    "scopes": [
      {
        "type": "groupModel",
        "id": "123e4567-e89b-12d3-a456-426614174000"
      }
    ]
  }'

GET /v1/files/vectorization-status accepts ids as a comma-separated query parameter or repeated query parameter:

http
GET /v1/files/vectorization-status?ids=123e4567-e89b-12d3-a456-426614174000,123e4567-e89b-12d3-a456-426614174111

File statuses include pending, vectorizing, ready, failed, and deleting.

Custom models

Custom models wrap an LLM with reusable instructions, visibility, and credential settings.

Method and pathPurpose
POST /v1/custom-modelscreate a custom model
GET /v1/custom-modelslist visible custom models
GET /v1/custom-models/:idread one custom model
PATCH /v1/custom-models/:idupdate a custom model
DELETE /v1/custom-models/:iddelete a custom model

Create fields:

FieldTypeRequiredNotes
namestringyes1 to 200 characters
llmModelNamestringyesmodel name
descriptionstringnoup to 2000 characters
categorystringnoup to 80 characters
tagsarray<string>noeach tag up to 64 characters
defaultSystemInstructionstringnoup to 20000 characters
isPublicbooleannopublic visibility flag
teamIdsarray<string>noUUIDs of teams with access
credentialModestringnoapp or byok
byokSecretIdstringnoUUID of a vault secret for BYOK

The same fields are accepted on update, with all fields optional.

Use the created model in chat with model: "custom:<uuid>".

Group models

Group models combine a brain target, optional agents, and a default mode.

Method and pathPurpose
POST /v1/group-modelscreate a group model
GET /v1/group-modelslist visible group models
GET /v1/group-models/:idread one group model
PATCH /v1/group-models/:idupdate a group model
DELETE /v1/group-models/:iddelete a group model

Create fields:

FieldTypeRequiredNotes
namestringyes1 to 200 characters
descriptionstringnoup to 2000 characters
categorystringnoup to 80 characters
tagsarray<string>noeach tag up to 64 characters
iconstringnosupported icon name
defaultModestringyesorch, synth, normal, or auto
brainobjectyesmodel reference
agentsarraynoagent references
isPublicbooleannopublic visibility flag
teamIdsarray<string>noUUIDs of teams with access

Supported icon values are account_tree, forum, travel_explore, edit_note, monitoring, gavel, school, smart_toy, support_agent, campaign, analytics, and history_edu.

brain and agents[].ref use model references:

json
{
  "type": "llm",
  "llmModelName": "gpt-5-mini"
}

Agent entries can also include:

FieldTypeNotes
rolestring1 to 64 characters
instructionOverridestringup to 20000 characters

GET /v1/group-models/:id accepts resolve=none, resolve=shallow, or resolve=deep. Resolution adds readable details for model references when the token can access them.

bash
curl -X POST "https://your-kitemesh.example.com/v1/group-models" \
  -H "Authorization: Bearer km_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Research group",
    "defaultMode": "auto",
    "brain": {
      "type": "llm",
      "llmModelName": "gpt-5-mini"
    },
    "agents": [
      {
        "ref": {
          "type": "custom",
          "customModelId": "123e4567-e89b-12d3-a456-426614174111"
        },
        "role": "researcher"
      }
    ],
    "teamIds": [
      "123e4567-e89b-12d3-a456-426614174000"
    ]
  }'

Use the created group in chat with model: "group:<uuid>".