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

# Add an external outbound call

> Post the necessary fields for the API to add a new outbound call.

Post the necessary fields for the API to add a new outbound call.

```http theme={null}
POST https://services.leadconnectorhq.com/conversations/messages/outbound
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Body

<ParamField body="type" type="string" required default="Call">
  Message Type Posibles valores: 'Call'
</ParamField>

<ParamField body="attachments" type="string[]">
  Array of attachments
</ParamField>

<ParamField body="conversationId" type="string" required default="ve9EPM428h8vShlRW1KT">
  Conversation Id
</ParamField>

<ParamField body="conversationProviderId" type="string" required default="61d6d1f9cdac7612faf80753">
  Conversation Provider Id
</ParamField>

<ParamField body="altId" type="string" default="61d6d1f9cdac7612faf80753">
  external mail provider's message id
</ParamField>

<ParamField body="date" type="string">
  Date of the outbound message
</ParamField>

<ParamField body="call" type="object">
  Phone call dialer and receiver information
</ParamField>

## Respuestas

<Accordion title="200 - Created the message">
  <ResponseField name="success" type="boolean" required />

  <ResponseField name="conversationId" type="string" required default="ABC12h2F6uBrIkfXYazb">
    Conversation ID.
  </ResponseField>

  <ResponseField name="messageId" type="string" required default="t22c6DQcTDf3MjRhwf77">
    This is the main Message ID
  </ResponseField>

  <ResponseField name="message" type="string" required />

  <ResponseField name="contactId" type="string" />

  <ResponseField name="dateAdded" type="string" />

  <ResponseField name="emailMessageId" type="string" />

  ```json theme={null}
  {
    "success": true,
    "conversationId": "ABC12h2F6uBrIkfXYazb",
    "messageId": "t22c6DQcTDf3MjRhwf77",
    "message": "string",
    "contactId": "string",
    "dateAdded": "2024-01-15T10:30:00Z",
    "emailMessageId": "string"
  }
  ```
</Accordion>

<Accordion title="400 - Bad Request">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://services.leadconnectorhq.com/conversations/messages/outbound' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "type": "Call",
    "attachments": [
      "string"
    ],
    "conversationId": "ve9EPM428h8vShlRW1KT",
    "conversationProviderId": "61d6d1f9cdac7612faf80753",
    "altId": "61d6d1f9cdac7612faf80753",
    "date": "2024-01-15T10:30:00Z"
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/conversations/messages/outbound', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"type": "Call", "attachments": ["string"], "conversationId": "ve9EPM428h8vShlRW1KT", "conversationProviderId": "61d6d1f9cdac7612faf80753", "altId": "61d6d1f9cdac7612faf80753", "date": "2024-01-15T10:30:00Z"}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/conversations/messages/outbound',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"type": "Call", "attachments": ["string"], "conversationId": "ve9EPM428h8vShlRW1KT", "conversationProviderId": "61d6d1f9cdac7612faf80753", "altId": "61d6d1f9cdac7612faf80753", "date": "2024-01-15T10:30:00Z"},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/conversations/messages/outbound');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode({'type': 'Call', 'attachments': ['string'], 'conversationId': 've9EPM428h8vShlRW1KT', 'conversationProviderId': '61d6d1f9cdac7612faf80753', 'altId': '61d6d1f9cdac7612faf80753', 'date': '2024-01-15T10:30:00Z'}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
