# Common Errors

Errors any Linked API request can return, with HTTP statuses and fixes – and where errors of workflows, actions and the Admin API are described.

> The API Reference is also the SDK and CLI reference. Consecutive code fences marked `tab=HTTP`, `tab=Node`, `tab=Python` and `tab=CLI` are the same call on each surface (a fence marked `tab=HTTP,CLI` is the same text for both), and a block between `:::surface <names>` and `:::` applies only to the surfaces it names. Identifiers in the text are written as in Node and in HTTP JSON (camelCase); the Python SDK spells methods, parameters and result attributes in snake_case (`sendMessage` → `send_message`, `reconnectionLink` → `reconnection_link`), while names inside HTTP JSON stay camelCase.

When a request fails, the response has `success: false` and an `error` object (see [Response structure](/docs/making-requests#response-structure)):

```json
{
  "success": false,
  "error": {
    "type": "invalidLinkedApiToken",
    "message": "The provided 'linked-api-token' is invalid."
  }
}
```

- `type` – the error identifier. Handle errors in your code by `type`.
- `message` – a human-readable explanation for logs and people.

:::surface http
The same request with an invalid `linked-api-token`, and the response it gets:
:::

:::surface node,python
In the SDKs a failed request throws `LinkedApiError` with the same `type` and `message`:
:::

:::surface cli
In the CLI a failed request writes the same `type` and `message` to stderr as `{"error", "message"}` and exits with a non-zero [exit code](/cli/flags-and-output#exit-codes): `2` for token errors, `3` for subscription errors, `6` for `tooManyRequests`.
:::

```bash tab=HTTP
curl -i -X POST https://api.linkedapi.io/workflows \
  -H "Content-Type: application/json" \
  -H "linked-api-token: invalid-token" \
  -H "identification-token: your-identification-token" \
  -d '{"actionType": "st.checkConnectionStatus", "personUrl": "https://www.linkedin.com/in/person1"}'
# HTTP/2 401
# {"success":false,"error":{"type":"invalidLinkedApiToken","message":"The provided 'linked-api-token' is invalid."}}
```

```typescript tab=Node
import { LinkedApiError } from "@linkedapi/node";

try {
  const workflow = await linkedapi.checkConnectionStatus.execute({
    personUrl: "https://www.linkedin.com/in/person1"
  });
} catch (e) {
  if (e instanceof LinkedApiError) {
    console.error(e.type, e.message);
  }
}
```

```python tab=Python
from linkedapi import CheckConnectionStatusParams, LinkedApiError

try:
    workflow = linkedapi.check_connection_status.execute(
        CheckConnectionStatusParams(person_url="https://www.linkedin.com/in/person1")
    )
except LinkedApiError as e:
    print(e.type, e.message)
```

```bash tab=CLI
linkedin connection status https://www.linkedin.com/in/person1
echo $?
# stderr: {"error":"invalidLinkedApiToken","message":"The provided 'linked-api-token' is invalid."}
# stderr: Run "linkedin account update" to refresh your tokens.
# 2
```

:::surface node,python
A network failure throws it with the type `httpError`. See [Handling results](/sdks/handling-results).
:::

## Errors any request can return

These errors do not depend on the endpoint: they come from checks every request goes through – authorization and the request rate. Admin API requests do not use the `identification-token`, so the two errors about it never apply there.

| Type | HTTP status | Cause | What to do |
|------|-------------|-------|------------|
| `linkedApiTokenRequired` | 401 | The `linked-api-token` header is missing. | Add the header – see [Authorization](/docs/making-requests#authorization). |
| `invalidLinkedApiToken` | 401 | The `linked-api-token` value matches no token. | Copy the token again from the [platform](https://app.linkedapi.io/). |
| `identificationTokenRequired` | 401 | The `identification-token` header is missing. | Add the token of the LinkedIn account the request is for. |
| `invalidIdentificationToken` | 401 | The `identification-token` value matches no LinkedIn account, or the account has been deleted. | Copy the account token again from the [platform](https://app.linkedapi.io/). |
| `tooManyRequests` | 429 | More than 100 requests to one endpoint within 60 seconds with one `linked-api-token`, across all its LinkedIn accounts. Checking a workflow result with `GET /workflows/{workflowId}` allows 600. | Wait and retry. Spread requests over time instead of sending them in bursts. |
| `unexpectedError` | 400 | The request failed on the Linked API side. | Retry. If the error repeats, contact support. |

The `message` of each of these errors is fixed text:

| Type | `message` |
|------|-----------|
| `linkedApiTokenRequired` | `'linked-api-token' is missing in request headers.` |
| `invalidLinkedApiToken` | `The provided 'linked-api-token' is invalid.` |
| `identificationTokenRequired` | `'identification-token' is missing in request headers.` |
| `invalidIdentificationToken` | `The provided 'identification-token' is invalid.` |
| `tooManyRequests` | `Too many requests. Please try again later.` |
| `unexpectedError` | `Unexpected error: ` – the same for every such failure, without details |

## Errors described elsewhere

Errors that belong to one part of the API are described next to it:

- **Starting a workflow** – an invalid workflow, a missing subscription or Plus seat, a signed-out account, working hours: [Executing Workflows](/docs/executing-workflows#starting-workflows).
- **Actions inside a workflow** – errors an action reports in its result: [Actions Overview](/docs/actions-overview#common-errors) and each action page.
- **Signals** (coming soon) – [Managing Signals](/docs/managing-signals#errors).
- **Webhooks** – each method of [Managing Webhooks](/docs/admin-webhooks).
- **Admin API** – [Admin API Overview](/docs/admin-overview#common-errors).
