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

# Send Message

> Send a direct message via LinkedIn to a recipient by their LinkedIn URL

Send a LinkedIn message directly to a recipient. The recipient must be a 1st-degree connection of the sender (connection must already be accepted).

## Request

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

<ParamField body="senderId" type="string" required>
  The LinkedIn sender account ID to use. Get available senders from the [List Senders](/api-reference/endpoint/get-senders) endpoint.
</ParamField>

<ParamField body="recipientLinkedinUrl" type="string" required>
  The LinkedIn profile URL of the recipient (e.g., `https://www.linkedin.com/in/john-doe`)
</ParamField>

<ParamField body="message" type="string" required>
  The message content to send (max 8000 characters)
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the message was sent successfully
</ResponseField>

<ResponseField name="messageId" type="string">
  Unique identifier for the sent message
</ResponseField>

<ResponseField name="recipientLinkedinUrl" type="string">
  The LinkedIn URL of the recipient
</ResponseField>

<ResponseField name="status" type="string">
  Message status: `sent`
</ResponseField>

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

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.sendpilot.ai/v1/inbox/send \
    -H "X-API-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "senderId": "sender_abc123",
      "recipientLinkedinUrl": "https://www.linkedin.com/in/john-doe",
      "message": "Hi John! Thanks for connecting. I wanted to follow up on our conversation about..."
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.sendpilot.ai/v1/inbox/send', {
    method: 'POST',
    headers: {
      'X-API-Key': process.env.SENDPILOT_API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      senderId: 'sender_abc123',
      recipientLinkedinUrl: 'https://www.linkedin.com/in/john-doe',
      message: 'Hi John! Thanks for connecting...'
    })
  });
  const result = await response.json();
  ```

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

  response = requests.post(
      'https://api.sendpilot.ai/v1/inbox/send',
      headers={
          'X-API-Key': 'YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'senderId': 'sender_abc123',
          'recipientLinkedinUrl': 'https://www.linkedin.com/in/john-doe',
          'message': 'Hi John! Thanks for connecting...'
      }
  )
  result = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "messageId": "msg_xyz789",
    "recipientLinkedinUrl": "https://www.linkedin.com/in/john-doe",
    "status": "sent",
    "timestamp": "2024-02-24T15:30:00.000Z"
  }
  ```

  ```json 400 theme={null}
  {
    "statusCode": 400,
    "error": "Bad Request",
    "code": "SENDER_NOT_ACTIVE",
    "message": "LinkedIn sender 'sender_abc123' is not active. Current status: disconnected"
  }
  ```

  ```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"
  }
  ```

  ```json 429 theme={null}
  {
    "statusCode": 429,
    "error": "Too Many Requests",
    "code": "DAILY_LIMIT_EXCEEDED",
    "message": "LinkedIn sender 'sender_abc123' has reached its daily message limit. Resets at midnight UTC."
  }
  ```
</ResponseExample>

<Warning>
  Messages can only be sent to recipients who are 1st-degree connections of the sender. Attempting to message a non-connected profile will result in an error.
</Warning>

<Note>
  When a message is sent, a `message.sent` webhook event will be triggered if you have webhooks configured.
</Note>

<Tip>
  To send a message to a lead by their ID (with automatic LinkedIn URL lookup), use the [Send Message to Lead](/api-reference/endpoint/post-send-to-lead) endpoint instead.
</Tip>


## OpenAPI

````yaml POST /v1/inbox/send
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/send:
    post:
      tags:
        - Inbox
      summary: Send message
      description: Send a direct message to a lead via LinkedIn
      operationId: sendMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageRequest'
      responses:
        '200':
          description: Message sent successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendMessageResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    SendMessageRequest:
      type: object
      properties:
        senderId:
          type: string
          description: LinkedIn sender account ID to use
        recipientLinkedinUrl:
          type: string
          description: LinkedIn profile URL of the recipient
        message:
          type: string
          description: Message content (max 8000 characters)
          maxLength: 8000
        campaignId:
          type: string
          description: Optional campaign ID for tracking
        leadId:
          type: string
          description: Optional lead ID for tracking
      required:
        - senderId
        - recipientLinkedinUrl
        - message
    SendMessageResponse:
      type: object
      properties:
        success:
          type: boolean
        messageId:
          type: string
        recipientLinkedinUrl:
          type: string
        leadId:
          type: string
        status:
          type: string
          enum:
            - queued
            - sent
        timestamp:
          type: string
          format: date-time
      required:
        - success
        - messageId
        - recipientLinkedinUrl
        - status
        - timestamp
    Error:
      type: object
      properties:
        statusCode:
          type: integer
        error:
          type: string
        code:
          type: string
        message:
          type: string
      required:
        - statusCode
        - message
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    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

````