# LinkedIn inbox

> Read the LinkedIn conversations of every account of your workspace in one inbox, reply to them and mark them read, from your own code.

Source: https://docs.emelia.io/docs/linkedin-inbox

The LinkedIn inbox gathers the conversations of every LinkedIn account of your workspace in one list. Each conversation says which account holds it (`authId`, `accountName`) and who is on the other side (`attendee`). A reply always leaves from the account that holds the conversation.

## The flow

1. **List the conversations** waiting for you, with `unread=true`.
2. **Read the messages** of a conversation.
3. **Reply**, then **mark the conversation read**.

Reading a list or a conversation never marks it read: only the read route does.

## List the unread conversations

[`GET /linkedin-inbox/chats`](https://docs.emelia.io/docs/linkedin-inbox/list-conversations.md)

**curl**

```bash
curl "https://api.emelia.io/linkedin-inbox/chats?unread=true&limit=20" \
  -H "Authorization: $EMELIA_API_KEY"
```

**JavaScript**

```js
const res = await fetch('https://api.emelia.io/linkedin-inbox/chats?unread=true&limit=20', {
  headers: { Authorization: process.env.EMELIA_API_KEY },
});
const { items, cursor } = await res.json();
```

**Python**

```python
res = requests.get(
    "https://api.emelia.io/linkedin-inbox/chats",
    params={"unread": "true", "limit": 20},
    headers={"Authorization": key},
)
items, cursor = res.json()["items"], res.json()["cursor"]
```

```json
{
  "success": true,
  "items": [
    {
      "id": "Hk3pX8vQTqOAb1sZ0mN4yw",
      "authId": "6650f1a2b839d80011c5a0bb",
      "accountName": "Claire Fontaine",
      "attendee": {
        "id": "aT9fK2mQRbyLw0Xc4ZpV1g",
        "provider_id": "ACoAAB4kq9sBxL0m2vTnR8yZ7pQe1wXcD3fA6hU",
        "name": "Julien Moreau",
        "picture_url": "https://media.licdn.com/dms/image/v2/D4E03AQF8x9kQ2mT1bw/profile-displayphoto-shrink_100_100/0/1715000000000",
        "headline": "Head of Sales at Nexora"
      },
      "timestamp": "2026-11-25T09:42:10.000Z",
      "unread_count": 1,
      "read_only": 0,
      "content_type": null,
      "folder": ["INBOX_LINKEDIN_CLASSIC"]
    }
  ],
  "cursor": "eyJvZmZzZXQiOjIwfQ"
}
```

* The most recent conversation comes first. Send `cursor` back to get the next page; it is `null` on the last page.
* `accounts` keeps the conversations of some accounts only: the `id` of [LinkedIn accounts](https://docs.emelia.io/docs/linkedin-accounts.md), separated by commas.
* `after` and `before` keep the conversations whose last message is in a date range.

To find the conversation with one person, search by name:

[`GET /linkedin-inbox/search`](https://docs.emelia.io/docs/linkedin-inbox/find-by-name.md)

```bash
curl "https://api.emelia.io/linkedin-inbox/search?q=moreau" \
  -H "Authorization: $EMELIA_API_KEY"
```

## Read the messages

[`GET /linkedin-inbox/chats/{chatId}/messages`](https://docs.emelia.io/docs/linkedin-inbox/list-messages.md)

**curl**

```bash
curl "https://api.emelia.io/linkedin-inbox/chats/Hk3pX8vQTqOAb1sZ0mN4yw/messages?limit=50" \
  -H "Authorization: $EMELIA_API_KEY"
```

**JavaScript**

```js
const res = await fetch(`https://api.emelia.io/linkedin-inbox/chats/${chatId}/messages?limit=50`, {
  headers: { Authorization: process.env.EMELIA_API_KEY },
});
const messages = (await res.json()).items.filter((m) => !m.is_event);
```

**Python**

```python
res = requests.get(
    f"https://api.emelia.io/linkedin-inbox/chats/{chat_id}/messages",
    params={"limit": 50},
    headers={"Authorization": key},
)
messages = [m for m in res.json()["items"] if not m["is_event"]]
```

```json
{
  "success": true,
  "items": [
    {
      "id": "r7Tq2LmXSoW9cVbE5aJk0g",
      "chat_id": "Hk3pX8vQTqOAb1sZ0mN4yw",
      "text": "Thursday at 10 works for me. Can you send me a calendar invite?",
      "timestamp": "2026-11-25T09:42:10.000Z",
      "is_sender": 0,
      "sender_id": "ACoAAB4kq9sBxL0m2vTnR8yZ7pQe1wXcD3fA6hU",
      "message_type": "MESSAGE",
      "attachments": [],
      "reactions": [],
      "deleted": 0,
      "is_event": 0,
      "hidden": 0
    }
  ],
  "cursor": null
}
```

| Field          | Meaning                                                                                                                              |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `is_sender`    | `1`: sent by your account. `0`: sent by the other person.                                                                            |
| `is_event`     | `1`: an event of the conversation, such as a reaction, not a message.                                                                |
| `message_type` | `MESSAGE`, or `INMAIL`, `INMAIL_ACCEPT`, `INMAIL_DECLINE`, `INMAIL_REPLY` for an InMail, `INVITATION` for the note of an invitation. |
| `attachments`  | Files of the message. Download one with its `id`.                                                                                    |

The most recent message comes first. Send `cursor` back to get older messages.

[`GET /linkedin-inbox/messages/{messageId}/attachments/{attachmentId}`](https://docs.emelia.io/docs/linkedin-inbox/download-attachment.md)

## Reply

[`POST /linkedin-inbox/chats/{chatId}/messages`](https://docs.emelia.io/docs/linkedin-inbox/send-reply.md)

**curl**

```bash
curl -X POST "https://api.emelia.io/linkedin-inbox/chats/Hk3pX8vQTqOAb1sZ0mN4yw/messages" \
  -H "Authorization: $EMELIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Great, I just sent you an invite for Thursday at 10. Talk soon!"}'
```

**JavaScript**

```js
await fetch(`https://api.emelia.io/linkedin-inbox/chats/${chatId}/messages`, {
  method: 'POST',
  headers: { Authorization: process.env.EMELIA_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({ text: 'Great, I just sent you an invite for Thursday at 10. Talk soon!' }),
});
```

**Python**

```python
requests.post(
    f"https://api.emelia.io/linkedin-inbox/chats/{chat_id}/messages",
    json={"text": "Great, I just sent you an invite for Thursday at 10. Talk soon!"},
    headers={"Authorization": key},
)
```

The message leaves at once, from the account that holds the conversation, and cannot be taken back. To attach files, send `multipart/form-data` with `text` and up to 10 `attachments` of 20 MB each:

```bash
curl -X POST "https://api.emelia.io/linkedin-inbox/chats/Hk3pX8vQTqOAb1sZ0mN4yw/messages" \
  -H "Authorization: $EMELIA_API_KEY" \
  -F "text=Here is the deck we talked about." \
  -F "attachments=@nexora-proposal.pdf"
```

> **Conversations that accept no reply.** LinkedIn accepts no reply to a sponsored message, for example. Such a conversation has `read_only: 1`, and a reply is refused with `422` `CHAT_READ_ONLY`: nothing is sent.

## Mark the conversation read

[`PATCH /linkedin-inbox/chats/{chatId}/read`](https://docs.emelia.io/docs/linkedin-inbox/mark-read-or-unread.md)

```bash
curl -X PATCH "https://api.emelia.io/linkedin-inbox/chats/Hk3pX8vQTqOAb1sZ0mN4yw/read" \
  -H "Authorization: $EMELIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value": true}'
```

`"value": false` marks it unread again. The state changes on LinkedIn too.

## Errors

| Status | `code`                      | What to do                                                                                                                                                         |
| ------ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `400`  | `LINKEDIN_INBOX_NO_ACCOUNT` | No LinkedIn account of the workspace is connected to the inbox, or none of the `accounts` you sent. Connect one: see [LinkedIn accounts](https://docs.emelia.io/docs/linkedin-accounts.md). |
| `400`  | `INBOX_MESSAGE_EMPTY`       | The reply has no text and no file.                                                                                                                                 |
| `404`  | `CONVERSATION_NOT_FOUND`    | Unknown conversation, or one of an account outside your workspace.                                                                                                 |
| `409`  | `ACCOUNT_DISCONNECTED`      | The LinkedIn account must be reconnected: create a connection link with its `authId`.                                                                              |
| `422`  | `CHAT_READ_ONLY`            | LinkedIn accepts no reply in this conversation.                                                                                                                    |
| `429`  | `RATE_LIMITED`              | LinkedIn is limiting the requests of the account. Wait a few minutes.                                                                                              |

## Good to know

* The objects keep the field names of LinkedIn messaging (`snake_case`), plus `authId`, `accountName` and `attendee` added by Emelia. They can carry more fields than this reference describes: do not rely on those, they can change without notice.
* `picture_url` is a temporary LinkedIn link: store the picture if you need it later.
* The search matches the names of the people of your conversations, refreshed every 10 minutes. It only covers one to one conversations.
* Starting a new conversation is not available through the API: send a first message with a [campaign](https://docs.emelia.io/docs/campaigns.md).
