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

# Pipecorn API authentication

> Authenticate Pipecorn API requests with an API key in the X-API-KEY header.

To authenticate your requests to the Pipecorn API, you'll need to include your API key in the request headers.

## Getting your API key

You can find your API key in your [Pipecorn dashboard settings](https://app.pipecorn.com/settings/apis/keys).

## Using your API key

Include your API key in the `X-API-KEY` header with all API requests:

```json theme={null}
X-API-KEY: your_api_key
```

## Test keys

To build without spending credits or touching real data, use your test key (it starts with `pc_test_`) or the public demo key `pc_test_demo`. They call the same endpoints and return sample data. See [Sandbox](https://docs.pipecorn.com/essentials/sandbox.md).

## Personal and workspace API keys

Every plan gives each user a **personal API key**, sent in the `X-API-KEY`
header. Workspaces on the **Scale plan** can also create a **workspace API
key**, sent in the `X-WORKSPACE-KEY` header instead.

```json theme={null}
X-WORKSPACE-KEY: your_workspace_key
```

Send one or the other, not both. A request carrying `X-WORKSPACE-KEY` does not
need `X-API-KEY`.

| | Personal API key | Workspace API key |
| - | - | - |
| **Header** | `X-API-KEY` | `X-WORKSPACE-KEY` |
| **Available on** | All plans | Scale plan |
| **Belongs to** | One user | The workspace |
| **Accounts used** | Yours only | Rotates across the accounts connected by workspace members |
| **When a member leaves** | Their key stops working, and integrations built on it break | Keeps working |
| **Credits and limits** | Your workspace's balance and plan limits | The same workspace balance and plan limits |

### Account rotation

Requests authenticated with a workspace key are not tied to one member's
LinkedIn or Sales Navigator session. Pipecorn rotates them across the accounts
connected by the members of your workspace, so live extraction throughput
grows with the size of your team and no single account carries the whole load.
A member that LinkedIn rate limited is left out of the rotation for 12 hours,
as long as another member is available.

Every response carries a `Pipecorn-Account` header with the email of the
member whose account served it (except a lead search that joins the
[queue](#lead-search-queue)), and a LinkedIn `429` names that member in
`account_email`. To check every member's LinkedIn and Sales Navigator session
at once, call [`GET /account`](https://docs.pipecorn.com/api-reference/endpoints/miscellaneous/get-account-info#with-a-workspace-key)
with the workspace key.

```http theme={null}
HTTP/1.1 200 OK
Pipecorn-Account: reza@acme.com
```

### Lead search queue

Plan quota is only spent when a search runs, so handing each new lead search
to a member as it arrives would pile a burst onto one account. With a workspace
key, these requests join a queue shared by the workspace instead:

* [`POST /leads`](https://docs.pipecorn.com/api-reference/endpoints/extract/leads) (a Sales Navigator
  search URL or a persona)
* [`POST /leads/search`](https://docs.pipecorn.com/api-reference/endpoints/extract/leads_from_company)
  with `live: true`

They answer `201` at once, with the search `id` and `status_url` as usual, but
no member is attached yet, so the response carries no `Pipecorn-Account`
header.

Every 15 seconds, Pipecorn hands out queued searches. A member gets the first
search in the queue that fits their remaining scraping quota, as long as they
meet all of these:

* Their LinkedIn and Sales Navigator sessions are connected.
* No other lead search is waiting or running on their account.
* LinkedIn has not rate limited them in the last 12 hours.

A search's size is its `limit`. Without one, it is `expected_profiles_count`
for `POST /leads` and 10 for `POST /leads/search`. A search too large for every
member's remaining quota keeps waiting, and smaller searches behind it can
start first.

Until a member takes it, [`GET /searches/{id}`](https://docs.pipecorn.com/api-reference/endpoints/searches/show)
reports `status: "not_started"` and no `executed_by`. Once a member takes it,
`executed_by` holds their email. A search still waiting 7 days after
it was created is not started. If LinkedIn rate limits or disconnects the
member before the first lead comes back, the search returns to its place in the
queue for another member, and that member is passed over for 12 hours.

`POST /leads/search` searches at different companies that share the same
filters and `limit` are run together as one Sales Navigator search by the member who takes
them, as they are with a personal key.

Pass `position` to choose where a search joins the queue: `end` (the default)
behind the searches already waiting, or `start` to run it next.

```json theme={null}
{
  "search_url": "https://www.linkedin.com/sales/search/people?query=...",
  "webhook_url": "https://example.com/webhook",
  "position": "start"
}
```

Because no LinkedIn session is attached when `POST /leads` answers,
`expected_profiles_count` is counted from the Pipecorn people database
(capped at 2500) rather than by Sales Navigator, and some URLs answer `422`:

| `error` | Cause |
| - | - |
| `position must be start or end` | `position` has another value |
| `Saved, recent, and shared Sales Navigator searches need a LinkedIn session.` | The URL points at a saved, recent or shared search instead of spelling out its filters |
| `These filters cannot be counted from the people database: …` | The URL uses a filter the database cannot count, or excludes a value of a filter that only supports inclusion |

The 1-request-per-second limit on `POST /leads` does not apply to a workspace
key. The workspace's per-minute plan limit does, shared by every `POST /leads`
made with the key. [`POST /leads/search`](https://docs.pipecorn.com/api-reference/endpoints/extract/leads_from_company)
with `live: true` stays exempt from rate limits.

> [!TIP]
>
> Use a **workspace API key** for anything that should outlive one person's
> account or needs sustained volume: production integrations, CRM syncs,
> scheduled jobs, and shared agents or MCP clients. Keep **personal API keys**
> for scripts and experiments you run yourself.

> [!NOTE]
>
> Workspace API keys are only available on the Scale plan. On other plans, use
> a personal key. See [pricing](https://pipecorn.com/pricing) for what each
> plan includes.


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