API7 Docs

Delete a Route

DELETE /apisix/admin/routes/{id}

DELETE /apisix/admin/routes/{id}

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

Admin API key configured in config.yaml under deployment.admin.admin_key. You can also pass the key as a query parameter api_key or cookie x_api_key.

In: header

Path Parameters

id*string

Unique identifier of the resource. Can be a string (alphanumeric, -, _, .) or a positive integer.

Query Parameters

force?string

Delete resource by force even if the resource is in use.

Response Body

application/json

application/json

application/json

curl -X DELETE "http://127.0.0.1:9180/apisix/admin/routes/my-resource-1?force=true"

Successful response.

{
  "deleted": "1",
  "key": "/apisix/routes/1"
}
Complete operation details and schema variants

DELETE /apisix/admin/routes/{id}

Delete a Route

Delete a route by its ID. This action is irreversible.

Parameters

  • id (path, string, required): Unique identifier of the resource. Can be a string (alphanumeric, -, _, .) or a positive integer.
  • force (query, string, optional): Delete resource by force even if the resource is in use.

Responses

  • 200: Successful response.
  • key (string, optional): Unique key identifier for this route in the data store.
  • deleted (string, optional): The ID of the successfully deleted route.
  • 401: Unauthorized — The API key is missing, invalid, or lacks permission.
  • error_msg (string, required): Authentication error message.
  • description (string, optional): Detailed reason for the authentication failure.
  • 404: Not Found — The specified resource does not exist.
  • error_msg (string, required): Error message indicating the resource was not found.

cURL

curl -i http://127.0.0.1:9180/apisix/admin/routes/1 \
  -H 'X-API-KEY: your-api-key' -X DELETE