Ana içeriğe geç

Update Credential

Endpoint

PUT /apiops/projects/{projectName}/credentials/

Authentication

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request

Headers

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typeapplication/jsonYes

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name

Request Body

Same structure as Create Credential. All fields are required for update.

Full JSON Body Example

{
"email": "updated@example.com",
"fullName": "Updated User",
"description": "Updated credential description",
"username": "api-user",
"password": "NewSecurePassword123!",
"roleNameList": [
"API_USER",
"DEVELOPER"
],
"enabled": true,
"trafficLogDisabled": false,
"ipList": [
"192.168.1.100"
],
"expireDate": "2025-12-31T23:59:59.000Z"
}

Request Body Fields

Same as Create Credential. See Create Credential for field descriptions.

Important Notes

  • username must match the existing credential username (cannot be changed)
  • All fields are required (same as create)
  • trafficLogDisabled is the one exception to "all fields are required". Omitting it (or sending null) leaves the stored value untouched instead of resetting it, so a client written before the field existed cannot silently re-enable traffic logging for a consumer an operator deliberately silenced. Send false explicitly to turn logging back on.
  • Password can be updated
  • Credential is automatically deployed after update
  • The consumer's organization cannot be changed through this endpoint — the request body carries no organization field at all. To move a consumer to a different organization of the same project, use the consumer transfer action on the Consumers & Applications Management API instead.

Response

Same as Create Credential. See Create Credential for response format.

Consumer Whose Client Identity Was Migrated

A credential whose client identity has been carried over to an API client (see Legacy Username Becomes Read-Only After Migration; a Password Change Rotates the Client Secret) still refuses a change to username here — it is the client id every caller already holds:

{
"status": "FAILURE",
"resultMessage": "This consumer's client identity was migrated to an api client; the legacy username is read-only because it is the client identifier every caller holds."
}

password, however, is no longer refused. Sending a changed password for such a credential updates the legacy credential's own password as before and rotates the migrated API client's secret to the same value: the new value becomes the client's next secret generation (in the storage mode the client's current generation has; a value containing ${...}/#{...} becomes a secret-reference generation), and the previous generation keeps authenticating through its grace window. A revoked client takes no rotation — only the legacy password changes. Sending the credential's current, unchanged password (or a blank one, which this endpoint already rejects on its own) does not trigger a rotation.

The username rejection carries HTTP 400 — the same status the endpoint's own request-validation checks (missing username/password, credential not found) use. The Manager interface's edit screen reports the identical username condition with the error key credential.legacyIdentityMigrated; this endpoint returns the message text only.

cURL Example

curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/credentials/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"email": "updated@example.com",
"fullName": "Updated User",
"description": "Updated description",
"username": "api-user",
"password": "NewSecurePassword123!",
"roleNameList": [
"API_USER"
],
"enabled": true,
"ipList": [],
"expireDate": null
}'

Permissions

  • User must have IDENTITY + MANAGE permission in the project
  • For automatic deployment, user must also have IDENTITY + DEPLOY_UNDEPLOY permission

Notes and Warnings

  • Username Cannot Change:

    • Username is used as identifier and cannot be changed
    • Use the existing username in the request
  • All Fields Required:

    • All fields must be provided (same as create)
    • Missing fields will cause validation errors
  • Password Update:

    • Password can be updated
    • New password must not be empty
  • Automatic Deployment:

    • Credential is automatically deployed after update
    • Deployment results are returned in the response
  • Credential Must Exist:

    • Credential with specified username must exist
    • If credential does not exist, update will fail
  • Legacy Identity Migrated (Consumer):

    • A credential whose client identity was carried over to an API client still refuses an actual change to username — see Consumer Whose Client Identity Was Migrated above
    • A changed password is no longer refused: it rotates the migrated API client's secret instead of rewriting the legacy credential's own password field
  • Organization Is Not Editable Here:

    • This endpoint's request body has no organization field, so a consumer's organization is left exactly as it was before the update, whatever else the request changes
    • Moving a consumer to another organization is a separate action — see Transfer to another organization