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

# Send message

> Send a text message from a connected token.

The token must be paired and `connected: true`.

Use `Idempotency-Key` for retries so the same request does not send twice.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.wadial.com/api/v1/sessions/{sessionId}/messages" \
    -H "Authorization: Bearer $WADIAL_API_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: order-123-ready-v1" \
    -d '{"to":"15551234567","content":{"type":"text","text":"Your order is ready."}}'
  ```

  ```js JavaScript theme={null}
  const response = await fetch("https://api.wadial.com/api/v1/sessions/{sessionId}/messages", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.WADIAL_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": "order-123-ready-v1",
    },
    body: JSON.stringify({
      to: "15551234567",
      content: { type: "text", text: "Your order is ready." },
    }),
  });
  const { data } = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "data": {
      "to": "15551234567",
      "text": "Your order is ready.",
      "contentType": "text",
      "mediaUrl": null,
      "status": "sent",
      "messageId": "wamid..."
    }
  }
  ```
</ResponseExample>
