---
updatedAt: 2026-01-21T05:21:58.000Z
agentTools:
  projectIndex: https://developers.kaleyra.io/llms.txt
---

# Preview of the URL

POST Method

When you send a link in the message, the Preview URL parameter will display the preview of the landing page associated with that link. You have to add the **preview\_url** parameter and set the value as **True** in the request.

> 📘 Note:
>
> The preview of the URL is only supported for the non-template type (text) of messages.

<br />

To display the preview of the URL, perform the following steps:

1. Before you get started, [Create an API](https://developers.kaleyra.io/docs/generating-an-api-key) Key. To view the API Key and the SID, see [View API Key and SID](https://developers.kaleyra.io/docs/view-api-key-and-sid).\
   A prerequisite for using Kaleyra WhatsApp APIs is to have an active WhatsApp plan on kaleyra.io.
2. To set up a WhatsApp account on kaleyra.io, see: [Manual Signup](https://developers.kaleyra.io/docs/manual-signup) and [Embedded Signup](https://developers.kaleyra.io/docs/embedded-signup).

## Base URL

`https://<api_domain>/v1/<SID>`

## API Domain and Value

| api\_domain | Value             |
| :---------- | :---------------- |
| IN pod      | api.in.kaleyra.io |
| SG Pod      | api.ap.kaleyra.io |
| EU Pod      | api.eu.kaleyra.io |

## API request to Preview the URL

To display the preview of the URL, use the `/messages` endpoint.

## Request Format

The following is the request format to display the preview of the URL:

```curl
curl -X POST \ 'https://<api_domain>/<sid>/messages' \
--header 'api-key: <api_key>' \
--form 'to= <to>' \
--form 'type= <message_type>' \
--form 'body= <body_text>' \
--form 'channel= <channel_name>' \
--form 'from= <from_number>' \
--form 'callback_url= <callback_url>' \
--form 'preview_url= <preview_url>' \
--form 'lang_code= <lang_code>'
```

## Sample Request Format

The following is the sample request format to display the preview of the URL:

```curl
curl -X POST \ 'https://api.in.kaleyra.io/v1/HXAP16XXXXXX97IN/messages' \
--header 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3' \
--form 'to="91XXXXXXXXXX"' \
--form 'type="text"' \
--form 'body="Hi, Your order has been shipped."' \
--form 'channel="whatsapp"' \
--form 'from="91XXXXXXXXXX"' \
--form 'callback_url="https://trees.free.beeceptor.com"' \
--form 'preview_url="True"' \
--form 'lang_code="en"'
```

## Parameter and Data Types

The following is the list of parameters and data types supported to display the preview of the URL:

<Table align={["left","left","left","left","left"]}>
  <thead>
    <tr>
      <th>
        Parameter
      </th>

      <th>
        Data Type
      </th>

      <th>
        Description
      </th>

      <th>
        Examples
      </th>

      <th>
        Mandatory?
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `sid`
      </td>

      <td>
        String
      </td>

      <td>
        Account SID (Security Identifier)
      </td>

      <td>
        HXAP16XXXXXX97IN
      </td>

      <td>
        Yes
      </td>
    </tr>

    <tr>
      <td>
        `api_key`
      </td>

      <td>
        String
      </td>

      <td>
        Your API Key generated by Kaleyra.io.
      </td>

      <td>
        Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3
      </td>

      <td>
        Yes
      </td>
    </tr>

    <tr>
      <td>
        `to_number`
      </td>

      <td>
        String
      </td>

      <td>
        A valid WhatsApp number of the recipient. Ensure that the country code is prefixed to the number. (E164 format).

        Note: You can add multiple recipients, separate each number using the comma (,) delimiter.
      </td>

      <td>
        91XXXXXXXXXX
      </td>

      <td>
        Yes
      </td>
    </tr>

    <tr>
      <td>
        `message_type`
      </td>

      <td>
        String
      </td>

      <td>
        Message format for the message.
      </td>

      <td>
        text
      </td>

      <td>
        Yes
      </td>
    </tr>

    <tr>
      <td>
        `body_text`
      </td>

      <td>
        String
      </td>

      <td>
        Content of the message. You must include the link of the web page here.
      </td>

      <td>
        Hi, your order has been shipped.
      </td>

      <td>
        Yes
      </td>
    </tr>

    <tr>
      <td>
        `channel_name`
      </td>

      <td>
        String
      </td>

      <td>
        Channel on which message must be sent.
      </td>

      <td>
        WhatsApp
      </td>

      <td>
        Yes
      </td>
    </tr>

    <tr>
      <td>
        `from_number`
      </td>

      <td>
        String
      </td>

      <td>
        The number registered with WhatsApp business from which the message is to be sent. Ensure that the country code is prefixed to the number. (E164 format).
      </td>

      <td>
        91XXXXXXXXXX
      </td>

      <td>
        Yes
      </td>
    </tr>

    <tr>
      <td>
        `callback_url`
      </td>

      <td>
        String
      </td>

      <td>
        Specifies the callback URL to receive notifications regarding the WhatsApp message status (sent, delivered, read, and failed). For more information related to callback profiles, see the [Callback profiles](https://developers.kaleyra.io/docs/account-settings-callback-profiles) page.  
        The URL can be accessed publicly.  
        Click [here](https://developers.kaleyra.io/docs/whatsapp-callback-url#callback-url) for an example.
      </td>

      <td>
        [https://webhook.site/4e196e4c-cf5d-43c7-aaec-53a476b9a2f9](https://webhook.site/4e196e4c-cf5d-43c7-aaec-53a476b9a2f9)
      </td>

      <td>
        No
      </td>
    </tr>

    <tr>
      <td>
        `preview_url`
      </td>

      <td>
        String
      </td>

      <td>
        The URL you want to include in the message
      </td>

      <td>
        True
      </td>

      <td>
        Yes
      </td>
    </tr>

    <tr>
      <td>
        `language_code`
      </td>

      <td>
        String
      </td>

      <td>
        The language in which, you want to preview the URL.
      </td>

      <td>
        en
      </td>

      <td>
        Yes
      </td>
    </tr>
  </tbody>
</Table>

## Sample Success Response

The following success message appears with status 202 Accepted:

```json
{
    "id": "bae7XXX8-4ad5-4eXX-a60f-6ce60aXXXX39",
    "type": "text",
    "body": "https://www.facebook.com/KaleyraPlatform",
    "createdDateTime": "2020-10-12 10:40:32+00:00",
    "totalCount": 1,
    "data": [
        {
            "message_id": "bae79XXX-4ad5-4eXX-a60f-6ce60a3XXXX9:0",
            "recipient": "91xxxxxxxxxx"
        }
    ],
    "error": {}
}
```