Create a geofence
POST/api/v1/geofences
Add a new geofence to the system.
A geofence defines a geographic boundary (currently only circular boundaries are supported) that can be used to enforce location-based access control for time entries, expense entries, or custom entries.
Assignment Logic
You can optionally include an assignments array when creating a geofence to specify
which users, groups, projects, or entry screens it applies to:
- User assignments: Direct assignment to individual users
- Group assignments: Applies to all users in the specified group
- Project assignments: Applies when logging time to that project
- Entry screen assignments: Applies when using that specific entry screen
When multiple geofences apply to a user/project combination, the system uses OR logic: the user only needs to be within ONE applicable geofence to pass validation.
Priority Geofences
If you set is_priority: true, this geofence will override non-priority geofences.
When ANY applicable geofence is marked as priority, ONLY priority geofences are checked.
This operation requires the Geofence - Manage ability, or
Authority - Administrator.
The pname field must be unique across all geofences. Attempting to create
a geofence with a duplicate name will result in a 409 Conflict error.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 409
- 500
- 503
Successfully created the geofence. The response includes the full geofence object including the generated ID, timestamps, and URI.
Note: Unlike many REST APIs that return 201 Created for POST operations,
this endpoint returns 200 OK with the complete geofence object in the response body.
Response Headers
The URL of the newly created object.
The ID of the newly created object.
The name of the table where the object was created.
A 400 Bad Request is returned when the client request was malformed,
invalid, or otherwise could not be processed as-is. Usually, the cause for
the error is included in the error.message field of the response, and the
client should correct the request and try again.
See also Core Concepts#Error Responses.
Not authenticated - you must be signed in to access this resource. Please check the section of the documentation on authentication.
A 403 Forbidden response means that you are not authorized to perform
this action or access this object, or the object does not exist at all.
The client request may have been valid but the client does not have permission to access the requested resource or perform the requested action.
:::tip 403 Forbidden also used when objects don't exist
In most cases, the system will not return a 404 Not Found error response;
it returns 403 Forbidden both when the object doesn't exist at all,
and also when it exists but the client does not have permission to access it.
This is a security measure to prevent unauthorized users from determining
whether an object exists or not.
:::
See also Core Concepts#Error Responses.
Not found - the requested resource could not be found or does not exist. This may also include cases where the resource does exist, but the client does not have permission to access that resource.
:::tip 403 Forbidden also used when objects don't exist
In most cases, the system will not return a 404 Not Found error response;
it returns 403 Forbidden both when the object doesn't exist at all,
and also when it exists but the client does not have permission to access it.
This is a security measure to prevent unauthorized users from determining
whether an object exists or not.
:::
See also Core Concepts#Error Responses.
Conflict - A geofence with the specified name already exists.
The pname field must be unique across all geofences.
Internal server error; an unexpected error occurred on the server. This could be due to a temporary condition or might be the result of a bug in the server software. Also, in some cases, an incorrect client input can trigger this error, and can be resolved by correcting the input.
If the error persists, please contact support along along with the following details when possible:
- any error messages received from the server
- the full request and response details (full headers and body)
- a description of the steps that led to the error
- the time range when it occurred.
Service unavailable - the server is currently unable to handle the request, usually due to maintenance activity on the server. Check if the server's web interface is currently available, or try again later.