> For the complete documentation index, see [llms.txt](https://api.senderwiz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.senderwiz.com/admin/customer-api/update-a-customer-api-key.md).

# Update a Customer API Key

Update a customer's API key with a new name, description, or IP rules using the Admin API for improved security and management.

### ✏️ Update a Customer API Key

Update an existing API key's details like name, description, or IP restrictions using the Admin API for better access management.

#### 🔹 HTTP Request

`PUT ADMIN-API-URL/customers/CUSTOMER-UID/api-keys/KEY-ID`

#### 🔸 URL Segments

| Segment        | Type   | Required | Description                       |
| -------------- | ------ | -------- | --------------------------------- |
| `CUSTOMER-UID` | string | Yes      | Unique identifier of the customer |
| `KEY-ID`       | string | Yes      | ID of the API key to update       |

#### 🔐 Authorization Header

`X-ADMIN-API-KEY: your-admin-api-key-here`

#### 🔄 Fields Available for Update

| Field         | Type      | Required | Description                             |
| ------------- | --------- | -------- | --------------------------------------- |
| name          | string    | No       | A label or title for the API key        |
| description   | string    | No       | Short description for internal use      |
| ip\_whitelist | string\[] | No       | List of IPs allowed to use this key     |
| ip\_blacklist | string\[] | No       | List of IPs blocked from using this key |

#### 💻 PHP Example

```php
$response = $endpoint->updateApiKey('ab382plq98zr7', '45', [
  'name' => 'Updated Key',
  'description' => 'Updated description for the key',
  'ip_whitelist' => ['101.101.101.101'],
  'ip_blacklist' => ['202.202.202.202']
]);

echo '<hr /><pre>';
print_r($response->body);
echo '</pre>';
```

#### 📦 Sample JSON Response

```json
{
  "status": "success",
  "message": "API key updated successfully.",
  "api_key": {
    "key_id": "45",
    "key": "67bb0a36xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "name": "Updated Key",
    "description": "Updated description for the key",
    "ip_whitelist": ["101.101.101.101"],
    "ip_blacklist": ["202.202.202.202"],
    "updated_at": "2025-04-19 14:20:00"
  }
}
```
