API7 Docs

List all routes in a service

GET /apisix/admin/routes

GET /apisix/admin/routes

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

In: header

Query Parameters

service_id*string

The unique identifier of the service.

Match^[a-zA-Z0-9-_.]+$
Length1 <= length <= 256
page?integer

Page number of the listed resources. Used together with page_size. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.

Formatint32
Range1 <= value
page_size?integer

Number of resources listed per page. Used together with page. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.

Formatint32
Range1 <= value
direction?string

Order to list the resources by. The sorting index follows the configuration of order_by.

Default"desc"

Value in

  • "asc"
  • "desc"
order_by?string

Index to order resources by.

Default"updated_at"

Value in

  • "created_at"
  • "updated_at"
search?string

Condition to search resources by.

gateway_group_id*string

Gateway group ID. Optional when using the gateway group admin key to authenticate.

Length1 <= length
with_publish_info?boolean

If true, include publish information in the response, such as apisix_route_id, route_version_id, and service_version_id. The additional information is only useful for the Dashboard and not for API users.

Defaultfalse

Response Body

application/json

application/json

curl -X GET "$API_BASE_URL/apisix/admin/routes?service_id=bd58fce2-b6cc-4d2d-a53c-6ce11b19c101&search=version%253Dv2&gateway_group_id=86fb9981-d9d2-4555-9df8-91ae92129335"

Successfully retrieved the paginated list of routes.

{
  "total": 1,
  "list": [
    {
      "name": "us-west-rsc",
      "labels": {
        "version": "v2",
        "env": "prod"
      },
      "desc": "Object description.",
      "methods": [
        "GET"
      ],
      "vars": [
        [
          "arg_version",
          "==",
          "v2"
        ],
        [
          "arg_ttl",
          "<",
          3600
        ]
      ],
      "paths": [
        "/get"
      ],
      "priority": 0,
      "enable_websocket": true,
      "timeout": {
        "connect": 60,
        "send": 60,
        "read": 60
      },
      "plugins": {
        "key-auth": {}
      },
      "id": "bd58fce2-b6cc-4d2d-a53c-6ce11b19c101",
      "service_id": "b32e678e-7f6b-4a50-b113-550621ed4c01",
      "created_at": 1742288232,
      "updated_at": 1742288235
    }
  ]
}
Complete operation details and schema variants

GET /apisix/admin/routes

List all routes in a service

List routes in a service through an APISIX Admin API compatible endpoint under /apisix/admin/. Use pagination and filters to inspect APISIX-compatible route entries. Required IAM Permission: Action gateway:GetPublishedService, Resource arn:api7:gateway:gatewaygroup/%s/service/%s

Parameters

  • service_id (query, string, required): The unique identifier of the service.
  • page (query, integer, optional): Page number of the listed resources. Used together with page_size. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.
  • page_size (query, integer, optional): Number of resources listed per page. Used together with page. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.
  • direction (query, string, optional): Order to list the resources by. The sorting index follows the configuration of order_by.
  • order_by (query, string, optional): Index to order resources by.
  • search (query, string, optional): Condition to search resources by.
  • gateway_group_id (query, string, required): Gateway group ID. Optional when using the gateway group admin key to authenticate.
  • with_publish_info (query, boolean, optional): If true, include publish information in the response, such as apisix_route_id, route_version_id, and service_version_id. The additional information is only useful for the Dashboard and not for API users.

Responses

  • 200: Successfully retrieved the paginated list of routes.
  • allOf variant 1
  • list (array, optional): An array of resources.
  • total (integer, optional): Total number of objects.
  • allOf variant 2
  • list (array, optional): The array of routes.
  • allOf variant 1
  • allOf variant 1
  • list[].name (string, optional): The object name.
  • list[].labels (object, optional): Key-value pairs of labels.
  • list[].desc (string, optional): The object description.
  • list[].methods (array, optional): The allowed HTTP methods to access the route. If empty, all HTTP methods are allowed.
  • list[].vars (array, optional): Conditions in the format of APISIX expressions to match requests to routes. Case sensitive when matching a cookie name.
  • list[].paths (array, optional): The URL path(s) (after the service's path_prefix) that the route will listen to. Each path should start with a /.
  • list[].priority (integer, optional): Priority of the route. A higher value corresponds to a higher priority. If different Routes matches to the same URI, then the Route with the highest priority will be matched.
  • list[].enable_websocket (boolean,null, optional): If true, enable Websocket proxying for the route.
  • allOf variant 2
  • list[].timeout (object, optional): Timeout settings for connecting to, sending, and receiving messages from the upstream, in seconds.
  • list[].timeout.connect (number, optional): Connection timeout in seconds.
  • list[].timeout.send (number, optional): Sending timeout in seconds.
  • list[].timeout.read (number, optional): Receiving timeout in seconds.
  • list[].plugins (object, optional): Key-value pairs of plugins and their configurations on the object.
  • allOf variant 2
  • list[].id (string, optional): The object ID.
  • list[].service_id (string, optional): The service ID.
  • list[].created_at (integer, optional): The object created timestamp.
  • list[].updated_at (integer, optional): The object updated timestamp.
  • 400: Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.
  • value (object, optional): The specific resource.
  • error_msg (string, optional): The error message.

cURL

curl -X GET '$API_BASE_URL/apisix/admin/routes'