Geofences
Import Geofences
Create or update up to 1,000 geofences at once
POST
/
api
/
v1
/
geofences
/
import
Import Geofences
curl --request POST \
--url https://api.sequenzy.com/api/v1/geofences/import \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"geofences": [
{}
]
}
'import requests
url = "https://api.sequenzy.com/api/v1/geofences/import"
payload = { "geofences": [{}] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({geofences: [{}]})
};
fetch('https://api.sequenzy.com/api/v1/geofences/import', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sequenzy.com/api/v1/geofences/import",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'geofences' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sequenzy.com/api/v1/geofences/import"
payload := strings.NewReader("{\n \"geofences\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.post("https://api.sequenzy.com/api/v1/geofences/import")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"geofences\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/geofences/import")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"geofences\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"created": 123,
"updated": 123,
"errors": [
{}
]
}Creates or updates geofences in bulk, matched by
externalId. Every row needs one, so sending the same rows again updates them instead of creating copies. Requires the geofences:write scope.
Rows are checked one by one. Invalid rows are skipped and listed in errors; the valid rows are saved together. On update, fields a row leaves out keep their stored value. New rows need the fields Create Geofence requires. Rows past the 10,000 per workspace limit are skipped with an error.
Request
curl -X POST "https://api.sequenzy.com/api/v1/geofences/import" \
-H "Authorization: Bearer $SEQUENZY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"geofences": [
{ "externalId": "store-0042", "name": "Soho store", "latitude": 51.5136, "longitude": -0.1365, "radiusMeters": 200, "group": "stores" },
{ "externalId": "store-0043", "radiusMeters": 350 }
]
}'
Response
integer
Geofences created.
integer
Geofences updated.
object[]
Skipped rows, each with
index (position in geofences), externalId and error.Errors
A row with an invalid field does not fail the request: the response is200 with the row in errors, and the other rows are saved. Check errors even when the request succeeds.
| Status | When |
|---|---|
| 400 | The body has no geofences array, or more than 1,000 rows. |
| 401 | The API key is missing or invalid. |
| 403 | The key lacks the required scope or has no company selected. |
⌘I
Import Geofences
curl --request POST \
--url https://api.sequenzy.com/api/v1/geofences/import \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"geofences": [
{}
]
}
'import requests
url = "https://api.sequenzy.com/api/v1/geofences/import"
payload = { "geofences": [{}] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({geofences: [{}]})
};
fetch('https://api.sequenzy.com/api/v1/geofences/import', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sequenzy.com/api/v1/geofences/import",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'geofences' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sequenzy.com/api/v1/geofences/import"
payload := strings.NewReader("{\n \"geofences\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.post("https://api.sequenzy.com/api/v1/geofences/import")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"geofences\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/geofences/import")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"geofences\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"created": 123,
"updated": 123,
"errors": [
{}
]
}