Using the Admin API
The Caddy Admin API allows you to manage your server at runtime without restarts. It provides full control over configuration, certificates, and server state.Admin Endpoint
By default, the admin API listens onlocalhost:2019:
Custom Listen Address
Change the admin endpoint address:The admin endpoint can be configured via the
CADDY_ADMIN environment variable, which defaults to localhost:2019.Disable Admin API
Configuration Management
Get Current Config
Retrieve the entire configuration:Load Configuration
Replace the entire configuration:Update Specific Path
Modify a specific configuration path:PATCH vs POST vs PUT
- GET - Retrieve configuration
- POST - Add to an array or create if doesn’t exist
- PUT - Create new value (fails if exists)
- PATCH - Update existing value (fails if doesn’t exist)
- DELETE - Remove configuration
Using @id for Easier Access
Identify configuration objects with@id for cleaner API paths:
Common Operations
Add a New Site
Update Upstream Servers
Reload Certificates
Trigger certificate renewal:Security
Origin Enforcement
Protect against DNS rebinding attacks:Remote Admin (TLS)
Secure the admin endpoint with mutual TLS:Remote admin requires identity management to be configured. The endpoint uses mutual TLS for authentication.