Skip to content

API

Traefik Enterprise exposes information, and the status of a cluster through its API.

!!! danger 'Sensitive Information' Enabling the API should be done with caution, as it will expose all configuration, which may include sensitive data. In production, the API should be secured with authentication and authorization.

Configuration

If you enable the API, a new special service named api@internal is created and can be referenced in a router.

To enable the API, use the provided option in the static configuration:

# [...]
entrypoints:
  # [...]
  internal:
    address: ":8888"

api:
  dashboard: true
# [...]
[entryPoints]
  # [...]
  [entryPoints.internal]
    address = ":8888"

[api]
  dashboard = true

Once the API has been enabled in the static configuration, a route configuration can be defined in the dynamic configuration:

labels:
  - "traefik.http.routers.api.rule=Host(`traefikee.domain.org`)"
  - "traefik.http.routers.api.service=api@internal"
  - "traefik.http.routers.api.entrypoints=internal"
  - "traefik.http.routers.api.middlewares=auth"
  - "traefik.http.middlewares.auth.basicauth.users=test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/" # user: test password:test
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: ingressroute
spec:
  entryPoints:
    - internal
  routes:
    - match: Host(`traefikee.domain.org`)
      kind: Rule
      services:
        - name: api@internal
      middlewares:
        - name: auth
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: auth
spec:
  basicAuth:
    secret: authsecret

---
apiVersion: v1
kind: Secret
metadata:
  name: authsecret
  namespace: default

data:
  users: |2
    dGVzdDokYXByMSRINnVza2trVyRJZ1hMUDZld1RyU3VCa1RycUU4d2ov
- "traefik.http.routers.api.rule=Host(`traefikee.domain.org`)"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.entrypoints=internal"
- "traefik.http.routers.api.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/" # user: test password:test
"labels": {
  "traefik.http.routers.api.rule=Host(`traefikee.domain.org`)"
  "traefik.http.routers.api.service=api@internal"
  "traefik.http.routers.api.entrypoints=internal"
  "traefik.http.routers.api.middlewares=auth"
  "traefik.http.middlewares.auth.basicauth.users=test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/" # user: test password:test
}
labels:
  - "traefik.http.routers.api.rule=Host(`traefikee.domain.org`)"
  - "traefik.http.routers.api.service=api@internal"
  - "traefik.http.routers.api.entrypoints=internal"
  - "traefik.http.routers.api.middlewares=auth"
  - "traefik.http.middlewares.auth.basicauth.users=test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/" # user: test password:test
http:
  routers:
    api:
      rule: Host(`traefikee.domain.org`)
      service: api@internal
      entryPoints:
        - internal
      middlewares:
        - auth
  middlewares:
    auth:
      basicAuth:
        users:
          - "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/" # user: test password:test
[http.routers.api]
  rule = "Host(`traefikee.domain.org`)"
  service = "api@internal"
  middlewares = ["auth"]
  entryPoints = ["internal"]

[http.middlewares.auth.basicAuth]
  users = [
    "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", # user: test password:test
  ]

insecure

Optional, Default=false

Enable the API in insecure mode, which means that the API will be available directly on the entryPoint named traefik.

Info

If the entryPoint named traefik is not configured, it will be automatically created on port 8080.

[api]
  insecure = true
api:
  insecure: true

dashboard

Optional, Default=true

Enable the dashboard. More about the dashboard features here.

[api]
  dashboard = true
api:
  dashboard: true

debug

Optional, Default=false

Enable additional endpoints for debugging and profiling, served under /debug/.

[api]
  debug = true
api:
  debug: true

Endpoints

All the following endpoints must be accessed with a GET HTTP request.

Path Description
/api/cluster/overview Returns information about the cluster.
/api/cluster/nodes Lists all nodes in the cluster.
/api/cluster/license Returns information about the cluster license.
/api/cluster/errors Lists all errors related to the cluster.
/api/cluster/notification Returns information about license expiry.
/api/http/routers Lists all the HTTP routers information.
/api/http/routers/{name} Returns the information about the HTTP router specified by name.
/api/http/services Lists all the HTTP services information.
/api/http/services/{name} Returns the information about the HTTP service specified by name.
/api/http/middlewares Lists all the HTTP middlewares information.
/api/http/middlewares/{name} Returns the information about the HTTP middleware specified by name.
/api/tcp/routers Lists all the TCP routers information.
/api/tcp/routers/{name} Returns the information about the TCP router specified by name.
/api/tcp/services Lists all the TCP services information.
/api/tcp/services/{name} Returns the information about the TCP service specified by name.
/api/udp/routers Lists all the UDP routers information.
/api/udp/routers/{name} Returns the information about the UDP router specified by name.
/api/udp/services Lists all the UDP services information.
/api/udp/services/{name} Returns the information about the UDP service specified by name.
/api/mesh/services Lists all the UDP services information.
/api/mesh/services/{id} Returns the information about the UDP service specified by id.
/api/mesh/errors Lists all the Mesh errors.
/api/mesh/overview Returns the information about the Mesh service.
/api/entrypoints Lists all the entry points information.
/api/entrypoints/{name} Returns the information about the entry point specified by name.
/api/overview Returns statistic information about http, tcp and udp as well as enabled features and providers.
/api/errors Returns errors in the configuration.
/api/version Returns information about Traefik Enterprise version.
/debug/vars See the expvar Go documentation.
/debug/pprof/ See the pprof Index Go documentation.
/debug/pprof/cmdline See the pprof Cmdline Go documentation.
/debug/pprof/profile See the pprof Profile Go documentation.
/debug/pprof/symbol See the pprof Symbol Go documentation.
/debug/pprof/trace See the pprof Trace Go documentation.