Skip to main content
im.locations sends Find My location-sharing requests and reads friend locations that are already visible to the current iMessage account. Use request(chat, address) when you want to ask someone to share location. Use list(...), get(...), and watch(...) after location is already shared with the current account.
Location updates are not part of the durable event log. im.locations.watch(...) is a dedicated live stream. Updates missed while disconnected cannot be replayed with im.events.catchUp(...).

What You Can Do

Before You Use It

Request Location Sharing

Send a visible Find My request card in an existing direct or group chat:
Inputs: The address must belong to someone in chat. In a direct chat, that means the other participant. In a group chat, that means an existing group member. Returns LocationRequestReceipt. A successful call means the request card was sent or the server accepted the request operation. It does not mean the other person is now sharing location. The returned receipt includes: When messageGuid is present, use it like any other message GUID. For example, you can look it up with im.messages.get(...). For idempotent retries from your job system, pass clientMessageId:
clientMessageId is only needed when your queue or worker may rerun the same logical request after a crash or timeout. Most direct calls can omit it. See error handling for details.
After the other person accepts or starts sharing, use get(...), list(...), or watch(...) to read their location.

List Shared Locations

list(...) takes no arguments. Returns SharedFriendLocation[]. If no friends are sharing location, the array is empty. Each item is a location snapshot, and a snapshot is not guaranteed to include coordinates. latitude and longitude are optional. They may be absent while a device is still locating, when location is unavailable, or when only address metadata is available.
Check both latitude and longitude before showing a map marker. Do not rely only on locationType, and do not assume every listed location has coordinates.

Get One Friend Location

Input: Phone numbers must include the country code, start with +, and omit spaces, parentheses, and dashes. Returns SharedFriendLocation. If the address is not sharing location or is not visible to the current account, get(...) throws NotFoundError. The returned object looks like this:

Location Types

location.locationType describes how fresh the snapshot is: locationType only describes freshness. It does not guarantee that coordinates are present.

Watch Live Updates

Scope

Watch every visible friend’s location updates:
Watch one address:
Inputs: Do not pass chat.guid or a display name to watch(...).

Update Shape

Each update is SharedFriendLocationUpdated:
Breaking out of the for await loop closes the live stream.
sourceSequence belongs only to the location live stream. It is not the same as durable event sequence. You can use it to detect duplicate live updates after reconnecting, but you cannot use im.events.catchUp(...) to recover location updates missed while disconnected.

Next Steps

  1. Addresses — check whether an email address or phone number is reachable over iMessage
  2. Events — understand durable events and catch-up
  3. Chats — manage chats, read state, and typing state