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

# Update message status

> Post the necessary fields for the API to update message status.

Post the necessary fields for the API to update message status.

```http theme={null}
PUT https://services.leadconnectorhq.com/conversations/messages/{messageId}/status
```

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

## Path parameters

<ParamField path="messageId" type="string" required default="ve9EPM428h8vShlRW1KT">
  Message Id
</ParamField>

## Body

<ParamField body="status" type="string" required default="read">
  Message status Posibles valores: 'delivered', 'failed', 'pending', 'read'
</ParamField>

<ParamField body="error" type="object">
  Error object from the conversation provider
</ParamField>

<ParamField body="emailMessageId" type="string" default="ve9EPM428h8vShlRW1KT">
  Email message Id
</ParamField>

<ParamField body="recipients" type="string[]">
  Email delivery status for additional email recipients.
</ParamField>

## Respuestas

<Accordion title="200 - Created the message">
  <ResponseField name="conversationId" type="string" required default="ABC12h2F6uBrIkfXYazb">
    Conversation ID.
  </ResponseField>

  <ResponseField name="emailMessageId" type="string" default="rnGyqh2F6uBrIkfhFo9A">
    This contains the email message id (only for Email type). Use this ID to send inbound replies to GHL to create a threaded email.
  </ResponseField>

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

  <ResponseField name="messageIds" type="string[]">
    When sending via the GMB channel, we will be returning list of `messageIds` instead of single `messageId`.
  </ResponseField>

  <ResponseField name="msg" type="string" default="Message queued successfully.">
    Additional response message when sending a workflow message
  </ResponseField>

  <ResponseField name="forwardData" type="object">
    Optional metadata for forwarded email
  </ResponseField>

  <ResponseField name="status" type="string" required default="delivered">
    Message status Posibles valores: 'delivered', 'failed', 'pending', 'read'
  </ResponseField>

  ```json theme={null}
  {
    "conversationId": "ABC12h2F6uBrIkfXYazb",
    "emailMessageId": "rnGyqh2F6uBrIkfhFo9A",
    "messageId": "t22c6DQcTDf3MjRhwf77",
    "messageIds": [
      "string"
    ],
    "msg": "Message queued successfully.",
    "forwardData": {
      "forwardWholeThread": false,
      "messageId": "t22c6DQcTDf3MjRhwf77",
      "emailMessageId": "rnGyqh2F6uBrIkfhFo9A",
      "forwardToEmail": "recipient@example.com",
      "recipientContactId": "DEF56h2F6uBrIkfXYacd"
    },
    "status": "delivered"
  }
  ```
</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 PUT 'https://services.leadconnectorhq.com/conversations/messages/YOUR_messageId/status' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "status": "read",
    "emailMessageId": "ve9EPM428h8vShlRW1KT",
    "recipients": [
      "string"
    ]
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/conversations/messages/YOUR_messageId/status', {
    method: 'PUT',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"status": "read", "emailMessageId": "ve9EPM428h8vShlRW1KT", "recipients": ["string"]}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'PUT',
      'https://services.leadconnectorhq.com/conversations/messages/YOUR_messageId/status',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"status": "read", "emailMessageId": "ve9EPM428h8vShlRW1KT", "recipients": ["string"]},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/conversations/messages/YOUR_messageId/status');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'PUT',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode({'status': 'read', 'emailMessageId': 've9EPM428h8vShlRW1KT', 'recipients': ['string']}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
