API7 Docs

Delete a Consumer

DELETE /apisix/admin/consumers/{username}

DELETE /apisix/admin/consumers/{username}

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

username*string

Consumer username.

Match^[a-zA-Z0-9_\-]+$
Length1 <= length <= 256

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/consumers/jack?force=true"

Successful response.

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

DELETE /apisix/admin/consumers/{username}

Delete a Consumer

Delete a consumer by username. This also deletes all associated credentials.

Parameters

  • username (path, string, required): Consumer username.
  • 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 consumer in the data store.
  • deleted (string, optional): The ID of the successfully deleted consumer.
  • 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 -X DELETE 'http://127.0.0.1:9180/apisix/admin/consumers/{username}'