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

# Authentication

> How to authenticate requests to the Influship API

# Authentication

Every request needs an API key passed in the `X-API-Key` header.

## Get your API key

Sign up at [developers.influship.com](https://developers.influship.com) and find your API key in the dashboard under **Settings > API Keys**.

## Set it as an environment variable

```bash theme={null}
export INFLUSHIP_API_KEY="your_api_key_here"
```

Or add it to your `.env` file:

```bash .env theme={null}
INFLUSHIP_API_KEY="your_api_key_here"
```

<Warning>
  Never commit API keys to version control. Use environment variables or a secrets manager.
</Warning>

## Pass it in requests

<CodeGroup>
  ```typescript SDK theme={null}
  import Influship from 'influship';

  const client = new Influship({
    apiKey: process.env.INFLUSHIP_API_KEY,
  });
  ```

  ```bash cURL theme={null}
  curl https://api.influship.com/v1/creators/autocomplete?q=travel \
    -H 'X-API-Key: YOUR_API_KEY'
  ```
</CodeGroup>

The SDK reads from the `INFLUSHIP_API_KEY` environment variable automatically, so you can also omit the constructor argument entirely if the variable is set.

## When authentication fails

A missing or invalid key returns a `401` response:

```json theme={null}
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing API key",
    "status_code": 401
  }
}
```

If you receive this unexpectedly, check that the key is correctly set and has not been revoked.

## Key rotation

Generate a new key from the dashboard at any time. Old keys are revoked immediately when a new one is created — update your environment variables before generating a replacement if you have live traffic.

## Organization and billing

Each API key belongs to one organization. [Rate limits](/concepts/quotas-and-limits) and [billing](/concepts/pricing) are tracked per key.
