API7 Docs

Update a consumer on a gateway group

PUT /apisix/admin/consumers/{username}

PUT /apisix/admin/consumers/{username}

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

In: header

Path Parameters

username*string

The unique identifier of the consumer.

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

Query Parameters

gateway_group_id*string

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

Length1 <= length

Request Body

application/json

The consumer description.

Response Body

application/json

application/json

curl -X PUT "$API_BASE_URL/apisix/admin/consumers/johndoe?gateway_group_id=86fb9981-d9d2-4555-9df8-91ae92129335" \  -H "Content-Type: application/json" \  -d '{    "username": "johndoe"  }'

Consumer updated successfully.

{
  "value": {
    "username": "johndoe",
    "plugins": {
      "key-auth": {}
    },
    "desc": "Object description.",
    "labels": {
      "version": "v2",
      "env": "prod"
    },
    "created_at": 1742288232,
    "updated_at": 1742288235
  }
}
Complete operation details and schema variants

PUT /apisix/admin/consumers/{username}

Update a consumer on a gateway group

IAM Action: gateway:UpdateConsumer, Resource: arn:api7:gateway:gatewaygroup/%s/consumer/%s

Parameters

  • username (path, string, required): The unique identifier of the consumer.
  • gateway_group_id (query, string, required): Gateway group ID. Optional when using the gateway group admin key to authenticate.

Request body

Content type: application/json

  • username (string, required): The unique identifier of the consumer.
  • plugins (object, optional): Key-value pairs of plugins and their configurations on the object.
  • desc (string, optional): The object description.
  • labels (object, optional): Key-value pairs of labels.

Responses

  • 200: Consumer updated successfully.
  • allOf variant 1
  • value (object, optional): The specific resource.
  • allOf variant 2
  • value (object, optional): The consumer with management fields.
  • allOf variant 1
  • value.username (string, required): The unique identifier of the consumer.
  • value.plugins (object, optional): Key-value pairs of plugins and their configurations on the object.
  • value.desc (string, optional): The object description.
  • value.labels (object, optional): Key-value pairs of labels.
  • allOf variant 2
  • value.created_at (integer, optional): The object created timestamp.
  • value.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 PUT '$API_BASE_URL/apisix/admin/consumers/{username}'