Skip to main content

Settings & Auth API

Manage profile settings, create presets for quick configuration switching, and control global authentication tokens for CLIProxy.

Overview

Settings endpoints provide:
  • Profile settings CRUD (Create, Read, Update, Delete)
  • Preset management for model configurations
  • Global auth token management (API key, management secret)
  • Token regeneration and reset
  • Conflict detection with optimistic locking

Authentication

All endpoints are available on localhost only (http://localhost:3000). No authentication required.

Profile Settings

GET /api/settings/:profile

Get settings for a profile with masked API keys. Path Parameters:
  • profile: Profile name or variant (e.g., gemini, glm, agy)
Note: Sensitive keys (API tokens, secrets) are automatically masked with ********.

GET /api/settings/:profile/raw

Get full unmasked settings for editing.
Sensitive endpoint - returns unmasked API keys. Use for editing only.

PUT /api/settings/:profile

Update settings with conflict detection and automatic backup. Path Parameters:
  • profile: Profile name or variant
Request Body:
  • settings (required): Settings object with env field
  • expectedMtime (optional): Timestamp for optimistic locking
Features:
  • Optimistic Locking: Uses expectedMtime to detect concurrent edits
  • Automatic Backup: Creates backup before modification in ~/.ccs/backups/
  • Atomic Write: Temp file + rename for crash safety
  • Validation Warning: Alerts if required fields missing (non-blocking)

Presets

GET /api/settings/:profile/presets

Get saved presets for a profile.

POST /api/settings/:profile/presets

Create a new preset configuration. Request Body:
  • name (required): Preset name
  • default (required): Default model
  • opus (optional): Opus tier model
  • sonnet (optional): Sonnet tier model
  • haiku (optional): Haiku tier model

DELETE /api/settings/:profile/presets/:name

Delete a preset by name.

Global Auth Tokens

GET /api/settings/auth/tokens

Get current auth token status with masked values.
Fields:
  • isCustom: true if user-provided, false if default

GET /api/settings/auth/tokens/raw

Get unmasked auth tokens.
Sensitive endpoint - returns unmasked secrets. No caching headers applied.

PUT /api/settings/auth/tokens

Update global auth tokens and regenerate CLIProxy config. Request Body:
  • apiKey (optional): New API key (empty string to reset to default)
  • managementSecret (optional): New management secret
Changes require CLIProxy restart to take effect. Config is regenerated automatically.

POST /api/settings/auth/tokens/regenerate-secret

Generate a new 32-character management secret.

POST /api/settings/auth/tokens/reset

Reset auth tokens to defaults.

Account Management

DELETE /api/accounts/reset-default

Reset default account to CCS default.

Error Responses

Shared Data Endpoints

Available since v7.48.0

GET /api/shared/commands

List all shared commands with descriptions.

GET /api/shared/skills

List all shared skills with descriptions.

GET /api/shared/agents

List all shared agents with descriptions.

GET /api/shared/content

Load full markdown content for a shared item. Query Parameters:
  • type: commands | skills | agents
  • path: Item path

GET /api/shared/summary

Get counts and symlink status for all shared data types.

Droid Endpoints

Available since v7.48.0

GET /api/droid/diagnostics

Get Factory Droid binary detection and configuration status.

GET /api/droid/settings

Read ~/.factory/settings.json with diagnostics.

PUT /api/droid/settings

Write to ~/.factory/settings.json with atomic write and mtime conflict detection. Request Body:
  • content: JSON string of settings
  • expectedMtime (optional): Optimistic locking timestamp

Config Endpoints

Available since v7.49.0

GET /api/config

Get current CCS config.yaml as JSON.

PUT /api/config

Update config.yaml with validation and conflict detection.

Security Features

  • API Key Masking: Automatic masking for display endpoints
  • Optimistic Locking: mtime-based conflict detection prevents data loss
  • Atomic Writes: Temp file + rename ensures crash safety
  • Automatic Backups: Previous settings saved before updates
  • No Cache Headers: Sensitive endpoints (/raw, /auth/tokens/raw) prevent caching
  • Localhost Only: API only accessible on 127.0.0.1