---
title: "Create geofence"
method: POST
path: "/v1/locate/geofences"
tags: ["Device Locator"]
---

# Create geofence

`POST /v1/locate/geofences`

## Request

- Base URL: `https://api.1nce.com/management-api`
- URL: `https://api.1nce.com/management-api/v1/locate/geofences`
- Auth: HTTP bearer

Create a new geofence.

## Request body

- union: Request to create a geofence.
  - object
    - `name` string, required: The name of the geofence
    - `eventTypes` string[]: The event types to register to. Defaults to [ENTER, EXIT]
    - `eventSources` string[]: The sources of coordinates to evaluate towards geofence. Defaults to [GPS, CellTower]
    - `deviceId` unknown
    - `type` string, required: The type of geofence
    - `coordinates` array[], required: The polygon geofence coordinates
      - array[]
        - number[]: Coordinates (long, lat)
  - object
    - `name` string, required: The name of the geofence
    - `eventTypes` string[]: The event types to register to. Defaults to [ENTER, EXIT]
    - `eventSources` string[]: The sources of coordinates to evaluate towards geofence. Defaults to [GPS, CellTower]
    - `deviceId` unknown
    - `type` string, required: The type of geofence
    - `radius` number, required: Circle geofence radius in meters
    - `center` number[]: The coordinates of the center of the geofence (long, lat)

## Response `201`

Created

- union: Response to post geofence request.
  - PostGeofenceResponseschemaOneOf
    - `id` string, required: Identifier of the geofence
    - `name` string, required: The name of the geofence
    - `eventTypes` string[], required: The event types to register to. Defaults to [ENTER, EXIT]
    - `eventSources` string[], required: The sources of coordinates to evaluate towards geofence. Defaults to [GPS, CellTower]
    - `type` string, required: The type of geofence
    - `coordinates` array[], required: The polygon geofence coordinates
      - array[]
        - number[]: Coordinates (long, lat)
    - `deviceId` unknown, required
  - PostGeofenceResponseschemaOneOf1
    - `id` string, required: Identifier of the geofence
    - `name` string, required: The name of the geofence
    - `eventTypes` string[], required: The event types to register to. Defaults to [ENTER, EXIT]
    - `eventSources` string[], required: The sources of coordinates to evaluate towards geofence. Defaults to [GPS, CellTower]
    - `type` string, required: The type of geofence
    - `radius` number, required: Circle geofence radius in meters
    - `center` number[], required: The coordinates of the center of the geofence (long, lat)
    - `deviceId` unknown, required

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `500`: Internal Server Error

---

[API](https://skmtc.dev/1nce/apis/1nce-os.md) - [All operations](https://skmtc.dev/1nce/apis/1nce-os/llms.txt) - [OpenAPI document](https://skmtc.dev/1nce/apis/1nce-os/revisions/f1aabbc6aeea?raw)
