> 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 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"
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://api.senderwiz.com/admin/customer-api/update-a-customer-api-key.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
