> 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/create-a-customer-api-key.md).

# Create a Customer API Key

### 🛠️ Create a Customer API Key

Generate a new API key for a customer using your Admin API key. Customize the key with optional IP whitelisting, naming, and descriptions.

#### 🔹 HTTP Request

`POST ADMIN-API-URL/customers/CUSTOMER-UID/api-keys`

#### 🔸 URL Segments

| Segment        | Type   | Required | Description                       |
| -------------- | ------ | -------- | --------------------------------- |
| `CUSTOMER-UID` | string | Yes      | Unique identifier of the customer |

#### 🔐 Authorization Header

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

#### 💻 PHP Example

```php
$response = $endpoint->createApiKey('ab382plq98zr7', [
  'name' => 'My site',
  'description' => 'This key is used on my site',
  'ip_whitelist' => ['123.123.123.123', '111.111.111.111'],
  'ip_blacklist' => ['231.231.231.231', '222.222.222.222']
]);

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

#### 📦 Sample JSON Response

```json
{
  "status": "success",
  "api_key": {
    "key_id": "31",
    "key": "67bb0a3627efd012458c3206db8cef86c95c0d47",
    "name": "My site",
    "description": "This key is used on my site",
    "ip_whitelist": ["123.123.123.123", "111.111.111.111"],
    "ip_blacklist": ["231.231.231.231", "222.222.222.222"],
    "created_at": "2025-04-19 11:00: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/create-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.
