# Authentication

## Prerequisites

To use the HG Insights API v2, you need an active subscription to the **(new) HG Platform** with credits included. Each API call consumes credits based on the data returned. [Learn more about credits](/v2/guides/credits-and-usage).

If you don't have a subscription or need to add credits, contact your HG Insights account manager or reach out at [hginsights.com](https://hginsights.com).

## Getting Your API Key

Once you have a subscription to the (new) HG Platform:

1. Log in to your account at [admin.hginsights.com](https://admin.hginsights.com) — you must be an **admin** to generate API keys
2. Navigate to **Settings** > **API Keys**
3. Click **Create API Key**
4. Give your key a name and click **Create API Key**
5. Copy your key


## Using Your API Key

Include your API key in the `Authorization` header of every request:


```bash
curl -X POST "https://api.hginsights.com/data-api/v2/companies/enrich" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"companies": {"ids": ["COMPANY_ID"]}}'
```

## API Key Format

v2 API keys start with `hg_v2_` followed by a random string.

Example: `hg_v2_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`

## Security Best Practices

Never share your API key or commit it to source control. Revoke your key immediately if you suspect it has been compromised.