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

# Get Conversation Messages

> Retrieve messages from a specific conversation

Returns messages for a specific conversation with pagination support using continuation tokens.

## Request

<ParamField header="X-API-Key" type="string" required>
  Your API key
</ParamField>

<ParamField path="conversationId" type="string" required>
  The conversation/chat ID to fetch messages from
</ParamField>

<ParamField query="accountId" type="string" required>
  The LinkedIn sender account ID that owns this conversation
</ParamField>

<ParamField query="limit" type="integer" default="50">
  Number of messages to return (max: 100)
</ParamField>

<ParamField query="continuationToken" type="string">
  Token for fetching the next page of messages. Returned in the previous response.
</ParamField>

## Response

<ResponseField name="conversationId" type="string">
  The conversation ID
</ResponseField>

<ResponseField name="messages" type="array">
  Array of message objects

  <Expandable title="Message Object">
    <ResponseField name="id" type="string">
      Unique message identifier
    </ResponseField>

    <ResponseField name="content" type="string">
      Message content
    </ResponseField>

    <ResponseField name="sender" type="object">
      Message sender information

      <Expandable title="Sender Object">
        <ResponseField name="id" type="string">
          Sender's LinkedIn identifier
        </ResponseField>

        <ResponseField name="name" type="string">
          Sender's full name
        </ResponseField>

        <ResponseField name="profileUrl" type="string">
          Sender's LinkedIn profile URL
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="recipient" type="object">
      Message recipient information

      <Expandable title="Recipient Object">
        <ResponseField name="id" type="string">
          Recipient's LinkedIn identifier
        </ResponseField>

        <ResponseField name="name" type="string">
          Recipient's full name
        </ResponseField>

        <ResponseField name="profileUrl" type="string">
          Recipient's LinkedIn profile URL
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="direction" type="string">
      Message direction: `sent` or `received`
    </ResponseField>

    <ResponseField name="sentAt" type="string">
      ISO 8601 timestamp when the message was sent
    </ResponseField>

    <ResponseField name="readStatus" type="string">
      Read status: `read`, `unread`, or `unknown`
    </ResponseField>

    <ResponseField name="contentType" type="string">
      Content type: `TEXT`, `IMAGE`, `FILE`, etc.
    </ResponseField>

    <ResponseField name="attachments" type="array">
      Array of attachments (if any)

      <Expandable title="Attachment Object">
        <ResponseField name="type" type="string">
          Attachment type
        </ResponseField>

        <ResponseField name="url" type="string">
          Attachment URL
        </ResponseField>

        <ResponseField name="name" type="string">
          Attachment filename
        </ResponseField>

        <ResponseField name="size" type="integer">
          Attachment size in bytes
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="pagination" type="object">
  Pagination metadata

  <Expandable title="Pagination Object">
    <ResponseField name="hasMore" type="boolean">
      Whether there are more messages to fetch
    </ResponseField>

    <ResponseField name="continuationToken" type="string">
      Token to use for fetching the next page of messages
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.sendpilot.ai/v1/inbox/conversations/2-OVp-y-UNyFXBYvx0FqmQ/messages?accountId=sender_abc123&limit=50" \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const conversationId = '2-OVp-y-UNyFXBYvx0FqmQ';
  const response = await fetch(
    `https://api.sendpilot.ai/v1/inbox/conversations/${conversationId}/messages?accountId=sender_abc123&limit=50`,
    {
      headers: {
        'X-API-Key': process.env.SENDPILOT_API_KEY
      }
    }
  );
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  conversation_id = '2-OVp-y-UNyFXBYvx0FqmQ'
  response = requests.get(
      f'https://api.sendpilot.ai/v1/inbox/conversations/{conversation_id}/messages',
      params={
          'accountId': 'sender_abc123',
          'limit': 50
      },
      headers={'X-API-Key': 'YOUR_API_KEY'}
  )
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "conversationId": "2-OVp-y-UNyFXBYvx0FqmQ",
    "messages": [
      {
        "id": "msg_abc123",
        "content": "Hi John! Thanks for connecting. I wanted to follow up on our conversation about your company's growth plans.",
        "sender": {
          "id": "jane-smith-12345",
          "name": "Jane Smith",
          "profileUrl": "https://www.linkedin.com/in/jane-smith"
        },
        "recipient": {
          "id": "john-doe-67890",
          "name": "John Doe",
          "profileUrl": "https://www.linkedin.com/in/john-doe"
        },
        "direction": "sent",
        "sentAt": "2024-02-24T14:00:00.000Z",
        "readStatus": "read",
        "contentType": "TEXT"
      },
      {
        "id": "msg_def456",
        "content": "Thanks for reaching out! I'd love to discuss this further. Are you available for a call next week?",
        "sender": {
          "id": "john-doe-67890",
          "name": "John Doe",
          "profileUrl": "https://www.linkedin.com/in/john-doe"
        },
        "recipient": {
          "id": "jane-smith-12345",
          "name": "Jane Smith",
          "profileUrl": "https://www.linkedin.com/in/jane-smith"
        },
        "direction": "received",
        "sentAt": "2024-02-24T15:30:00.000Z",
        "readStatus": "unread",
        "contentType": "TEXT"
      }
    ],
    "pagination": {
      "hasMore": true,
      "continuationToken": "eyJjb250aW51YXRpb24iOiIxNzA4Nzg0MjAwMDAwIn0="
    }
  }
  ```

  ```json 404 theme={null}
  {
    "statusCode": 404,
    "error": "Not Found",
    "code": "SENDER_NOT_FOUND",
    "message": "LinkedIn sender with ID 'sender_abc123' not found in this workspace"
  }
  ```
</ResponseExample>

<Note>
  The `accountId` parameter is required to verify that the conversation belongs to a LinkedIn account in your workspace.
</Note>

<Tip>
  Use the `continuationToken` from the response to fetch older messages. Pass it as a query parameter in subsequent requests.
</Tip>


## OpenAPI

````yaml GET /v1/inbox/conversations/{conversationId}/messages
openapi: 3.0.0
info:
  title: SendPilot External API
  description: >
    The SendPilot API enables you to programmatically manage LinkedIn outreach
    campaigns,

    add leads, update lead statuses, send messages, and receive real-time
    webhook notifications.
  version: 1.0.0
  contact:
    name: SendPilot Support
    email: support@sendpilot.ai
    url: https://sendpilot.ai
servers:
  - url: https://api.sendpilot.ai
    description: Production server
security:
  - ApiKeyAuth: []
tags:
  - name: Credits
    description: Credits and quota management
  - name: Campaigns
    description: Campaign management endpoints
  - name: Leads
    description: Lead management endpoints
  - name: Lead Database
    description: Lead Database search endpoints
  - name: Lead Extractor
    description: Lead extraction campaign endpoints
  - name: Inbox
    description: Direct messaging endpoints
paths:
  /v1/inbox/conversations/{conversationId}/messages:
    get:
      tags:
        - Inbox
      summary: Get conversation messages
      description: >
        Retrieve messages from a specific conversation with pagination support
        using continuation tokens.

        The `accountId` parameter is required to verify that the conversation
        belongs to a LinkedIn account in your workspace.
      operationId: getConversationMessages
      parameters:
        - name: conversationId
          in: path
          required: true
          description: The conversation/chat ID to fetch messages from
          schema:
            type: string
        - name: accountId
          in: query
          required: true
          description: The LinkedIn sender account ID that owns this conversation
          schema:
            type: string
        - name: limit
          in: query
          description: Number of messages to return (max 100)
          schema:
            type: integer
            default: 50
            minimum: 1
            maximum: 100
        - name: continuationToken
          in: query
          description: >-
            Token for fetching the next page of messages. Returned in the
            previous response.
          schema:
            type: string
      responses:
        '200':
          description: Conversation messages
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationMessagesResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    ConversationMessagesResponse:
      type: object
      properties:
        conversationId:
          type: string
        messages:
          type: array
          items:
            $ref: '#/components/schemas/ConversationMessage'
        pagination:
          $ref: '#/components/schemas/ContinuationPagination'
      required:
        - conversationId
        - messages
        - pagination
    ConversationMessage:
      type: object
      properties:
        id:
          type: string
          description: Unique message identifier
        content:
          type: string
          description: Message content
        sender:
          $ref: '#/components/schemas/MessageParty'
        recipient:
          $ref: '#/components/schemas/MessageParty'
        direction:
          type: string
          enum:
            - sent
            - received
        sentAt:
          type: string
          format: date-time
        readStatus:
          type: string
          enum:
            - read
            - unread
            - unknown
        contentType:
          type: string
          description: 'Content type: TEXT, IMAGE, FILE, etc.'
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/MessageAttachment'
      required:
        - id
        - content
        - direction
        - sentAt
    ContinuationPagination:
      type: object
      properties:
        continuationToken:
          type: string
          description: Token to use for fetching the next page
        limit:
          type: integer
          description: Items per page
        hasMore:
          type: boolean
          description: Whether there are more results to fetch
      required:
        - hasMore
    Error:
      type: object
      properties:
        statusCode:
          type: integer
        error:
          type: string
        code:
          type: string
        message:
          type: string
      required:
        - statusCode
        - message
    MessageParty:
      type: object
      properties:
        id:
          type: string
          description: LinkedIn identifier
        name:
          type: string
          description: Full name
        profileUrl:
          type: string
          description: LinkedIn profile URL
    MessageAttachment:
      type: object
      properties:
        type:
          type: string
          description: Attachment type
        url:
          type: string
          description: Attachment URL
        name:
          type: string
          description: Attachment filename
        size:
          type: integer
          description: Attachment size in bytes
  responses:
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for authentication

````