> ## 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.

# Errors

> Status codes and error bodies: authentication, credits and limits, validation, rate limits

Every error the API handles has a JSON body with an `error` key (an
unexpected `500` may not, see below). It is usually a string; a validation
error on a record (a list, a search, an enrichment) carries an
array of messages instead, and some validation errors add context keys such as
`message` or `example`:

```json theme={null}
{ "error": "Invalid API key" }
{ "error": ["Name can't be blank"] }
```

| Status | Meaning |
| - | - |
| `400` | Malformed request body, or a required key is missing |
| `401` | Missing or invalid API key, or the LinkedIn session behind the request has expired |
| `402` | Out of credits |
| `403` | Workspace weekly credit limit reached, endpoint not available on your plan, account closed, or LinkedIn refused access to the resource |
| `404` | Unknown endpoint, or the resource does not exist |
| `409` | A request with the same `Idempotency-Key` is still running |
| `422` | Validation error, plan limit reached, or LinkedIn / Sales Navigator connection missing or expired |
| `429` | Rate limit exceeded |
| `500` | Unexpected server error |
| `502` | LinkedIn answered with an error |
| `503` | LinkedIn is unavailable |
| `504` | LinkedIn did not answer in time, or could not be reached |

## Credit and limit errors

Every endpoint that spends enrichment credits checks your balance before doing
any work. When that check fails, the API answers with a dedicated status code
and a machine-readable `code`, so your integration can tell "top up and retry"
apart from "this request will never succeed as-is".

### `402 Payment Required` — out of credits

The request was valid, but your workspace does not have enough enrichment
credits to pay for it. No credits are spent, and nothing is enqueued or
imported.

```json theme={null}
{
  "error": "Not enough enrichment credits left",
  "code": "insufficient_credits",
  "top_up_url": "https://app.pipecorn.com/settings/subscriptions/credits"
}
```

| Field | Description |
| - | - |
| `error` | Human-readable message. Endpoints priced per result report the shortfall instead, e.g. `"Not enough enrichment credits. You need 30 credits but only have 5 available."` |
| `code` | Always `insufficient_credits`. |
| `top_up_url` | Absolute URL of your credits page. Send users there to buy credits, then replay the request. |

`402` is retryable: top up (or wait for your plan to renew) and send the same
request again.

You can also receive `402` after the pre-flight check passes, if a concurrent
request drains the balance before this one is charged. Treat it the same way.

### `403 Forbidden` — workspace weekly limit reached

Your workspace has a weekly enrichment credit limit and this request would
exceed it. The balance itself is irrelevant here, so no `top_up_url` is
returned — buying credits does not lift the limit.

```json theme={null}
{
  "error": "You have reached your weekly enrichment credit limit for this workspace",
  "code": "workspace_limit_exceeded"
}
```

To unblock, a workspace admin has to raise the member's weekly allowance, or
you wait for the limit to reset.

> [!NOTE]
>
> `403` has other causes, none of which carry a `code`: a closed account
> (`"Account closed"`), LinkedIn refusing access to the profile, post or list
> you asked for (`"You don't have access to this LinkedIn resource."`), or an
> endpoint your plan does not include, such as
> [post engagers](https://docs.pipecorn.com/api-reference/endpoints/signals/post_engagers.md) below the
> Growth plan. Branch on `code`, not on the status alone:
> `workspace_limit_exceeded` is a spending limit, anything else is an access
> problem that topping up does not fix.

When both conditions apply — the balance is too low *and* the weekly limit is
reached — the API reports the balance first, with `402`.

### Endpoints that return these codes

* [`POST /contacts/single_enrich`](https://docs.pipecorn.com/api-reference/endpoints/enrichments/single)
* [`POST /contacts/bulk_enrich`](https://docs.pipecorn.com/api-reference/endpoints/enrichments/batch) (deprecated)
* [`POST /contacts/reverse_lookup`](https://docs.pipecorn.com/api-reference/endpoints/leads/reverse_email_lookup)
* [`POST /contacts/reverse_phone_lookup`](https://docs.pipecorn.com/api-reference/endpoints/leads/reverse_phone_lookup)
* [`POST /accounts/single_enrich`](https://docs.pipecorn.com/api-reference/endpoints/accounts/single)
* [`POST /leads/single_enrich`](https://docs.pipecorn.com/api-reference/endpoints/leads/single)
* [`POST /accounts/company_hiring`](https://docs.pipecorn.com/api-reference/endpoints/accounts/company-hiring)
* [`POST /accounts/company_stack`](https://docs.pipecorn.com/api-reference/endpoints/accounts/company-stack)
* [`POST /intents/accounts/hiring`](https://docs.pipecorn.com/api-reference/endpoints/signals/hiring)
* [`POST /intents/accounts/stack`](https://docs.pipecorn.com/api-reference/endpoints/signals/tech_stack)

Preview endpoints are free and never return either code.

Every one of them checks credits up-front, so a rejected request never runs a
provider, creates an import, or enqueues an enrichment.

### Migrating from the previous behaviour

These conditions used to be reported as:

* `422 Unprocessable Entity` — waterfall enrichment (async, bulk, and
  synchronous), `POST /accounts/company_hiring`, and
  `POST /accounts/company_stack`
* `422 Unprocessable Entity` with a plan-limit message — `POST /accounts/single_enrich`
  (`"Not enough company import limits left"`) and `POST /leads/single_enrich`
  (`"Not enough profile extraction limits left"`). Both are now priced in credits
  and answer `402`/`403` instead; they no longer draw on those plan quotas at all.
* `401 Unauthorized` — `POST /intents/accounts/hiring` and
  `POST /intents/accounts/stack`

These now answer `402` (or `403` for a workspace weekly limit). If your
integration detects an empty balance by matching on `422`/`401`, or by
string-matching the message, switch to the status code and `code` field. `422`
still covers validation errors and `401` still covers authentication (your API
key, or an expired LinkedIn session), so the old checks will silently stop
firing.

## `400 Bad Request` — malformed request body

A body that is not valid JSON is rejected before anything runs or is spent:

```json theme={null}
{
  "error": "Invalid JSON format in request body",
  "details": "<parser message>"
}
```

`details` carries the JSON parser's message. Depending on the endpoint, the
same mistake can come back as `{"error": "Invalid JSON"}`, and valid JSON that
is not an object (an array or a bare string) as
`{"error": "Request body must be a JSON object"}`. Fix the body and resend.

## `401 Unauthorized` — authentication

`401` has two causes. Tell them apart by the `error` text:

| `error` | Cause | Fix |
| - | - | - |
| `"No API key present"` | Neither `X-API-KEY` nor `X-WORKSPACE-KEY` was sent | Send your key. See [Authentication](https://docs.pipecorn.com/essentials/authentication.md) |
| `"Invalid API key"` | The key does not match any key | Check the key |
| `"LinkedIn cookie has expired. Please reconnect your LinkedIn account."` | Your key is valid, but LinkedIn rejected the session of the connected account while the request ran | Reconnect LinkedIn from the app, then retry |

Retrying with the same key never fixes the first two. The third is fixed by
reconnecting LinkedIn, not by changing the key. Some endpoints check the
LinkedIn connection before calling LinkedIn and report an expired one as a
`422` instead (see below).

## `403 Forbidden` — access

Besides the workspace weekly limit (`code: "workspace_limit_exceeded"`, see
above), `403` means the request is not allowed as sent:

| `error` | Cause |
| - | - |
| `"Account closed"` | The account the key belongs to is closed |
| `"You don't have access to this LinkedIn resource."` | LinkedIn refused access to the profile, post, company or list you asked for |
| `"This signal is part of the Growth plan. Upgrade to save these leads to a list."` | [Post engagers](https://docs.pipecorn.com/api-reference/endpoints/signals/post_engagers.md) is not included in your plan |

There are no per-key permission scopes: every key can call every endpoint your
plan includes.

## `404 Not Found`

A path that is not an API endpoint answers
`{"error": "Unknown endpoint: POST /api/v2/..."}`; check the method and the
path. An ID that does not exist (a search, a list, a persona) answers
`{"error": "Resource not found"}` or a message naming the resource.

## `409 Conflict` — idempotency key in use

Another request with the same `Idempotency-Key` is still being processed:

```json theme={null}
{ "error": "A request with this Idempotency-Key is still being processed", "code": "idempotency_key_in_use" }
```

Wait and retry with the same key. Reusing a key with a different body answers
`422` with `code: "idempotency_key_reused"`. See
[Retries and idempotency](https://docs.pipecorn.com/essentials/idempotency.md).

## `422 Unprocessable Entity` — validation

The request is well-formed but cannot run as sent: a parameter has the wrong
type or value, `limit` is outside 1–2500, `webhook_url` is not an `http(s)`
URL, a plan limit is reached (`"Can't proceed with the request. Plan limit
reached."`), or the endpoint needs a LinkedIn or Sales Navigator connection that
is missing or expired. On the Scale plan, an extraction past the plan limit is
queued with `202 Accepted` and `status: "queued"` instead; it answers `422` only
when it is larger than a whole day's quota. See
[Credits vs limits](https://docs.pipecorn.com/api-reference/credits-vs-limits.md#scale-requests-wait-for-the-reset). Fix the request (or reconnect LinkedIn from the app) and
resend; retrying it unchanged fails the same way.

## `429 Too Many Requests`

You went over a rate limit: `{"error": "Rate limit exceeded. Please wait before
retrying."}`. Past your plan limit the response carries a `Retry-After` header
with the seconds to wait. See [Rate limiting](https://docs.pipecorn.com/essentials/rate-limiting.md).

LinkedIn rate limits come back as `429` too, with no `Retry-After` header. The
body names the account LinkedIn throttled:

```json theme={null}
{
  "error": "Rate limited by LinkedIn. Please wait a few hours before retrying.",
  "account_email": "jane@acme.com"
}
```

With a workspace key, that member is left out of the rotation for 12 hours.
Every response also names the account that served it in the `Pipecorn-Account`
header, except a lead search that joins the
[workspace queue](https://docs.pipecorn.com/essentials/authentication.md#lead-search-queue).

## `500 Internal Server Error`

Something failed on our side. The request can be retried; if it keeps failing,
contact support with the endpoint and the time of the request.

An unexpected failure is not always rendered by the API itself, so a `500` body
may not be JSON (for example an HTML error page). Branch on the status code
and parse the body only if `Content-Type` is `application/json`.

## `502`, `503`, `504` — LinkedIn failures

Endpoints that call LinkedIn report a failure on LinkedIn's side with a
gateway status: `502` when LinkedIn answered with an error, `503` when it
answered that it is unavailable, and `504` when it timed out or could not be
reached. The body is:

```json theme={null}
{ "error": "LinkedIn request failed. Please retry later." }
```

These are transient: retry with a backoff.


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