Skip to content
Get started

Get location data

client.Chats.Location.Get(ctx, chatID) (*GetChatLocationResponse, error)
GET/v3/chats/{chatId}/location

Retrieve the current location for contacts sharing with you in a chat.

Returns a GeoJSON FeatureCollection with a Feature for each participant actively sharing their location.

Works for both 1:1 and group chats. In group chats, returns a separate feature for each participant who is sharing. Each feature’s properties.handle identifies the user.

Returns an empty features array if no one is sharing or no location data is available yet.

ParametersExpand Collapse
chatID string
formatuuid
ReturnsExpand Collapse
type GetChatLocationResponse struct{…}
Data GetChatLocationResponseData
Features []GetChatLocationResponseDataFeature
Geometry GetChatLocationResponseDataFeatureGeometry
Coordinates []float64

[longitude, latitude] or [longitude, latitude, altitude]

Type string
Properties GetChatLocationResponseDataFeatureProperties
Handle string

Phone number or email of the person sharing their location

Address stringOptional

Full street address

Locality stringOptional

City or locality name

UpdatedAt TimeOptional

When the location was last updated

formatdate-time
Type string
Type string
Success bool

Get location data

package main

import (
  "context"
  "fmt"

  "github.com/linq-team/linq-go"
  "github.com/linq-team/linq-go/option"
)

func main() {
  client := linqgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  getChatLocationResponse, err := client.Chats.Location.Get(context.TODO(), "975d0776-bd17-4273-8337-f346b4c661b0")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", getChatLocationResponse.Data)
}
{
  "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": 500,
    "code": 3006,
    "message": "Internal server error",
    "doc_url": "https://docs.linqapp.com/error/codes/3xxx/3006/"
  },
  "success": false
}
Returns Examples
{
  "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": 500,
    "code": 3006,
    "message": "Internal server error",
    "doc_url": "https://docs.linqapp.com/error/codes/3xxx/3006/"
  },
  "success": false
}