Ir al contenido

Desarrolladores

Boundaries (geofences)

La documentación de la API solo está en inglés.

Documentación de la API: Boundaries

A boundary is the area that a worker must be inside to clock in to an activity. An activity lists its boundaries in geofences. See the Activity object.

To do thisUseScopes
Add a boundary when you create an activitylocation on POST /activitiesactivity:write. A drawn boundary also needs geofences:write.
Redraw a boundary, or add another onelocation on PATCH /activities/{activityId}activity:write and geofences:write
Turn a boundary off or onPATCH /activities/{activityId}/geofences/{geofenceId}activity:write and geofences:write

Publishing. A boundary that your key draws is live at once only when the key has the geofences:publish scope. Without it, the boundary is saved as a draft. It shows isPublished: false (for a new boundary) and hasDraftPending: true until an administrator publishes it. Every redraw is kept as a version.

Who can change a boundary. Your key can change only a boundary that its own source system owns, and not one that an administrator took over (isLocallyManaged: true).

See Locations for the shape and size rules.

Back to the index · Conventions · Errors


PATCH /activities/{activityId}/geofences/{geofenceId}

Turns one boundary off (false) or on (true). The boundary and its versions are kept. The phone uses only active boundaries.

Scopes: activity:write and geofences:write

This change does not move the activity's updatedAt.

Path parameters

NameTypeRequiredDefaultAllowed valuesDescription
activityIdintegerYes1 or moreThe activity's id
geofenceIdintegerYes1 or moreOne of the activity's boundaries, from its geofences list

Request body

NameTypeRequiredDefaultAllowed valuesDescription
isActivebooleanYesfalse turns the boundary off. true turns it on.

Example request

curl -X PATCH "$TIMECARD_BASE_URL/activities/48213/geofences/9120" \
  -H "X-API-Key: $TIMECARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "isActive": false }'

Example response 200 OK

The response is the activity after the change.

{
  "status": 200,
  "message": "Success: fence removed.",
  "record": {
    "activityId": 48213,
    "kind": "Job",
    "code": "J-2026-104",
    "geofences": [
      {
        "geofenceId": 9120,
        "isActive": false,
        "isPublished": false,
        "hasDraftPending": true,
        "sourceSystem": "acme-erp",
        "isLocallyManaged": false
      }
    ],
    "updatedAt": "2026-11-03T15:04:05.123Z"
  }
}

The record has every field of the Activity object. It is shortened here. When you turn a boundary on, the message is Success: fence restored. Sending the value that the boundary already has changes nothing.

Errors

StatuscodeWhen
400validation_failedAn id is not a positive integer, or isActive is not a boolean
401No key, or a key that is not valid, revoked or expired
403insufficient_scope or forbiddenThe key does not have activity:write or geofences:write
404not_foundNo activity has this id within the key's companies, or the boundary is not one of its boundaries
409conflictThe boundary is locally managed, or another source system owns it
500internal_errorThe boundary could not be changed
503service_unavailableThe service cannot check the key at the moment