Before building, verify your API key is working with a quick test call. The fastest way is to use the interactive API Reference built into this documentation — no external tools needed.
The API Reference includes a built-in "Try it" console on every endpoint. To test your key:
- Go to the API Reference and open the Company Enrichment endpoint
- Click Try it
- In the Authorization field, enter your API key
- Fill in a test company (by ID or domain) and click Send
A successful response returns a 200 OK with company data. If you see a 401 Unauthorized, double-check that your key is correct and that there are no extra spaces.
You can also verify your key from the terminal:
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": {"domains": ["hginsights.com"]}}'A valid key returns company data for the domain you provided. An invalid key returns:
{
"errors": [{
"title": "Unauthorized",
"detail": "Invalid or missing API key"
}]
}401 Unauthorized — Your API key is missing, incorrect, or has been revoked. Regenerate it from admin.hginsights.com under Settings > API Keys.
402 / credit error — Your account has no credits remaining. Go to Settings > Credits Usage to request more.
No data returned — The company may not be in HG's database, or you may not have access to the field groups you requested. Check your subscription entitlements with your account manager.