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

# Create API Key

> Create a new API key for the authenticated user. The raw key is returned once and cannot be retrieved again.

<Note>
  This endpoint uses your dashboard session (Auth0 JWT), not an API key.
</Note>

### Request body

<ParamField body="name" type="string" required>
  A human-readable label for the key. Max 128 characters. Example: `production`, `ci-pipeline`.
</ParamField>

### Response

<ResponseField name="id" type="string">
  Unique identifier for the key (UUID). Use this when revoking.
</ResponseField>

<ResponseField name="name" type="string">
  The label you provided.
</ResponseField>

<ResponseField name="key" type="string">
  The raw API key — **shown only once**. Starts with `imp_`.
</ResponseField>

<ResponseField name="key_prefix" type="string">
  First 8 characters of the key. Safe to store and use in logs to identify which key made a request.
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 timestamp.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -s -X POST "https://api.impulselabs.ai/api/api-keys" \
    -H "Authorization: Bearer <your-dashboard-session-token>" \
    -H "Content-Type: application/json" \
    -d '{ "name": "production" }'
  ```

  ```python Python theme={null}
  import requests

  resp = requests.post(
      "https://api.impulselabs.ai/api/api-keys",
      headers={"Authorization": "Bearer <dashboard-token>"},
      json={"name": "production"},
  )
  data = resp.json()
  print(data["key"])  # Save this — shown once only
  ```

  ```javascript Node.js theme={null}
  const resp = await fetch("https://api.impulselabs.ai/api/api-keys", {
    method: "POST",
    headers: {
      Authorization: "Bearer <dashboard-token>",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ name: "production" }),
  });
  const { key } = await resp.json();
  console.log(key); // imp_a1b2c3...
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "production",
    "key": "imp_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2",
    "key_prefix": "imp_a1b2",
    "created_at": "2026-02-19T12:00:00.000Z"
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "error": "Invalid body",
    "details": {
      "fieldErrors": { "name": ["String must contain at least 1 character(s)"] }
    }
  }
  ```

  ```json 403 Forbidden theme={null}
  {
    "error": "Upgrade required",
    "message": "API keys are available on Pro plans and above. Upgrade at /billing."
  }
  ```
</ResponseExample>
