Skip to main content

Send Location Message

Send a location message with latitude, longitude, and optional name and address to WhatsApp contacts or groups. The location will be displayed as a map pin in the chat.

Endpoint

POST /message/sendLocation/:instanceName

Path Parameters

instanceName
string
required
The name of your WhatsApp instance that you created

Request Body

number
string
required
The recipient’s WhatsApp number in international format (without + symbol)Example: 5511999999999 for a Brazilian number
latitude
number
required
The latitude coordinate of the locationExample: -23.550520 (São Paulo, Brazil)
longitude
number
required
The longitude coordinate of the locationExample: -46.633308 (São Paulo, Brazil)
name
string
required
The name of the location or placeExample: Paulista Avenue
address
string
required
The full address of the locationExample: Av. Paulista, 1578 - Bela Vista, São Paulo - SP, Brazil
delay
integer
Delay before sending the message in millisecondsExample: 1000 for 1 second delay
quoted
object
Quote a previous message by providing its key and message object
mentionsEveryOne
boolean
Mention all participants in a groupDefault: false
mentioned
array
Array of phone numbers to mention. Each number should be a numeric string.Example: ["5511999999999", "5511888888888"]

Response

key
object
Message key information
message
object
The sent message object containing the location data
messageTimestamp
string
Unix timestamp when the message was sent
status
string
Message status (e.g., “PENDING”, “SENT”)

Code Examples

curl -X POST https://your-api-url.com/message/sendLocation/my-instance \
  -H "Content-Type: application/json" \
  -H "apikey: YOUR_API_KEY" \
  -d '{
    "number": "5511999999999",
    "latitude": -23.550520,
    "longitude": -46.633308,
    "name": "Paulista Avenue",
    "address": "Av. Paulista, 1578 - Bela Vista, São Paulo - SP, Brazil"
  }'

Advanced Examples

{
  "number": "5511999999999",
  "latitude": 40.758896,
  "longitude": -73.985130,
  "name": "Times Square",
  "address": "Manhattan, NY 10036, United States"
}
{
  "number": "[email protected]",
  "latitude": -23.550520,
  "longitude": -46.633308,
  "name": "Meeting Point",
  "address": "Av. Paulista, 1578 - Bela Vista, São Paulo - SP",
  "mentioned": ["5511888888888", "5511777777777"]
}
{
  "number": "5511999999999",
  "latitude": 51.507351,
  "longitude": -0.127758,
  "name": "Big Ben",
  "address": "Westminster, London SW1A 0AA, UK",
  "quoted": {
    "key": {
      "id": "BAE5F2D3E4F5A6B7",
      "remoteJid": "[email protected]",
      "fromMe": false
    },
    "message": {
      "conversation": "Where should we meet?"
    }
  }
}

Location Coordinates Guide

Latitude and longitude values must be valid geographic coordinates:
  • Latitude: -90 to +90 (negative for South, positive for North)
  • Longitude: -180 to +180 (negative for West, positive for East)

How to Get Coordinates

  1. Google Maps:
    • Right-click on a location
    • Click on the coordinates to copy them
    • Format: latitude, longitude
  2. GPS Devices:
    • Most GPS devices provide latitude and longitude
    • Ensure they’re in decimal format (not degrees/minutes/seconds)
  3. Geolocation API:
    navigator.geolocation.getCurrentPosition((position) => {
      console.log('Latitude:', position.coords.latitude);
      console.log('Longitude:', position.coords.longitude);
    });
    

Coordinate Format Examples

CityLatitudeLongitude
New York, USA40.7128-74.0060
London, UK51.5074-0.1278
Tokyo, Japan35.6762139.6503
Sydney, Australia-33.8688151.2093
São Paulo, Brazil-23.5505-46.6333

Location Display in WhatsApp

When you send a location message:
  1. Recipients see a map preview with a pin
  2. The location name appears as a title
  3. The address appears as a subtitle
  4. Tapping the message opens the location in their default maps app
  5. Recipients can get directions to the location
All four parameters (latitude, longitude, name, and address) are required. If any are missing, the API will return a 400 Bad Request error.

Error Responses

status
number
HTTP status code
message
string
Error description

Common Errors

Status CodeError MessageSolution
400Bad Request - Missing required fieldsEnsure all required fields (number, latitude, longitude, name, address) are provided
400Invalid latitude/longitude valuesCheck that coordinates are within valid ranges
401UnauthorizedCheck your API key
404Not FoundVerify instance exists and is connected
500Internal Server ErrorCheck server logs or contact support
Latitude and longitude should be sent as numbers, not strings. Ensure your JSON payload uses numeric types for these values.

Build docs developers (and LLMs) love