> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Change Credential Password

> Changes the password for an existing credential. Only the password field is updated; other fields remain unchanged. The credential is automatically deployed to all environments after password change.

## Endpoint

```
PATCH /apiops/projects/{projectName}/credentials/{username}/
```

## Authentication

Requires a Personal API Access Token.

### Header

```
Authorization: Bearer YOUR_TOKEN
```

## Request

### Headers

| Header        | Value            | Required |
| ------------- | ---------------- | -------- |
| Authorization | Bearer {token}   | Yes      |
| Content-Type  | application/json | Yes      |

### Path Parameters

| Parameter   | Type   | Required | Description                |
| ----------- | ------ | -------- | -------------------------- |
| projectName | string | Yes      | Project name               |
| username    | string | Yes      | Username of the credential |

### Request Body

#### Full JSON Body Example

```json theme={null}
{
  "password": "NewSecurePassword123!"
}
```

#### Request Body Fields

| Field    | Type   | Required | Default | Description                     |
| -------- | ------ | -------- | ------- | ------------------------------- |
| password | string | Yes      | -       | New password for the credential |

### Notes

* Only `password` field is required
* Other fields are ignored if provided
* Password must not be empty
* Credential must exist

## Response

### Success Response (200 OK)

```json theme={null}
{
  "success": true,
  "deploymentResult": {
    "success": true,
    "message": "Deployment completed successfully",
    "environmentResults": [
      {
        "environmentName": "production",
        "success": true,
        "message": "Deployed successfully"
      }
    ]
  }
}
```

### Error Response (400 Bad Request)

```json theme={null}
{
  "error": "bad_request",
  "error_description": "Credential password can not be empty!"
}
```

or

```json theme={null}
{
  "error": "bad_request",
  "error_description": "Credential (username: api-user) was not found!"
}
```

### Error Response (401 Unauthorized)

```json theme={null}
{
  "error": "unauthorized_client",
  "error_description": "Invalid token"
}
```

### Error Response (404 Not Found)

```json theme={null}
{
  "error": "not_found",
  "error_description": "Project(MyProject) was not found or user does not have privilege to access it!"
}
```

## cURL Example

```bash theme={null}
curl -X PATCH \
  "https://demo.apinizer.com/apiops/projects/MyProject/credentials/api-user/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "password": "NewSecurePassword123!"
  }'
```

## Notes and Warnings

* **Password Only**:
  * Only password is updated
  * Other fields remain unchanged

* **Password Required**:
  * Password must not be empty

* **Credential Must Exist**:
  * Credential with specified username must exist

* **Automatic Deployment**:
  * Credential is automatically deployed after password change
  * Deployment results are returned in the response

## Related Documentation

* [Update Credential](/api-reference/credentials/crud/update-credential) - Update all credential fields
* [Delete Credential](/api-reference/credentials/crud/delete-credential) - Delete a credential
