Skip to content

Configuration API Config

API endpoints for configuration management.

Get Configuration

GET /api/config

Get current configuration.

Response:

json
{
  "success": true,
  "data": {
    "commandPrefix": "#",
    "debug": false,
    "trigger": {
      "private": "always",
      "group": "at"
    },
    "context": {
      "maxMessages": 20
    }
  }
}

Update Configuration

PUT /api/config

Update configuration values.

Request:

json
{
  "debug": true,
  "trigger": {
    "group": "prefix",
    "prefix": "#ai"
  }
}

Response:

json
{
  "success": true,
  "data": {
    "updated": ["debug", "trigger.group", "trigger.prefix"]
  }
}

Get Config Section

GET /api/config/:section

Get specific config section.

Sections: trigger, context, memory, channels, tools

Response:

json
{
  "success": true,
  "data": {
    "private": "always",
    "group": "at",
    "prefix": "#chat"
  }
}

Update Config Section

PUT /api/config/:section

Update specific section.

Request:

json
{
  "maxMessages": 30,
  "cleaningStrategy": "sliding"
}

Reload Configuration

POST /api/config/reload

Reload configuration from files.

Response:

json
{
  "success": true,
  "message": "Configuration reloaded"
}

Export Configuration

GET /api/config/export

Export full configuration as YAML.

Response:

yaml
commandPrefix: "#"
debug: false
trigger:
  private: always
  group: at
...

Import Configuration

POST /api/config/import

Import configuration from YAML.

Request:

Content-Type: text/yaml

commandPrefix: "#"
debug: false
...

Response:

json
{
  "success": true,
  "data": {
    "imported": true,
    "changes": 15
  }
}

Validate Configuration

POST /api/config/validate

Validate configuration without applying.

Request:

json
{
  "channels": [
    {
      "name": "test",
      "baseUrl": "invalid-url"
    }
  ]
}

Response:

json
{
  "success": false,
  "errors": [
    {
      "path": "channels[0].baseUrl",
      "message": "Invalid URL format"
    }
  ]
}

Error Codes

CodeDescription
INVALID_CONFIGConfig validation failed
SECTION_NOT_FOUNDSection doesn't exist
PARSE_ERRORFailed to parse YAML

Next Steps

Released under the MIT License