> ## Documentation Index
> Fetch the complete documentation index at: https://docsv4.mile.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Update geofence

> Updates a geofence. Fields you leave out keep their value; the shape is recalculated only when `geometry` or `center` is sent. When sending a circle shape, send `type: circle` with it. Same limits as create.

A circle is also stored as a 64-point polygon in `geometry`, so both shapes work the same way for detection.

Requires permission `edit/geofence`.



## OpenAPI

````yaml /openapi/public/openapi-monitoring.json put /geofence/{id}
openapi: 3.0.0
info:
  title: API - Monitoring
  version: 3.0.0
  description: API Documentation - RESTful API for field operations management.
servers:
  - url: https://apiweb.mile.app/api/v3
security:
  - bearerAuth: []
tags:
  - name: Alert
    description: >-
      An alert is an event raised while monitoring field users and vehicles, for
      example entering or leaving a geofence, idling too long, a predicted late
      task, a route deviation or a panic button press. You can list alerts, read
      a daily summary, and mark them resolved. These endpoints are served under
      `/api/v4`.
  - name: Alert Setting
    description: >-
      Alert settings switch each alert type on or off for your organization.
      These endpoints are served under `/api/v4`.
  - name: Geofence
    description: >-
      A geofence is an area drawn on the map, as a polygon or a circle. Alerts
      and automations can react when a field user enters or leaves it, or stays
      inside longer than its dwell time.
  - name: Geofence Group
    description: >-
      Geofence groups organize geofences so you can filter and manage them
      together.
paths:
  /geofence/{id}:
    put:
      tags:
        - Geofence
      summary: Update geofence
      description: >-
        Updates a geofence. Fields you leave out keep their value; the shape is
        recalculated only when `geometry` or `center` is sent. When sending a
        circle shape, send `type: circle` with it. Same limits as create.


        A circle is also stored as a 64-point polygon in `geometry`, so both
        shapes work the same way for detection.


        Requires permission `edit/geofence`.
      operationId: updateGeofence
      parameters:
        - name: id
          in: path
          required: true
          description: |-
            Unique identifier of the geofence, generated by the system.
            **Example:** `66e0a1b2c3d4e5f6a7b8c9d0`
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GeofenceUpdateRequest'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Status of response.
                  message:
                    description: Message of API response.
                    type: string
                  data:
                    description: Updated geofence.
                    type: object
                    additionalProperties: true
                example:
                  status: true
                  message: Data successfully updated.
                  data:
                    _id: 66e0a1b2c3d4e5f6a7b8c9d0
                    name: Warehouse A North
                    organizationId: 64d99303be0ad015c461c932
                    groupId: 66e0a0b1c2d3e4f5a6b7c8d9
                    type: string
                    geometry:
                      type: string
                      coordinates:
                        - - - 106.815
                            - -6.201
                          - - 106.818
                            - -6.201
                          - - 106.818
                            - -6.199
                          - - 106.815
                            - -6.199
                          - - 106.815
                            - -6.201
                    center: null
                    radius: null
                    dwellMinutes: 5
                    isActive: true
                    color: '#1E88E5'
                    createdBy: admin@example.com
                    updatedTime: '2026-10-05T03:00:00.000000Z'
                    createdTime: '2026-10-01T03:00:00.000000Z'
                    updatedBy: admin@example.com
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Bad request - invalid parameters provided.
        '404':
          description: Data not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Data not found
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Internal server error, please contact support@mile.app.
      deprecated: false
      security:
        - bearerAuth: []
components:
  schemas:
    GeofenceUpdateRequest:
      type: object
      properties:
        name:
          type: string
          maxLength: 100
          description: >-
            Name of the geofence. Maximum 100 characters, unique within your
            organization.

            **Example:** `Warehouse A`
        inputType:
          type: string
          description: The input type of the component (e.g., string, number, date, etc.)
        dwellMinutes:
          type: integer
          minimum: 0
          maximum: 1440
          description: >-
            Minutes a driver must stay inside before an enter alert is raised. 0
            to 1440.

            **Example:** `5`
        groupId:
          type: string
          description: |-
            Geofence group id, or `null` for no group.
            **Example:** `66e0a0b1c2d3e4f5a6b7c8d9`
        isActive:
          type: boolean
          description: |-
            Only active geofences raise alerts.
            **Example:** `true`
        color:
          type: string
          maxLength: 9
          description: |-
            Display color. Maximum 9 characters.
            **Example:** `#1E88E5`
        geometry:
          type: object
          description: >-
            Polygon shape, required when `type` is `polygon`. GeoJSON Polygon
            with exactly one ring of at least 3 points; the ring is closed
            automatically and must not cross itself. Coordinates are
            `[longitude, latitude]`; longitude between -180 and 180, latitude
            between -90 and 90.
          properties:
            inputType:
              type: string
              description: >-
                The input type of the component (e.g., string, number, date,
                etc.)
            coordinates:
              type: array
              items:
                type: array
                items:
                  type: array
                  items:
                    type: number
              description: 'One ring: `[[[lon, lat], [lon, lat], ...]]`.'
        center:
          type: object
          description: >-
            Circle center, required when `type` is `circle`. Coordinates are
            `[longitude, latitude]`; longitude between -180 and 180, latitude
            between -90 and 90.
          properties:
            coordinates:
              type: array
              items:
                type: number
              description: |-
                `[longitude, latitude]`.
                **Example:** `[106.8166, -6.2001]`
        radius:
          type: number
          minimum: 1
          maximum: 50000
          description: >-
            Circle radius in meters, required when `type` is `circle`. 1 to
            50000.

            **Example:** `250`
      example:
        name: Customer Hub Bekasi
        type: string
        center:
          coordinates:
            - 106.9896
            - -6.2383
        radius: 300
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Use a valid Bearer token to authenticate.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.