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

> ## Agent Instructions
> Forager is a REST API for B2B people, company and job post data: contact lookups (phone numbers, personal emails, work emails), person, company and job post search, and bulk data feeds.
> Server: https://api-v2.forager.ai. Send the API key in the X-API-KEY header. Most paths include {account_id}. Read FORAGER_API_KEY and FORAGER_ACCOUNT_ID from the environment; never put the key in client-side code, logs or prompts.
> To add Forager to a project, follow https://www.forager.ai/docs/guides/agent-quickstart.md. To pick an endpoint, read https://www.forager.ai/docs/guides/choose-an-endpoint.md. For end-to-end builds, see https://www.forager.ai/docs/recipes/overview.md.
> Most requests spend credits. Do not guess costs; use https://www.forager.ai/docs/api-overview/credit-pricing.md and ask the user before spending credits.
> Use only endpoints and fields defined in https://www.forager.ai/docs/openapi.yaml. Forager has no MCP server for the API yet; the /mcp endpoint on this site searches the documentation only.

# API key authentication

> Authenticate Forager API requests with your API key in the X-API-KEY header, with a curl example for the phone number lookup.

![API key authentication: send the X-API-KEY header with every Forager request; a missing key returns 403](https://mintcdn.com/forager/EGsWCxLOYv1Cb__c/images/illustrations/api-key-authentication-x-api-key-header.svg?fit=max\&auto=format\&n=EGsWCxLOYv1Cb__c\&q=85\&s=ea8b37cc2f3a4755c38461ca3e3a9047)

To interact with **Forager.ai's API**, you must authenticate every request using your **API key**. This ensures secure access to our data services.

***

## Obtaining an API key

1. **Sign up for an account** at [app.forager.ai](https://app.forager.ai).
2. Navigate to the **API** section.
3. Create and copy your **API key** – you’ll need this for all API requests.

***

## Using your API key

Forager.ai uses **API key authentication** via the `X-API-KEY` header. You must include this key in all requests to successfully access the API.

### Example: Sending an Authenticated API Request

Below is an example of how to make a request to the **Person Phone Number Lookup API** using `curl` with your API key.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api-v2.forager.ai/api/$FORAGER_ACCOUNT_ID/datastorage/person_contacts_lookup/phone_numbers/" \
     -H "Content-Type: application/json" \
     -H "X-API-KEY: $FORAGER_API_KEY" \
     -d '{
           "linkedin_public_identifier": "billgates"
         }'
```

### Explanation

* Set `FORAGER_ACCOUNT_ID` to your Forager Account ID and `FORAGER_API_KEY` to your API key first, for example with `export FORAGER_API_KEY="your-api-key"` and `export FORAGER_ACCOUNT_ID="your-account-id"`.
* The X-API-KEY header must be included in every request to authenticate.
* The API will return an error if the key is missing or invalid.

***

## How a request is authenticated

The key identifies you; the Account ID in the path names the account the key must belong to. A valid pair returns `200` with JSON. A missing header returns `403` with `Authentication credentials were not provided.`, and a key that cannot access the account in the path returns `403 Forbidden`. See [errors and rate limits](https://www.forager.ai/docs/errors-and-rate-limits.md).

![Authentication flow: create a key in the Web App, export the key and Account ID, send the X-API-KEY header; a valid key returns 200 JSON and a missing or wrong key returns 403](https://mintcdn.com/forager/ns67u_aB3_RSoht6/images/illustrations/api-key-auth-flow-create-key-send-header.svg?fit=max\&auto=format\&n=ns67u_aB3_RSoht6\&q=85\&s=c40f12f6abde89b89659acea719ef2d7)

Step through the same flow, with the request and the two responses:

Back
Next


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