> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blobhub.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create API Key

Create a new API key for a target. The key secret is returned only once.

## **POST** `/:target/:target_id/api_keys`

### Path Parameters

| Parameter   | Type   | Required | Description                           |
| :---------- | :----- | :------- | :------------------------------------ |
| `target`    | string | Yes      | Resource type: `orgs` or `blobs`.     |
| `target_id` | string | Yes      | The unique ID of the target resource. |

### Request Body

| Parameter     | Type   | Required | Description                       |
| :------------ | :----- | :------- | :-------------------------------- |
| `role`        | string | Yes      | `read` or `write`.                |
| `description` | string | No       | Description of the key's purpose. |

### Response

| Parameter | Type   | Description                                      |
| :-------- | :----- | :----------------------------------------------- |
| `api_key` | object | The created API key object including the secret. |

### Example

<CodeGroup>
  ```json Request theme={null}
  {
    "role": "read",
    "description": "CI/CD Integration"
  }
  ```

  ```json Response theme={null}
  {
    "api_key": {
      "id": "key_002",
      "key": "bh_live_nwk...",
      "key_prefix": "bh_live_***"
    }
  }
  ```
</CodeGroup>
