Update a consumer credential on a gateway group
PUT /apisix/admin/consumers/{username}/credentials/{credential_id}
PUT /apisix/admin/consumers/{username}/credentials/{credential_id}Interactive request editor loads with JavaScript.
In: header
Path Parameters
The unique identifier of the consumer.
^[a-zA-Z0-9_\-]+$1 <= length <= 512The unique identifier of the consumer credential.
^[a-zA-Z0-9-_.]+$1 <= length <= 256Query Parameters
Gateway group ID. Optional when using the gateway group admin key to authenticate.
1 <= lengthRequest Body
application/json
The consumer credential description.
Response Body
application/json
application/json
curl -X PUT "$API_BASE_URL/apisix/admin/consumers/johndoe/credentials/bd58fce2-b6cc-4d2d-a53c-6ce11b19c101?gateway_group_id=86fb9981-d9d2-4555-9df8-91ae92129335" \ -H "Content-Type: application/json" \ -d '{ "name": "us-west-rsc", "plugins": { "key-auth": {} } }'Consumer credential updated successfully.
{
"value": {
"name": "us-west-rsc",
"plugins": {
"key-auth": {
"key": "john-key"
}
},
"desc": "Object description.",
"labels": {
"version": "v2",
"env": "prod"
},
"id": "bd58fce2-b6cc-4d2d-a53c-6ce11b19c101",
"created_at": 1742288232,
"updated_at": 1742288235
}
}Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.
{
"value": {},
"error_msg": "error message"
}Complete operation details and schema variants
PUT /apisix/admin/consumers/{username}/credentials/{credential_id}
Update a consumer credential on a gateway group
IAM Action: gateway:UpdateConsumerCredential, Resource: arn:api7:gateway:gatewaygroup/%s/consumer/%s
Parameters
username(path, string, required): The unique identifier of the consumer.credential_id(path, string, required): The unique identifier of the consumer credential.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
name(string, required): The object name.plugins(object, required): Plugin configuration.- oneOf variant 1: key-auth
plugins.key-auth(object, required):key-authplugin configurations.plugins.key-auth.key(string, optional):key-authuser key.- oneOf variant 2: basic-auth
plugins.basic-auth(object, required):basic-authplugin configurations.plugins.basic-auth.username(string, optional):basic-authunique username.plugins.basic-auth.password(string, optional):basic-authuser password.- oneOf variant 3: hmac-auth
plugins.hmac-auth(object, required):hmac-authplugin configurations.plugins.hmac-auth.key_id(string, optional):hmac-authkey unique identifier.plugins.hmac-auth.secret_key(string, optional):hmac-authsecret key.- oneOf variant 4: jwt-auth
plugins.jwt-auth(object, required):jwt-authplugin configurations.plugins.jwt-auth.key(string, optional):jwt-authkey unique identifier.plugins.jwt-auth.secret(string, optional):jwt-authsecret.- oneOf variant 5: ldap-auth-advanced
plugins.ldap-auth-advanced(object, required):ldap-auth-advancedplugin configurations.plugins.ldap-auth-advanced.user_dn(string, optional):ldap-auth-advancedunique user DN.desc(string, optional): The object description.labels(object, optional): Key-value pairs of labels.
Responses
200: Consumer credential updated successfully.- allOf variant 1
value(object, optional): The specific resource.- allOf variant 2
value(object, optional): The consumer credential with management fields.- allOf variant 1
value.name(string, required): The object name.value.plugins(object, required): Plugin configuration.- oneOf variant 1: key-auth
value.plugins.key-auth(object, required):key-authplugin configurations.value.plugins.key-auth.key(string, optional):key-authuser key.- oneOf variant 2: basic-auth
value.plugins.basic-auth(object, required):basic-authplugin configurations.value.plugins.basic-auth.username(string, optional):basic-authunique username.value.plugins.basic-auth.password(string, optional):basic-authuser password.- oneOf variant 3: hmac-auth
value.plugins.hmac-auth(object, required):hmac-authplugin configurations.value.plugins.hmac-auth.key_id(string, optional):hmac-authkey unique identifier.value.plugins.hmac-auth.secret_key(string, optional):hmac-authsecret key.- oneOf variant 4: jwt-auth
value.plugins.jwt-auth(object, required):jwt-authplugin configurations.value.plugins.jwt-auth.key(string, optional):jwt-authkey unique identifier.value.plugins.jwt-auth.secret(string, optional):jwt-authsecret.- oneOf variant 5: ldap-auth-advanced
value.plugins.ldap-auth-advanced(object, required):ldap-auth-advancedplugin configurations.value.plugins.ldap-auth-advanced.user_dn(string, optional):ldap-auth-advancedunique user DN.value.desc(string, optional): The object description.value.labels(object, optional): Key-value pairs of labels.- allOf variant 2
value.id(string, optional): The object ID.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}/credentials/{credential_id}'