---
updatedAt: 2026-06-26T06:59:54.000Z
agentTools:
  projectIndex: https://partner-docs.gupshup.io/llms.txt
---

# Location-based Message Templates

Use this API to send a template that uses a location header your request must include a location header object.

> 📘 Note:
>
> 1. Sending Marketing Templates through MM Lite for enhanced delivery optimization. For more details, refer to [*MM Lite*](https://partner-docs.gupshup.io/docs/marketing-messages-lite-mm-lite-api) document.
> 2. Use the `recipient` parameter only when BSUID is enabled for the app.
> 3. When both `to` and `recipient` fields are used in the payload, the `to` field gets the priority.

## Request Parameters

<HTMLBlock>{`
<table style="width: 100%; border-collapse: collapse;">
<thead>
<tr>
  <th style="border: 1px solid #ddd; padding: 8px;">Key</th>
  <th style="border: 1px solid #ddd; padding: 8px;">Value</th>
  <th style="border: 1px solid #ddd; padding: 8px;">Description</th>
  <th style="border: 1px solid #ddd; padding: 8px;">Data type</th>
  <th style="border: 1px solid #ddd; padding: 8px;">Required/Optional</th>
  <th style="border: 1px solid #ddd; padding: 8px;">Constraints</th>
</tr>
</thead>
<tbody>
<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Authorization</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>{{PARTNER_APP_TOKEN}}</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Access Token for the application</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>String</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Required</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Should be a valid<br>Partner App Access<br>Token.</p>
</td>
</tr>
<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>appId</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>{{APP_ID}}</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>App ID to fetch the<br>access token</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>String</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Required</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>The ID should be a valid app Id of Gupshup.</p>
</td>
</tr>
<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>messaging_product</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>whatsapp</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Messaging product</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>String</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Required</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"></td>
</tr>
<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>recipient_type</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>individual</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Recipient type</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>String</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Required</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"></td>
</tr>
<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>to</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>91785876xxxx</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Destination phone number where the message needs to be sent</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>String</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Required (Can be optional if BSUID is enabled for the app and recipient parameter is used instead)</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Must be a valid phone number</p>
</td>
</tr>
<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>recipient</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>IN.461449821882xxxx</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Destination BSUID where the message needs to be sent</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>String</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Optional</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Must be a valid BSUID</p>
</td>
</tr>
<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>type</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>template</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Messaging type</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>String</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Required</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>The type should be <code>template</code> to send a template message.</p>
</td>
</tr>
<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>template</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p><code>{   	&quot;type&quot;:   	&quot;header&quot;,   	&quot;parameters&quot;: [   		{   			&quot;type&quot;:   			&quot;location&quot;,   			&quot;location&quot;:   			{   			&quot;latitude&quot;:   &quot;&lt;LATITUDE&gt;&quot;,   &quot;longitude&quot;:   &quot;&lt;LONGITUDE&gt;&quot;,   &quot;name&quot;:   &quot;&lt;NAME&gt;&quot;,   &quot;address&quot;:   &quot;&lt;ADDRESS&gt;&quot;   		}   		}   	]   }</code></p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Template message inside body</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Object</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Required</p>
</td>
  <td style="border: 1px solid #ddd; padding: 8px;"></td>
</tr>
</tbody>
</table>
`}</HTMLBlock>

## Sample Request

```curl
curl --location 'https://partner.gupshup.io/partner/app/{{APP_ID}}/v3/message' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--data '{
	"messaging_product": "whatsapp",
	"recipient_type": "individual",
  "to": "12245554792",
	"recipient": "IN.4614498218826882",
	"type": "template",
	"template": {
		"name": "order_delivery_update",
		"language": {
			"code": "en_US"
		},
		"components": [
			{
				"type": "header",
				"parameters": [
					{
						"type": "location",
						"location": {
							"latitude": "37.483307",
							"longitude": "122.148981",
							"name": "Pablo Morales",
							"address": "Hacker Way, Menlo Park, CA 94025"
						}
					}
				]
			},
			{
				"type": "body",
				"parameters": [
					{
						"type": "text",
						"text": "Pablo"
					},
					{
						"type": "text",
						"text": "566701"
					}
				]
			}
		]
	}
}'
```

## Sample Response

```json
{
	"messages": [
		{
			"id": "GUPSHUP_MESSAGE_ID"
		}
	],
	"messaging_product": "whatsapp",
	"contacts": [
		{
			"input": "DESTINATION_PHONE_NO",
			"wa_id": "DESTINATION_PHONE_NO"
		}
	]
}
```

## Status Codes

| Status Code | Response                                                                                                                                                                                                                    | Comments                                       |
| :---------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------- |
| **Success** |                                                                                                                                                                                                                             |                                                |
| 200         | `{   	"messages": [   		{   			"id": "GUPSHUP_MESSAGE_ID"   		}   	],   	"messaging_product": "whatsapp",   	"contacts": [   		{   			"input": "DESTINATION_PHONE_NO",   			"wa_id": "DESTINATION_PHONE_NO"   		}   	]   }` |                                                |
| **Error**   |                                                                                                                                                                                                                             |                                                |
| 400         | `{   	"message": "Callback Billing must be enabled for this API",   	"status": "error"   }`                                                                                                                                 | if Callback billing is not enabled for the app |
| 400         | `{   	"message": "Invalid App Details",   	"status": "error"   }`                                                                                                                                                           | if app details are not found                   |
| 401         | `{   	"status": "error",   	"message": "Authentication Failed"   }`                                                                                                                                                         | When API key authentication fails              |

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Partner Portal API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://partner.gupshup.io"
    }
  ],
  "paths": {
    "/partner/app/{appId}/v3/message": {
      "post": {
        "summary": "Location-based Message Templates",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "example": {
                  "messaging_product": "whatsapp",
                  "recipient_type": "individual",
                  "to": "12245554792",
                  "type": "template",
                  "template": {
                    "name": "order_delivery_update",
                    "language": {
                      "code": "en_US"
                    },
                    "components": [
                      {
                        "type": "header",
                        "parameters": [
                          {
                            "type": "location",
                            "location": {
                              "latitude": "37.483307",
                              "longitude": "122.148981",
                              "name": "Pablo Morales",
                              "address": "1 Hacker Way, Menlo Park, CA 94025"
                            }
                          }
                        ]
                      },
                      {
                        "type": "body",
                        "parameters": [
                          {
                            "type": "text",
                            "text": "Pablo"
                          },
                          {
                            "type": "text",
                            "text": "566701"
                          }
                        ]
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Your app token, please refer [**Get access token api**](https://partner-docs.gupshup.io/reference/get_partner-app-appid-token) to get the token from partner documentation.",
            "example": "sk_61b3021c97214370b341f8baaae0xxxx",
            "required": true
          },
          {
            "name": "appId",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Unique identifier of the app.",
            "example": "9e97650d-xxxx-xxxx-xxxx-4cdf47c3fa68"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "GUPSHUP_MESSAGE_ID"
                          }
                        }
                      },
                      "example": [
                        {
                          "id": "GUPSHUP_MESSAGE_ID"
                        }
                      ]
                    },
                    "messaging_product": {
                      "type": "string",
                      "example": "whatsapp"
                    },
                    "contacts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "input": {
                            "type": "string",
                            "example": "DESTINATION_PHONE_NO"
                          },
                          "wa_id": {
                            "type": "string",
                            "example": "DESTINATION_PHONE_NO"
                          }
                        }
                      },
                      "example": [
                        {
                          "input": "DESTINATION_PHONE_NO",
                          "wa_id": "DESTINATION_PHONE_NO"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Callback Billing must be enabled for this API"
                    },
                    "status": {
                      "type": "string",
                      "example": "error"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Authentication Failed"
                    },
                    "status": {
                      "type": "string",
                      "example": "error"
                    }
                  }
                }
              }
            }
          }
        },
        "description": "Use this API to send a template that uses a location header your request must include a location header object."
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```