Skip to content

Instance config API

A machine-to-machine API for self-hosted instances to poll the latest configuration (feature flags, announcements, limits, upgrade hints, support endpoints).

  • No browser session, no cookies
  • Responses are signed with the server’s Ed25519 private key; the public key is baked into the instance
  • The vast majority of calls should return 304
GET /openapi/v1/instances/self/config
Authorization: Bearer <instance_token>
X-Instance-Id: <uuid>
X-Request-Timestamp: <unix seconds>
Item Notes
instance_token Issued by the ops console, bound to instance_id, rotatable/revocable. Never hard-code it
Activation POST /openapi/v1/instances/activate exchanges license_key + instance_id for a token; the old token is invalidated
Replay protection `
{
"code": 0,
"data": {
"version": 42,
"issued_at": "2026-11-30T10:00:00Z",
"expires_at": "2026-12-07T10:00:00Z",
"signature": "base64(ed25519(payload))",
"payload": {
"features": { "community": true, "office": true },
"announcement": { "level": "info", "i18n": { "zh-CN": "…", "en": "…" } },
"limits": { "max_users": 50, "storage_gb": 200 },
"upgrade": { "latest": "0.1.240", "min_supported": "0.1.200" },
"endpoints": { "support": "https://support.pacasys.cloud" }
}
}
}
  • ETag: "<version>" on responses; send If-None-Match — 304 means unchanged
  • Cache-Control: private, max-age=300
  • Poll every 5–15 minutes with random jitter
Situation Instance behaviour
Network error / 5xx Keep using the cached config; never block the product
Signature mismatch Discard the response, keep the old config, log it
Config expired (expires_at) Still usable, but the admin UI warns “config not updated for N days”

Write the cache atomically (temp file + rename) to avoid half-written files.

  • /v1 is frozen: additive only; breaking changes go to /v2 with both versions for ≥ 6 months
  • Clients must ignore unknown fields
  • Rollouts are bucketed by instance_id (1% first), and every rollout is audited
payloadBytes = canonical JSON of data.payload (sorted keys, no extra whitespace)
ok = ed25519.verify(publicKey, payloadBytes, base64decode(data.signature))
if (!ok) → reject, keep the previous config

The ops console exposes the current public key at /aiapi-cloud/v1/ops/signing-key. The private seed lives only in the server’s SIGN_SEED_HEX — never rotate it, or every instance will reject new configs.