> For the complete documentation index, see [llms.txt](https://docs.nebulablock.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nebulablock.com/api-reference/platform-api/list-api-keys/create-api-key.md).

# Create API Key

Create a new Nebula Block API key, optionally scoped to a team.

Create a new API key. To learn how to authenticate requests with it, see [Authentication](/api-reference/authentication.md).

## HTTP Request

`POST` `{API_URL}/keys`

where `API_URL = https://api.nebulablock.com/api/v1`.

## Body Parameters

| Parameter     | Requirement | Type      | Description                                                                                  |
| ------------- | ----------- | --------- | -------------------------------------------------------------------------------------------- |
| `name`        | Required    | `string`  | A name for the API key                                                                       |
| `description` | Optional    | `string`  | A description of what the key is for                                                         |
| `team_id`     | Optional    | `integer` | Create the key under a team instead of your personal account. See [Teams](/account/teams.md) |

## Response Attributes

#### data `dict`

Contains the new key:

* `id` `integer`: The key's ID.
* `key` `string`: The key value used to authenticate requests.

#### status `string`

`success` or `failed`.

#### message `string`

A description of the result.

> **Note:** Creating a key notifies your account. There is a limit on how many keys one account can hold — if you hit it, contact support to have it raised.

## Example

#### Request

```bash
curl -X POST '{API_URL}/keys' \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-d '{
    "name": "production",
    "description": "Key used by the production service"
}'
```

#### Response

```json
{
    "data": {
        "id": 5,
        "key": "sk-..."
    },
    "message": "New API key generated successfully",
    "status": "success"
}
```

## See also

* [List API Keys](/api-reference/platform-api/list-api-keys.md)
* [Delete API Key](/api-reference/platform-api/list-api-keys/delete-api-key.md)
