Skip to main content

Geofences

8 operations at https://api.zaitrack.app. Request and response bodies are JSON with camelCase keys; ids are UUIDs; times are RFC 3339 in UTC.

Every operation needs an API key, a personal access token or an OAuth access token unless it says otherwise. An Idempotency-Key is replayed for 24 hours; see Idempotency. Errors are application/problem+json; see Errors.

List geofences​

GET /v1/geofences

  • Scope: geofences:read or geofences:*
  • Rate class: read (100 per second and 360,000 per hour)
  • Idempotency-Key: not used
  • Audited: no
  • Step-up MFA: no
Query parameterTypeNotes
pageSizestring
cursorstring

Request​

No body.

Response​

200: fields the handler writes, taken from its source.

FieldTypeNotes
itemsarray of object
items[].id—
items[].name—
items[].description—
items[].kind—
items[].category—
items[].enabled—
items[].tagsarray of string
items[].createdBy—
items[].createdAt—
items[].updatedAt—
items[].version—
items[].externalRef—
items[].timeWindowobject
items[].timeWindow.startMinUtcinteger
items[].timeWindow.endMinUtcinteger
items[].timeWindow.daysOfWeekinteger
items[].vertices—
items[].radiusM—
items[].bufferM—
nextCursorstring

Example​

curl "https://api.zaitrack.app/v1/geofences" \
-H "Authorization: Bearer zk_test_…"

Create a geofence​

POST /v1/geofences

  • Scope: geofences:write or geofences:*
  • Rate class: write (50 per second and 36,000 per hour)
  • Idempotency-Key: optional
  • Audited: no
  • Step-up MFA: no

Request​

Fields the handler reads, taken from its source.

FieldTypeNotes
namestring
descriptionstring
categorystring
kindstring
verticesarray of object
vertices[].latnumber
vertices[].lngnumber
centerobject
center.latnumber
center.lngnumber
radiusMnumber
polylinearray of object
polyline[].latnumber
polyline[].lngnumber
bufferMnumber
timeWindowobject
timeWindow.startMinUtcinteger
timeWindow.endMinUtcinteger
timeWindow.daysOfWeekinteger
tagsarray of string

Response​

201: fields the handler writes, taken from its source. The service's OpenAPI document describes a different body; this page follows the handler.

FieldTypeNotes
id—
name—
description—
kind—
category—
enabled—
tagsarray of string
createdBy—
createdAt—
updatedAt—
version—
externalRef—
timeWindowobject
timeWindow.startMinUtcinteger
timeWindow.endMinUtcinteger
timeWindow.daysOfWeekinteger
vertices—
radiusM—
bufferM—

Example​

Every field is sent with a placeholder value: replace them with yours.

curl -X POST "https://api.zaitrack.app/v1/geofences" \
-H "Authorization: Bearer zk_test_…" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"name": "…", "description": "…", "category": "…", "kind": "…", "vertices": [], "center": {"lat": 0, "lng": 0}, "radiusM": 0, "polyline": [], "bufferM": 0, "timeWindow": {"startMinUtc": 0, "endMinUtc": 0, "daysOfWeek": 0}, "tags": []}'

Get a geofence​

GET /v1/geofences/{id}

  • Scope: geofences:read or geofences:*
  • Rate class: read (100 per second and 360,000 per hour)
  • Idempotency-Key: not used
  • Audited: no
  • Step-up MFA: no

Path parameters: id.

Request​

No body.

Response​

200: fields the handler writes, taken from its source. The service's OpenAPI document describes a different body; this page follows the handler.

The same fields as the response of Create a geofence.

Example​

curl "https://api.zaitrack.app/v1/geofences/$ID" \
-H "Authorization: Bearer zk_test_…"

Update a geofence​

PATCH /v1/geofences/{id}

  • Scope: geofences:write or geofences:*
  • Rate class: write (50 per second and 36,000 per hour)
  • Idempotency-Key: not used
  • Audited: no
  • Step-up MFA: no
  • If-Match: the version you read; a stale one is refused (412 or 409)

Path parameters: id.

Request​

Fields the handler reads, taken from its source.

FieldTypeNotes
namestringoptional
enabledbooleanoptional
descriptionstringoptional
categorystringoptional
centerobjectoptional
center.latnumber
center.lngnumber
radiusMnumberoptional
verticesarray of object
vertices[].latnumber
vertices[].lngnumber
polylinearray of object
polyline[].latnumber
polyline[].lngnumber
bufferMnumberoptional
tagsarray of string

Response​

200: fields the handler writes, taken from its source. The service's OpenAPI document describes a different body; this page follows the handler.

The same fields as the response of Create a geofence.

Example​

Every field is sent with a placeholder value: replace them with yours.

curl -X PATCH "https://api.zaitrack.app/v1/geofences/$ID" \
-H "Authorization: Bearer zk_test_…" \
-H 'If-Match: "3"' \
-H "Content-Type: application/json" \
-d '{"name": "…", "enabled": false}'

Delete a geofence​

DELETE /v1/geofences/{id}

  • Scope: geofences:write or geofences:*
  • Rate class: write (50 per second and 36,000 per hour)
  • Idempotency-Key: not used
  • Audited: low risk
  • Step-up MFA: no

Path parameters: id.

Request​

No body.

Response​

204: no body.

Example​

curl -X DELETE "https://api.zaitrack.app/v1/geofences/$ID" \
-H "Authorization: Bearer zk_test_…"

Whether a point lies in a geofence​

POST /v1/geofences/{id}/check

  • Scope: geofences:read or geofences:*
  • Rate class: read (100 per second and 360,000 per hour)
  • Idempotency-Key: not used
  • Audited: no
  • Step-up MFA: no

Path parameters: id.

Request​

Fields the handler reads, taken from its source.

FieldTypeNotes
latnumber
lngnumber

Response​

200: fields the handler writes, taken from its source.

FieldTypeNotes
geofenceId—
insideboolean
namestring

Example​

Every field is sent with a placeholder value: replace them with yours.

curl -X POST "https://api.zaitrack.app/v1/geofences/$ID/check" \
-H "Authorization: Bearer zk_test_…" \
-H "Content-Type: application/json" \
-d '{"lat": 0, "lng": 0}'

Geofences containing a point (?lat=&lng=)​

GET /v1/geofences/containing

  • Scope: geofences:read or geofences:*
  • Rate class: read (100 per second and 360,000 per hour)
  • Idempotency-Key: not used
  • Audited: no
  • Step-up MFA: no
Query parameterTypeNotes
latstring
lngstring

Request​

No body.

Response​

200: fields the handler writes, taken from its source.

FieldTypeNotes
itemsarray of object
items[].geofenceId—
items[].name—
items[].category—

Example​

curl "https://api.zaitrack.app/v1/geofences/containing" \
-H "Authorization: Bearer zk_test_…"

Geofence entries and exits​

GET /v1/geofences/visits

  • Scope: geofences:read or geofences:*
  • Rate class: read (100 per second and 360,000 per hour)
  • Idempotency-Key: not used
  • Audited: no
  • Step-up MFA: no
Query parameterTypeNotes
openstring
pageSizestring
cursorstring
geofenceId—
deviceId—
vehicleId—
from—
to—

Request​

No body.

Response​

200: fields the handler writes, taken from its source.

FieldTypeNotes
itemsarray of object
items[].id—
items[].geofenceId—
items[].geofenceName—
items[].category—
items[].deviceId—
items[].vehicleId—
items[].enteredAt—
items[].exitedAt—
items[].durationSec—
items[].enter—
items[].exit—
nextCursor—

Example​

curl "https://api.zaitrack.app/v1/geofences/visits" \
-H "Authorization: Bearer zk_test_…"