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

# Authentication

> Learn how to generate and use your secret API key.

All Automate Chats API requests require a secret API key for authentication. This key identifies your account and ensures that only authorized systems can send messages on your behalf.

## Generating an API Key

Follow these steps to create your first API key.

<Steps>
  <Step title="Open Settings">
    Log in to your dashboard and click on **More** in the top navigation bar.
  </Step>

  <Step title="Navigate to Webhook & API">
    From the dropdown menu, select **Webhook & API**. <img src="https://mintcdn.com/automatebusiness/Beu61mgwTpSiAjxs/images/automate-chats/api-keys-list.png?fit=max&auto=format&n=Beu61mgwTpSiAjxs&q=85&s=6c3ed9ebccf7091f9d21e1ff250663ed" alt="Webhook & API Menu" width="1920" height="912" data-path="images/automate-chats/api-keys-list.png" />
  </Step>

  <Step title="Create New API Key">
    Click on the **APIs** tab in the sidebar and then click the **Create API Key** button.
  </Step>

  <Step title="Name and Save">
    Enter a name for your key (e.g., "Automate CRM Integration") and click **Save**. <img src="https://mintcdn.com/automatebusiness/Beu61mgwTpSiAjxs/images/automate-chats/create-api-key-modal.png?fit=max&auto=format&n=Beu61mgwTpSiAjxs&q=85&s=978ff88a9f6e4e793e2b34c876d94462" alt="Create API Key Modal" width="1920" height="912" data-path="images/automate-chats/create-api-key-modal.png" />
  </Step>

  <Step title="Secure your Key">
    Copy the generated secret immediately. **For security reasons, it will not be shown again.**
  </Step>
</Steps>

## Using the API Key

Include your secret key in the `X-API-Key` header of all your HTTP requests.

### Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url https://api.automatechats.com/api/templates/approved \
    --header 'X-API-Key: YOUR_API_KEY'
  ```

  ```javascript Node.js theme={null}
  const options = {
    method: 'GET',
    headers: {
      'X-API-Key': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    }
  };

  fetch('https://api.automatechats.com/api/templates/approved', options)
    .then(response => response.json())
    .then(response => console.log(response))
    .catch(err => console.error(err));
  ```
</CodeGroup>

<Warning>
  **Security Warning:** Never share your API key or commit it to public repositories. If your key is compromised, delete it immediately from the dashboard and generate a new one.
</Warning>
