Skip to content
Get started

Request location sharing

chats.location.request(strchat_id) -> LocationRequestResponse
POST/v3/chats/{chatId}/location/request

Request a contact in a chat to share their location. They receive an iMessage prompt and must accept before any location is available; once they do, read their location coordinates with GET /v3/chats/{chatId}/location.

The request is delivered asynchronously. The endpoint returns immediately with { "success": true, "message": "Location request sent" } and does not return coordinates.

Location requests only work in 1:1 iMessage chats (Apple limitation):

  • Group chats (any service) return 409 with code 2016 (GroupChatNotSupported).
  • 1:1 SMS and RCS chats return 409 with code 2017 (ChatServiceNotSupported).
ParametersExpand Collapse
chat_id: str
formatuuid
ReturnsExpand Collapse
class LocationRequestResponse:
message: str
success: bool

Request location sharing

import os
from linq import LinqAPIV3

client = LinqAPIV3(
    api_key=os.environ.get("LINQ_API_V3_API_KEY"),  # This is the default and can be omitted
)
location_request_response = client.chats.location.request(
    "975d0776-bd17-4273-8337-f346b4c661b0",
)
print(location_request_response.message)
{
  "success": true,
  "message": "Location request sent"
}
{
  "error": {
    "status": 400,
    "code": 1002,
    "message": "Phone number must be in E.164 format",
    "doc_url": "https://docs.linqapp.com/error/codes/1xxx/1002/"
  },
  "success": false
}
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "Unauthorized - missing or invalid authentication token",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2004/"
  },
  "success": false
}
{
  "error": {
    "status": 403,
    "code": 2005,
    "message": "Access denied - insufficient permissions for this resource",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2005/"
  },
  "success": false
}
{
  "error": {
    "status": 404,
    "code": 2001,
    "message": "Resource not found",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2001/"
  },
  "success": false
}
{
  "error": {
    "status": 409,
    "code": 2016,
    "message": "Location requests are not supported in group chats",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2016/"
  },
  "success": false
}
{
  "error": {
    "status": 409,
    "code": 2017,
    "message": "Location requests are only supported in iMessage chats",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2017/"
  },
  "success": false
}
{
  "error": {
    "status": 500,
    "code": 3006,
    "message": "Internal server error",
    "doc_url": "https://docs.linqapp.com/error/codes/3xxx/3006/"
  },
  "success": false
}
Returns Examples
{
  "success": true,
  "message": "Location request sent"
}
{
  "error": {
    "status": 400,
    "code": 1002,
    "message": "Phone number must be in E.164 format",
    "doc_url": "https://docs.linqapp.com/error/codes/1xxx/1002/"
  },
  "success": false
}
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "Unauthorized - missing or invalid authentication token",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2004/"
  },
  "success": false
}
{
  "error": {
    "status": 403,
    "code": 2005,
    "message": "Access denied - insufficient permissions for this resource",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2005/"
  },
  "success": false
}
{
  "error": {
    "status": 404,
    "code": 2001,
    "message": "Resource not found",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2001/"
  },
  "success": false
}
{
  "error": {
    "status": 409,
    "code": 2016,
    "message": "Location requests are not supported in group chats",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2016/"
  },
  "success": false
}
{
  "error": {
    "status": 409,
    "code": 2017,
    "message": "Location requests are only supported in iMessage chats",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2017/"
  },
  "success": false
}
{
  "error": {
    "status": 500,
    "code": 3006,
    "message": "Internal server error",
    "doc_url": "https://docs.linqapp.com/error/codes/3xxx/3006/"
  },
  "success": false
}