Update a subscriber's pinned location
curl --request PATCH \
--url https://api.kit.com/v4/subscribers/{subscriber_id}/location \
--header 'Content-Type: application/json' \
--header 'X-Kit-Api-Key: <api-key>' \
--data '
{
"location": {
"city": "Boise",
"state_province": "Idaho",
"country_code": "US",
"latitude": 43.62,
"longitude": -116.2,
"timezone": "America/Denver"
}
}
'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/subscribers/{subscriber_id}/location")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-Kit-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"location\": {\n \"city\": \"Boise\",\n \"state_province\": \"Idaho\",\n \"country_code\": \"US\",\n \"latitude\": 43.62,\n \"longitude\": -116.2,\n \"timezone\": \"America/Denver\"\n }\n}"
response = http.request(request)
puts response.read_bodyconst options = {
method: 'PATCH',
headers: {'X-Kit-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
location: {
city: 'Boise',
state_province: 'Idaho',
country_code: 'US',
latitude: 43.62,
longitude: -116.2,
timezone: 'America/Denver'
}
})
};
fetch('https://api.kit.com/v4/subscribers/{subscriber_id}/location', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kit.com/v4/subscribers/{subscriber_id}/location"
payload := strings.NewReader("{\n \"location\": {\n \"city\": \"Boise\",\n \"state_province\": \"Idaho\",\n \"country_code\": \"US\",\n \"latitude\": 43.62,\n \"longitude\": -116.2,\n \"timezone\": \"America/Denver\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-Kit-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kit.com/v4/subscribers/{subscriber_id}/location",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'location' => [
'city' => 'Boise',
'state_province' => 'Idaho',
'country_code' => 'US',
'latitude' => 43.62,
'longitude' => -116.2,
'timezone' => 'America/Denver'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Kit-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.kit.com/v4/subscribers/{subscriber_id}/location"
payload = { "location": {
"city": "Boise",
"state_province": "Idaho",
"country_code": "US",
"latitude": 43.62,
"longitude": -116.2,
"timezone": "America/Denver"
} }
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"subscriber": {
"id": 1128,
"location": {
"city": "Boise",
"state_province": "Idaho",
"country_code": "US",
"latitude": 43.62,
"longitude": -116.2,
"timezone": "America/Denver"
}
}
}{
"errors": [
"The access token is invalid"
]
}{
"errors": [
"Not Found"
]
}{
"errors": [
"Country code can't be blank"
]
}Subscribers
Update a subscriber's pinned location
Updates a subscriber’s pinned location. This is a full replacement, not a partial update: city, state_province, country_code (ISO 3166-1 alpha-2), latitude, longitude, and timezone (IANA timezone name, e.g. America/Denver) are all required, so resend the current value for any field you are not changing. Omitting one returns 422. Returns the subscriber’s id and the updated location on success.
To create a pin from scratch, use Pin a subscriber’s location (POST); to remove the pin entirely, use Delete a subscriber’s location. Returns 404 when the subscriber is not found, 422 when a required field is missing or invalid.
PATCH
/
v4
/
subscribers
/
{subscriber_id}
/
location
Update a subscriber's pinned location
curl --request PATCH \
--url https://api.kit.com/v4/subscribers/{subscriber_id}/location \
--header 'Content-Type: application/json' \
--header 'X-Kit-Api-Key: <api-key>' \
--data '
{
"location": {
"city": "Boise",
"state_province": "Idaho",
"country_code": "US",
"latitude": 43.62,
"longitude": -116.2,
"timezone": "America/Denver"
}
}
'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/subscribers/{subscriber_id}/location")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-Kit-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"location\": {\n \"city\": \"Boise\",\n \"state_province\": \"Idaho\",\n \"country_code\": \"US\",\n \"latitude\": 43.62,\n \"longitude\": -116.2,\n \"timezone\": \"America/Denver\"\n }\n}"
response = http.request(request)
puts response.read_bodyconst options = {
method: 'PATCH',
headers: {'X-Kit-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
location: {
city: 'Boise',
state_province: 'Idaho',
country_code: 'US',
latitude: 43.62,
longitude: -116.2,
timezone: 'America/Denver'
}
})
};
fetch('https://api.kit.com/v4/subscribers/{subscriber_id}/location', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kit.com/v4/subscribers/{subscriber_id}/location"
payload := strings.NewReader("{\n \"location\": {\n \"city\": \"Boise\",\n \"state_province\": \"Idaho\",\n \"country_code\": \"US\",\n \"latitude\": 43.62,\n \"longitude\": -116.2,\n \"timezone\": \"America/Denver\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-Kit-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kit.com/v4/subscribers/{subscriber_id}/location",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'location' => [
'city' => 'Boise',
'state_province' => 'Idaho',
'country_code' => 'US',
'latitude' => 43.62,
'longitude' => -116.2,
'timezone' => 'America/Denver'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Kit-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.kit.com/v4/subscribers/{subscriber_id}/location"
payload = { "location": {
"city": "Boise",
"state_province": "Idaho",
"country_code": "US",
"latitude": 43.62,
"longitude": -116.2,
"timezone": "America/Denver"
} }
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"subscriber": {
"id": 1128,
"location": {
"city": "Boise",
"state_province": "Idaho",
"country_code": "US",
"latitude": 43.62,
"longitude": -116.2,
"timezone": "America/Denver"
}
}
}{
"errors": [
"The access token is invalid"
]
}{
"errors": [
"Not Found"
]
}{
"errors": [
"Country code can't be blank"
]
}Was this page helpful?
⌘I