Caddy Admin API

Caddy exposes a RESTful administration API on localhost:2019 by default for dynamically loading and modifying server configuration at runtime without restarts. Endpoints support loading full JSON configs, traversing and mutating specific config paths, adapting Caddyfile to JSON, and querying PKI and reverse proxy state.

API entry from apis.yml

apis.yml Raw ↑
aid: caddy:caddy-admin-api
name: Caddy Admin API
description: Caddy exposes a RESTful administration API on localhost:2019 by default for dynamically loading
  and modifying server configuration at runtime without restarts. Endpoints support loading full JSON
  configs, traversing and mutating specific config paths, adapting Caddyfile to JSON, and querying PKI
  and reverse proxy state.
humanURL: https://caddyserver.com/docs/api
baseURL: http://localhost:2019
tags:
- Admin API
- Configuration
- REST
properties:
- type: Documentation
  url: https://caddyserver.com/docs/api
- type: JSON Config Structure
  url: https://caddyserver.com/docs/json/
- type: Modules Reference
  url: https://caddyserver.com/docs/modules/
- type: API Tutorial
  url: https://caddyserver.com/docs/api-tutorial
x-features:
- POST /load for full config replacement
- GET/POST/PUT/PATCH/DELETE /config/[path] for granular updates
- POST /adapt to convert Caddyfile to JSON without loading
- POST /stop for graceful shutdown
- GET /pki/ca/{id} for internal CA inspection
- GET /reverse_proxy/upstreams for upstream status
- ETag and If-Match concurrency control
x-use-cases:
- Dynamic configuration in orchestrated environments
- Multi-tenant SaaS with per-tenant routes
- Zero-downtime config changes
- Integration with service discovery
- Observability of upstream health