Skip to main content

Config API

Manage agent configuration with automatic versioned backups. The system keeps the last 10 configuration backups and allows restoring to any previous version.

Get current configuration

GET /api/config
Returns the current agent configuration and a list of available backups.

Response

{
  "config": {
    "version": "2026.3.23",
    "model": {
      "default": "openrouter/auto",
      "fallbacks": ["openrouter/anthropic/claude-3.5-sonnet"]
    },
    "channels": {
      "telegram": { "enabled": true },
      "discord": { "enabled": false },
      "webchat": { "enabled": true }
    },
    "memory": { "maxEntries": 1000, "ttlDays": 90 },
    "cron": { "heartbeatIntervalMinutes": 30 },
    "safety": { "maxTokensPerDay": 100000, "allowedDomains": [] }
  },
  "backups": [
    {
      "id": "bkp_initial",
      "timestamp": "2026-03-27T10:00:00Z"
    }
  ]
}
FieldTypeDescription
configobjectThe current agent configuration
backupsarrayList of available backups (id and timestamp only)
backups[].idstringUnique backup identifier
backups[].timestampstringISO 8601 timestamp when the backup was created

Save configuration

POST /api/config
Saves a new configuration. The current configuration is automatically backed up before the new one is applied. The system retains the 10 most recent backups.

Request body

FieldTypeRequiredDescription
configobjectYesThe new configuration object to save. Must be a valid JSON object.

Response

{
  "success": true,
  "config": { ... },
  "backupId": "bkp_1711540800000",
  "backups": [
    { "id": "bkp_1711540800000", "timestamp": "2026-03-27T12:00:00Z" },
    { "id": "bkp_initial", "timestamp": "2026-03-27T10:00:00Z" }
  ]
}
FieldTypeDescription
successbooleantrue when the configuration was saved
configobjectThe newly saved configuration
backupIdstringIdentifier of the backup created from the previous configuration
backupsarrayUpdated list of available backups (id and timestamp only)

Errors

CodeDescription
400Invalid config object — the config field is missing or is not an object
400Config is not valid JSON — the config object cannot be serialized as valid JSON
400Invalid request body — the request body is not valid JSON

Restore a backup

PUT /api/config
Restores a previous configuration from a backup. The current configuration is automatically backed up before the restore is applied.

Request body

FieldTypeRequiredDescription
backupIdstringYesThe identifier of the backup to restore

Response

{
  "success": true,
  "config": { ... },
  "restoredFrom": "bkp_initial",
  "backups": [
    { "id": "bkp_1711540800001", "timestamp": "2026-03-27T12:05:00Z" },
    { "id": "bkp_initial", "timestamp": "2026-03-27T10:00:00Z" }
  ]
}
FieldTypeDescription
successbooleantrue when the configuration was restored
configobjectThe restored configuration
restoredFromstringIdentifier of the backup that was restored
backupsarrayUpdated list of available backups (id and timestamp only)

Errors

CodeDescription
400Missing backupId — the backupId field is missing from the request body
400Invalid request body — the request body is not valid JSON
404Backup not found — no backup exists with the given identifier

Example: save and restore

# Save a new configuration
curl -X POST https://agentbot.raveculture.xyz/api/config \
  -H "Content-Type: application/json" \
  -d '{
    "config": {
      "version": "2026.3.23",
      "model": { "default": "openrouter/auto", "fallbacks": [] },
      "channels": { "telegram": { "enabled": true } },
      "memory": { "maxEntries": 500, "ttlDays": 30 },
      "cron": { "heartbeatIntervalMinutes": 15 },
      "safety": { "maxTokensPerDay": 50000, "allowedDomains": [] }
    }
  }'

# Restore from a backup
curl -X PUT https://agentbot.raveculture.xyz/api/config \
  -H "Content-Type: application/json" \
  -d '{ "backupId": "bkp_initial" }'