HTTP API: plugin instances
Part of the HTTP API reference. The underlying model is described in Bot → Plugin instances.
Listing instances
Section titled “Listing instances”GET /api/v1/servers/{server}/plugins (moderator, paged: sort name
(default), instance, bot, version, health, source; filter updates=true|false;
without limit every instance is returned):
{ "items": [ { "bot": "moderator", "instance": "welcome", "server": "ma-commu", "plugin": { "name": "welcome", "version": "0.1.0", "displayName": "Welcome", "description": "…", "capabilities": ["discord.messages.send"], "intents": ["ServerMembers"] }, "config": { "channel": "general", "message": "…" }, // effective config (defaults applied) "schema": { /* the plugin's config.schema.json as written */ }, "baseConfig": { "channel": "general" }, // spec.plugins[].config as written "override": { "message": "…" }, // overrides.<server>.config, or null "editable": ["message"], // fields this user may edit (x-cicord-access) "commands": [ { "name": "welcome-preview", "description": "…" } ], "routes": ["GET /steps", "POST /complete"], // portal routes "health": "Healthy", "message": "", "source": "cicord", // "cicord" (official catalog), a registry name, or "local" (written in the repo) "trust": "official", // official | unofficial | local "update"?: PluginUpdate // a newer version is available (Store)} ], "total": 1, "offset": 0, "limit": 1, "sort": "name", "order": "asc" }schemais the schema file’s JSON with its key order preserved ({"type": "object"}when the plugin has none).baseConfigandoverrideare written values, without defaults.editable: admins may edit every top-level property; moderators only those markedx-cicord-access: moderator(defaultadmin). Sorted.update(aPluginUpdate) comes from the runtime’s cache only (no fetch on this endpoint): registry versions are known once the background refresh or a Store page has looked them up.
GET /api/v1/servers/{server}/plugins/{bot}/{instance} (moderator) returns one item (the
admin console’s per-plugin page); unknown: 404.
Editing the config
Section titled “Editing the config”PUT /api/v1/servers/{server}/plugins/{bot}/{instance}/config (moderator, field-restricted).
Request: {"config": {...}, "scope": "server" | "base", "revision": "<active revision id>"}
configmust be a JSON object (400);scopemust beserverorbase(400); an unknown bot or instance on that server answers404.scope: "server"(default) writes the server override (overrides.<server>.configinbot.yaml) as the minimal merge patch from the base config;"base"writesconfig.configis the full desired config with the fields the user sees (defaults included). Forscope: "server"the runtime diffs it against the base config with defaults applied and writes only the difference (nullremoves a base field; deletions of fields absent from the base are dropped); an empty difference removes the override. For"base", fields that only restate a schema default and were not written before are dropped. Comments and key order are kept.- Authorization is checked on the top-level fields whose effective value changes:
moderators may only change fields listed in
editable; any other change answers403("you may not change: a, b").scope: "base"changes every server the instance runs on: the caller must be at least moderator on each of them where the effective config changes, and the field restriction applies per server. - The config is validated (schema and
x-cicord-ref, the same rules ascicord validate) on every affected server before anything is written:422with{"error": {"code": "invalid", …, "diagnostics": [Diagnostic]}}. revision(optional) must be the active revision ID, otherwise409 conflict(reload and retry). A write-back conflict (the branch moved and the patch no longer applies) is also409.- An unchanged config writes nothing and returns
{"mode": "commit", "revision": <active>}. modecomes from thecicord.yamlwriteBack.policiesfor the bot file.writeBack.enabled: falseanswers403; no writer configured, or a failed write-back,503. Write-backs are serialized.- In
commitmode the runtime is triggered at once and the response waits (at most 20 seconds) for the new revision to be active;revisionis then the active revision ID. When the new revision does not become active in time (or is rejected),revisionis the ID reported by the writer, and the new revision may still be pending or rejected (see/statuslastError). - Every write is audited (
config.update, target<bot>/<instance>, details{scope, fields, mode, revision, pullRequestUrl}). Commits carry the trailersCicord-Actor: discord:<id> (<name>)andCicord-Source: admin-ui.
Response 200:
{ "mode": "commit", "revision": "9a1b2c3", "pullRequestUrl": "" }// mode "pullRequest": revision is "" and pullRequestUrl is set; nothing is applied yet.Uninstalling
Section titled “Uninstalling”DELETE /api/v1/servers/{server}/plugins/{bot}/{instance} (admin) uninstalls an instance
from the server:
- An instance that also runs on other servers only loses this one (its
serverslist and itsoverrides.<server>go):removed: false. - Otherwise it is deleted from
bot.yaml(removed: true). When no other instance uses the plugin, itscicord.lockentry (registry plugin) or itsplugins/<name>/directory (copied by the Store or the wizard) goes too, listed incleaned. Plugins written in the repository elsewhere are never deleted. Plugin data (KV) is kept. - The change is validated on a copy of the active revision first (
422 invalidwhen something depends on it). Mode, activation wait and errors are those of a configPUT. Auditplugin.uninstall.
{ "removed": true, "cleaned": ["cicord.lock: acme/xp"], "mode": "commit", "revision"?: "…", "pullRequestUrl"?: "…" }