Control API

The control API can be used to

  • expose APISIX internal state
  • control the behavior of a single isolate APISIX data panel

By default, the control API server is enabled and listens to 127.0.0.1:9090. You can change it via the control section under apisix in conf/config.yaml:

  1. apisix:
  2. ...
  3. enable_control: true
  4. control:
  5. ip: "127.0.0.1"
  6. port: 9090

Note that the control API server should not be configured to listen to the public traffic!

Control API Added via plugin

Plugin can add its control API when it is enabled. If a plugin adds such a control API, please refer to each plugin’s documentation for those APIs.

Plugin independent Control API

Here is the supported API:

GET /v1/schema

Introduced since v2.2.

Return the jsonschema used by this APISIX instance in the format below:

  1. {
  2. "main": {
  3. "route": {
  4. "properties": {...}
  5. },
  6. "upstream": {
  7. "properties": {...}
  8. },
  9. ...
  10. },
  11. "plugins": {
  12. "example-plugin": {
  13. "consumer_schema": {...},
  14. "metadata_schema": {...},
  15. "schema": {...},
  16. "type": ...,
  17. "priority": 0,
  18. "version": 0.1
  19. },
  20. ...
  21. }
  22. }

For plugins part, only enabled plugins will be returned. Some plugins may lack of fields like consumer_schema or type, it is depended on by the plugin’s definition.

GET /v1/healthcheck

Introduced since v2.3.

Return current health check status in the format below:

  1. [
  2. {
  3. "healthy_nodes": [
  4. {
  5. "host": "127.0.0.1",
  6. "port": 1980,
  7. "priority": 0,
  8. "weight": 1
  9. }
  10. ],
  11. "name": "upstream#/upstreams/1",
  12. "nodes": [
  13. {
  14. "host": "127.0.0.1",
  15. "port": 1980,
  16. "priority": 0,
  17. "weight": 1
  18. },
  19. {
  20. "host": "127.0.0.2",
  21. "port": 1988,
  22. "priority": 0,
  23. "weight": 1
  24. }
  25. ],
  26. "src_id": "1",
  27. "src_type": "upstreams"
  28. },
  29. {
  30. "healthy_nodes": [
  31. {
  32. "host": "127.0.0.1",
  33. "port": 1980,
  34. "priority": 0,
  35. "weight": 1
  36. }
  37. ],
  38. "name": "upstream#/routes/1",
  39. "nodes": [
  40. {
  41. "host": "127.0.0.1",
  42. "port": 1980,
  43. "priority": 0,
  44. "weight": 1
  45. },
  46. {
  47. "host": "127.0.0.1",
  48. "port": 1988,
  49. "priority": 0,
  50. "weight": 1
  51. }
  52. ],
  53. "src_id": "1",
  54. "src_type": "routes"
  55. }
  56. ]

Each entry contains fields below:

  • src_type: where the health checker comes from. The value is one of ["routes", "services", "upstreams"].
  • src_id: the id of object which creates the health checker. For example, if Upstream object with id 1 creates a health checker, the src_type is upstreams and the src_id is 1.
  • name: the name of the health checker.
  • nodes: the target nodes of the health checker.
  • healthy_nodes: the healthy node known by the health checker.

User can also use /v1/healthcheck/$src_type/$src_id can get the status of a health checker.

For example, GET /v1/healthcheck/upstreams/1 returns:

  1. {
  2. "healthy_nodes": [
  3. {
  4. "host": "127.0.0.1",
  5. "port": 1980,
  6. "priority": 0,
  7. "weight": 1
  8. }
  9. ],
  10. "name": "upstream#/upstreams/1",
  11. "nodes": [
  12. {
  13. "host": "127.0.0.1",
  14. "port": 1980,
  15. "priority": 0,
  16. "weight": 1
  17. },
  18. {
  19. "host": "127.0.0.2",
  20. "port": 1988,
  21. "priority": 0,
  22. "weight": 1
  23. }
  24. ],
  25. "src_id": "1",
  26. "src_type": "upstreams"
  27. }

POST /v1/gc

Introduced since v2.8.

Trigger a full GC in the http subsystem. Note that when you enable stream proxy, APISIX will run another Lua VM for the stream subsystem. It won’t trigger a full GC in this Lua VM .