> For the complete documentation index, see [llms.txt](https://docs.talkstack.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.talkstack.ai/user/generate-api-key.md).

# Generate API key

This section provides instructions on using `/user/generate-apikey` endpoint to generarte new API key.

**Step 1: Prepare Your Request**

* **Endpoint:** `/user/generate-apikey`
* **Method:** `GET`
* **URL:** `https://api.talkstackai.com/user/generate-apikey`
* **Headers:** Include `Content-Type: application/json`.
* **Authorization:** Bearer token

**Step 2: Send the Request**

Use your preferred HTTP client to send the GET request.

**Step 3: Handle the request**

**Success Response:**

* **Status Code:** `200 OK`
* **Body:**
* ```json
  {
      "message": "API key successfully generated and updated.",
      "status": "success",
      "apiKey": "54447c25f46cf13f54915e4465bd443b4a0b98c5623cfc68e1393223984bf96c"
  }
  ```

**Troubleshooting**

* `401 Unauthorized`: If the user is unauthorized.
* `500 Internal Server Error`: For errors in creating API key.
