> ## 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.

# Delete Credential

> Deletes a credential specified by username. The credential is automatically undeployed from all environments after deletion.

## Endpoint

```
DELETE /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      |

### Path Parameters

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

### Request Body

None.

## Response

### Success Response (200 OK)

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

### Error Response (400 Bad Request)

```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 DELETE \
  "https://demo.apinizer.com/apiops/projects/MyProject/credentials/api-user/" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

## Permissions

* User must have **`IDENTITY` + `MANAGE`** permission in the project
* For automatic undeployment, user must also have **`IDENTITY` + `DEPLOY_UNDEPLOY`** permission

## Notes and Warnings

* **Permanent Deletion**:
  * Credential is permanently deleted
  * This action cannot be undone

* **Automatic Undeployment**:
  * Credential is automatically undeployed from all environments
  * Undeployment results are returned in the response

* **Access Revocation**:
  * All access grants for this credential are also removed
  * Credential will no longer have access to any API Proxies or Groups

* **Credential Must Exist**:
  * Credential with specified username must exist
  * If credential does not exist, deletion will fail

## Related Documentation

* [List Credentials](/api-reference/credentials/crud/list-credentials) - List all credentials
* [Create Credential](/api-reference/credentials/crud/create-credential) - Create a new credential
* [Revoke Access](/api-reference/credentials/access/revoke-access) - Revoke access from API Proxy or Group
