Location
- iMessage
Ask a person to share their location, or send a place on a map
On iMessage, a location_request puts a card in the conversation that asks the person to share their location. If they tap it and choose how long to share, their location arrives later as events.
Ask for a location
curl -X POST https://api.mapier.ai/v1/commands/message.send \
-H "Authorization: Bearer $MAPIER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: pickup-4821-where" \
-H "x-mapier-version: 2026-12-01" \
-d '{
"target": { "conversationId": "a0000000-0000-4000-8000-000000000001" },
"payload": { "kind": "location_request" }
}'{
"commandId": "0192b3e1-…",
"status": "queued",
"repeated": false,
"lineId": "0192a7b0-…",
"lineSelection": "reused_active_chat",
"channel": "imessage"
}Nothing goes beside kind. To say why you are asking, send a text first. succeeded means the card was sent, never that the person shared.
Send a place
A place is a pin on a map, with its name.
On iMessage, send an Apple Maps link with message.send and kind: "link". iMessage shows it as a map pin. Put the latitude and longitude in coordinate, and the place's name, URL-encoded, in name:
{
"kind": "link",
"url": "https://maps.apple.com/place?coordinate=51.5136,-0.1365&name=Mapier%20Caf%C3%A9"
}It goes out like any other link.
On WhatsApp, kind: "location" sends a pin on a map, with an optional name and address:
{
"kind": "location",
"latitude": 51.5136,
"longitude": -0.1365,
"name": "Mapier Café",
"address": "12 Example Street, London"
}Limits
A location request goes only into a one-to-one conversation the person has written in. A group chat, or someone new, is refused.
A place goes where any link goes: a conversation the person has written in, or a group chat.
Receive a location
A shared location reaches you only if you ask for it. Open the stream with ?events=locations, or subscribe a webhook to the events by name:
location.share_startedwhen the person starts sharing.location.updatedwith a new position about every 30 seconds.location.share_endedwhen they stop.
The coordinates are a person's. You are responsible for how you store and use them. Receive events explains how to subscribe.
Errors you may see
Each of these comes back at once, and nothing is sent.
| Error | Means | Fix |
|---|---|---|
422 validation_failed, conversation_not_confirmed | Not a one-to-one conversation the person has written in | Ask in a one-to-one conversation the person has written in |
422 validation_failed | A key beside kind, such as text | Send the words as a text first |
404 unsupported_command, not_on_channel | The line's channel does not ask for locations | Ask in a text |