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

# Authentication

> Learn how to authenticate your requests to the NeetoEngage API using API keys.

## Generating an API key

To use the NeetoEngage APIs, you must first generate an API key:

1. Go to the **Admin panel**. Under **General**, click **API keys**.
2. Click **Add API key**. The **Add new API key** pane opens.
3. Enter a **Name** for the key.
4. Pick an **Expiry date**, or check **Never expires**.
5. Click **Save changes**.
6. Copy the key from the **API keys** list using the copy icon. The key stays in the list, so you can copy it again later.

## Making authenticated API requests

To authenticate your API requests, include a valid API key in the `X-Api-Key` header.

```bash theme={"system"}
curl https://{your-subdomain}.neetoengage.com/api/external/v1/tracks \
  --header 'X-Api-Key: your-api-key' \
  --header 'Accept: application/json'
```

## Header format

Include your API key in the `X-Api-Key` header of every request:

```http theme={"system"}
X-Api-Key: your-api-key
```

The API only returns JSON. If you send an `Accept` header, it must allow `application/json`. Otherwise you receive a 406 response.

<Tip>
  Generate separate API keys for different workspaces. An API key generated in
  one workspace will not work in another.
</Tip>

<Warning>
  API keys provide access to sensitive data. Treat them like passwords and
  follow security best practices.
</Warning>

## Error responses

### 401 Unauthorized

If your API key is missing, invalid, or expired, you'll receive a 401 error:

```json theme={"system"}
{
  "error": "Could not authenticate, invalid API Key"
}
```

### Common authentication issues

<AccordionGroup>
  <Accordion title="Invalid API key">
    **Problem**: API key is missing or invalid. <br />
    **Solution**: Verify your API key is correct and hasn't been revoked/expired.
  </Accordion>

  <Accordion title="Incorrect workspace subdomain">
    **Problem**: Subdomain is left as the default value (**spinkart**) or incorrect. <br />
    **Solution**: Verify your subdomain name is properly added in the request URL. If no workspace exists for the subdomain, the API returns a 404 response.
  </Accordion>

  <Accordion title="API key from another Neeto product">
    **Problem**: The key was created in a different Neeto product. <br />
    **Solution**: Generate a new key in NeetoEngage.
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.