Documentation Index
Fetch the complete documentation index at: https://mintlify.com/traefik/traefik/llms.txt
Use this file to discover all available pages before exploring further.
REST API
Traefik exposes a comprehensive REST API for querying runtime configuration, monitoring routers, services, middlewares, and more.Overview
The Traefik API provides access to:- Runtime configuration of routers, services, and middlewares
- Entry points and their configurations
- TCP and UDP router information
- Health and status information
- Debug and profiling endpoints (when enabled)
The API is disabled by default and must be explicitly enabled in the static configuration.
Security Considerations
Never Expose Publicly
The API exposes sensitive configuration data including:
- Service endpoints and backends
- Middleware configurations
- TLS certificate information
- Provider details
Use Authentication
Always secure the API with authentication middleware:
- Basic Authentication
- Digest Authentication
- Forward Authentication
- IP Allow Lists
Configuration
Enable the API
Enable the API in your static configuration:api@internal that can be referenced in routers.
Secure Mode (Recommended)
Create a router with authentication to access the API:The router rule must match the
/api path prefix. Using a Host rule is recommended as it matches all paths on that host.Insecure Mode
For development and testing only:traefik entry point (default port 8080) at http://<traefik-ip>:8080/api/
Insecure mode is not recommended for production and does not support authentication middleware.
Configuration Options
Enable additional debug endpoints under Exposes Go profiling endpoints like
/debug/ for profiling and diagnostics./debug/pprof/.Enable API in insecure mode on the
traefik entry point.Customize the base path for API and dashboard endpoints.This serves the API at
/traefik/api and dashboard at /traefik/dashboard.API Endpoints
All endpoints acceptGET requests and return JSON responses.
HTTP Routers
List all HTTP routers with their configuration and status.Response:
Get details of a specific HTTP router.Example:
/api/http/routers/my-router@dockerResponse:HTTP Services
List all HTTP services.Response:
Get details of a specific HTTP service.Example:
/api/http/services/my-service@dockerHTTP Middlewares
List all HTTP middlewares.Response:
Get details of a specific HTTP middleware.
TCP Routers
List all TCP routers.Response:
Get details of a specific TCP router.
TCP Services
List all TCP services.
Get details of a specific TCP service.
TCP Middlewares
List all TCP middlewares.
Get details of a specific TCP middleware.
UDP Routers
List all UDP routers.
Get details of a specific UDP router.
UDP Services
List all UDP services.
Get details of a specific UDP service.
Entry Points
List all entry points.Response:
Get details of a specific entry point.
Overview
Get statistical overview of routers, services, middlewares, features, and providers.Response:
Raw Data
Get complete runtime configuration including all routers, services, middlewares, and their relationships.Response:
Support Dump
Generate a support dump archive containing anonymized static and runtime configuration.Response: Archive file downloadUseful for troubleshooting and support requests.
Version
Get Traefik version information.Response:
Pagination
List endpoints support pagination using query parameters:Page number to retrieve.
Number of results per page.
X-Next-Page: Page number of the next page (if available)
Debug Endpoints
Whenapi.debug=true is enabled, additional debugging endpoints are available:
Expvar data showing internal variables.See Go expvar documentation.
pprof index page for profiling.See Go pprof documentation.
Command line arguments.
CPU profile (add
?seconds=30 for duration).Symbol lookup.
Execution trace.
Debug endpoints should never be exposed publicly as they can expose sensitive information and impact performance.
Usage Examples
Query All HTTP Routers
Get Specific Service Details
Check System Overview
Monitor Router Status
Export Configuration
Source Code References
- API Handler:
pkg/api/handler.go:84-126 - HTTP Routers:
pkg/api/handler_http.go:72-127 - Overview Endpoint:
pkg/api/handler_overview.go:40-67 - Dashboard Integration:
pkg/api/dashboard/dashboard.go:66-127