Geofences
Create Geofence
Add a place your mobile app watches
POST
/
api
/
v1
/
geofences
Create Geofence
curl --request POST \
--url https://api.sequenzy.com/api/v1/geofences \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"latitude": 123,
"longitude": 123,
"radiusMeters": 123,
"dwellSeconds": {},
"cooldownSeconds": 123,
"group": {},
"externalId": {},
"active": true
}
'import requests
url = "https://api.sequenzy.com/api/v1/geofences"
payload = {
"name": "<string>",
"latitude": 123,
"longitude": 123,
"radiusMeters": 123,
"dwellSeconds": {},
"cooldownSeconds": 123,
"group": {},
"externalId": {},
"active": True
}
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({
name: '<string>',
latitude: 123,
longitude: 123,
radiusMeters: 123,
dwellSeconds: {},
cooldownSeconds: 123,
group: {},
externalId: {},
active: true
})
};
fetch('https://api.sequenzy.com/api/v1/geofences', 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",
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([
'name' => '<string>',
'latitude' => 123,
'longitude' => 123,
'radiusMeters' => 123,
'dwellSeconds' => [
],
'cooldownSeconds' => 123,
'group' => [
],
'externalId' => [
],
'active' => true
]),
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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"radiusMeters\": 123,\n \"dwellSeconds\": {},\n \"cooldownSeconds\": 123,\n \"group\": {},\n \"externalId\": {},\n \"active\": true\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"radiusMeters\": 123,\n \"dwellSeconds\": {},\n \"cooldownSeconds\": 123,\n \"group\": {},\n \"externalId\": {},\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/geofences")
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 \"name\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"radiusMeters\": 123,\n \"dwellSeconds\": {},\n \"cooldownSeconds\": 123,\n \"group\": {},\n \"externalId\": {},\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"geofence": {
"id": "<string>",
"name": "<string>",
"externalId": {},
"group": {},
"latitude": 123,
"longitude": 123,
"radiusMeters": 123,
"dwellSeconds": {},
"cooldownSeconds": 123,
"active": true,
"createdAt": "<string>",
"updatedAt": "<string>"
}
}Creates a geofence: a circle the Sequenzy mobile SDKs register with the phone’s location services. When a signed-in user enters, leaves or stays in it, Sequenzy records
app.geofence_entered, app.geofence_exited or app.geofence_dwelled on their contact. See Geofences.
Apps pick up a new geofence on their next refresh. A workspace holds at most 10,000. Requires the geofences:write scope. Unknown fields are ignored.
Request
string
required
Geofence name, up to 120 characters.
number
required
Center latitude, from -90 to 90.
number
required
Center longitude, from -180 to 180.
integer
required
Radius in meters, from 100 to 10,000. Phones trigger small regions late or not at all, so use 200 or more.
integer | null
default:"null"
Record
app.geofence_dwelled once a contact has stayed inside this many seconds, from 60 to 14,400. null turns dwell off.integer
default:"3600"
How long a repeat of the same transition by the same contact is ignored, from 300 to 604,800 seconds.
string | null
Optional group label such as
stores: letters, numbers, spaces, dots, dashes and underscores, up to 64 characters. Triggers and segments can target a whole group.string | null
Your own ID for the place, up to 128 characters and unique in your workspace. Imports match rows by it.
boolean
default:"true"
Paused geofences are not sent to apps and record nothing.
curl -X POST "https://api.sequenzy.com/api/v1/geofences" \
-H "Authorization: Bearer $SEQUENZY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Soho store",
"latitude": 51.5136,
"longitude": -0.1365,
"radiusMeters": 200,
"dwellSeconds": 600,
"group": "stores",
"externalId": "store-0042"
}'
Response
Returns201 with the geofence.
object
Show properties
Show properties
string
Geofence ID.
string
Name.
string | null
Your ID for the place.
string | null
Group label.
number
Center latitude.
number
Center longitude.
integer
Radius in meters.
integer | null
Dwell time, or
null when off.integer
Cooldown per contact and transition.
boolean
Whether apps watch it.
string
ISO 8601 creation time.
string
ISO 8601 time of the last change.
Errors
| Status | When |
|---|---|
| 400 | A field is out of range or has the wrong type. The message names the field, for example radiusMeters must be between 100 and 10000. |
| 401 | The API key is missing or invalid. |
| 403 | The key lacks the required scope or has no company selected. |
| 409 | Another geofence already uses this externalId. |
⌘I
Create Geofence
curl --request POST \
--url https://api.sequenzy.com/api/v1/geofences \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"latitude": 123,
"longitude": 123,
"radiusMeters": 123,
"dwellSeconds": {},
"cooldownSeconds": 123,
"group": {},
"externalId": {},
"active": true
}
'import requests
url = "https://api.sequenzy.com/api/v1/geofences"
payload = {
"name": "<string>",
"latitude": 123,
"longitude": 123,
"radiusMeters": 123,
"dwellSeconds": {},
"cooldownSeconds": 123,
"group": {},
"externalId": {},
"active": True
}
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({
name: '<string>',
latitude: 123,
longitude: 123,
radiusMeters: 123,
dwellSeconds: {},
cooldownSeconds: 123,
group: {},
externalId: {},
active: true
})
};
fetch('https://api.sequenzy.com/api/v1/geofences', 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",
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([
'name' => '<string>',
'latitude' => 123,
'longitude' => 123,
'radiusMeters' => 123,
'dwellSeconds' => [
],
'cooldownSeconds' => 123,
'group' => [
],
'externalId' => [
],
'active' => true
]),
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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"radiusMeters\": 123,\n \"dwellSeconds\": {},\n \"cooldownSeconds\": 123,\n \"group\": {},\n \"externalId\": {},\n \"active\": true\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"radiusMeters\": 123,\n \"dwellSeconds\": {},\n \"cooldownSeconds\": 123,\n \"group\": {},\n \"externalId\": {},\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/geofences")
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 \"name\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"radiusMeters\": 123,\n \"dwellSeconds\": {},\n \"cooldownSeconds\": 123,\n \"group\": {},\n \"externalId\": {},\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"geofence": {
"id": "<string>",
"name": "<string>",
"externalId": {},
"group": {},
"latitude": 123,
"longitude": 123,
"radiusMeters": 123,
"dwellSeconds": {},
"cooldownSeconds": 123,
"active": true,
"createdAt": "<string>",
"updatedAt": "<string>"
}
}