Create a new Caddy API client
Client configuration options
Adapt a configuration from one format to another Commonly used to convert Caddyfile to JSON configuration.
The configuration content to adapt
The adapter to use (e.g., "caddyfile")
The adapted configuration as JSON
Add a route to a server
Server name
Route configuration
True if route was added, false if already exists
Add multiple routes to a server (convenience method to avoid loops) This method adds routes one at a time and handles idempotency for each.
Server name
Array of routes to add
Object with counts of added and skipped routes
Get current Caddy configuration
Full Caddy configuration as JSON
Get routes for a specific server
Server name (e.g., "https_server")
Array of routes
Get configuration for a specific server
Server name
Server configuration object
Get information about all servers
Server configurations
Get reverse proxy upstream status Returns the current state of all configured upstream servers.
Array of upstream server status objects
Get Caddy version information
Version information
Insert a route at a specific position in the server's route list
Server name
Route to insert
Where to insert the route
void
Replace all routes for a server (PATCH)
Server name
Array of routes
Patch server configuration
Server configuration object
Reload Caddy configuration
Remove routes matching a hostname
Hostname to match
Server name
Number of routes removed
Replace a route by its
Server name
Route
New route configuration
true if route was found and replaced, false otherwise
Client for interacting with Caddy Admin API