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

# Calculate GeofenceTriggers for a Job

> Calculate `GeofenceTriggers` for a `Job` based on the strategy.

- `historical`: Returns existing non-skipped geofence triggers for the job
- `naive`: Calculates geofence triggers using naive strategy (requires `delay_seconds`)
- `accuracy_strict`: Calculates geofence triggers using accuracy strict strategy (requires `delay_seconds`)



## OpenAPI

````yaml /api-reference/openapi.json post /v1/companies/{company-id}/jobs/{job-id}/geofence_triggers
openapi: 3.0.3
info:
  title: Horizon API V1
  version: '1.0'
  contact:
    name: Tread
    url: https://tread.io
    email: developers@tread.io
  description: >-
    This is the Version 1 implementation.


    When in doubt we default to the practices outlined
    [here](https://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#advanced-queries)
  license:
    name: Private
    url: https://tread.io
servers:
  - description: production
    url: https://api.tread-horizon.com
security:
  - bearerAuth: []
tags:
  - name: Projects
  - name: Orders
  - name: Loads
  - name: Jobs
  - name: JobAssignments
  - name: ApprovalAssignments
  - name: Equipment
  - name: FuelSurcharges
  - name: Materials
  - name: Accounts
  - name: Tickets
  - name: Users
  - name: Sites
  - name: Companies
  - name: Departments
  - name: Rates
  - name: Services
  - name: EquipmentType
  - name: FileAttachments
  - name: MaterialType
  - name: LineItemType
  - name: DriverStateEvent
  - name: Authentication
  - name: IamRoles
  - name: Typeaheads
  - name: Integrations
  - name: Reflection
  - name: LoadCycles
  - name: AddOns
  - name: ServiceClass
  - name: Invoices
  - name: JobSummaries
  - name: LoadSummaries
  - name: CompanyShares
  - name: UserDevicePermission
  - name: Drivers
  - name: Settlements
  - name: LocationHistories
  - name: Telematics
  - name: OmniReports
  - name: DriverDays
  - name: Agave
  - name: AddOnCharges
  - name: ResourceUsageLogs
  - name: ResourceScopes
  - name: TravelledDistances
  - name: MaterialRates
  - name: CompanyDayJobStats
  - name: KMLFiles
  - name: AutoAddOnAssignments
  - name: SiteRateSchedules
  - name: TwilioIntegrations
  - name: Foremen
  - name: AccountExternalTruckIdentifier
  - name: GeofenceTriggers
  - name: Labels
  - name: Compliance
  - name: ComplianceDocuments
paths:
  /v1/companies/{company-id}/jobs/{job-id}/geofence_triggers:
    parameters:
      - schema:
          type: string
          format: uuid
        name: company-id
        in: path
        required: true
        description: Company ID
      - schema:
          type: string
          format: uuid
        name: job-id
        in: path
        required: true
        description: Job ID
      - $ref: '#/components/parameters/Accept-Language'
    post:
      tags:
        - GeofenceTriggers
      summary: Calculate GeofenceTriggers for a Job
      description: >-
        Calculate `GeofenceTriggers` for a `Job` based on the strategy.


        - `historical`: Returns existing non-skipped geofence triggers for the
        job

        - `naive`: Calculates geofence triggers using naive strategy (requires
        `delay_seconds`)

        - `accuracy_strict`: Calculates geofence triggers using accuracy strict
        strategy (requires `delay_seconds`)
      operationId: post-v1-companies-company-id-jobs-job-id-geofence_triggers
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GeofenceTrigger-CalculateForJob'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: array
                    x-stoplight:
                      id: o6p7q8r9s0t1u
                    items:
                      $ref: '#/components/schemas/GeofenceTrigger-Read'
        '401':
          $ref: '#/components/responses/UnauthenticatedError'
        '404':
          $ref: '#/components/responses/Error'
        '406':
          $ref: '#/components/responses/Error'
        '415':
          $ref: '#/components/responses/Error'
        '422':
          $ref: '#/components/responses/ModelError'
components:
  parameters:
    Accept-Language:
      name: Accept-Language
      in: header
      schema:
        type: string
        default: en
        example: en
      description: >-
        The Accept-Language request HTTP header indicates the natural language
        and locale that the client prefers. 
  schemas:
    GeofenceTrigger-CalculateForJob:
      title: GeofenceTrigger-CalculateForJob
      x-stoplight:
        id: k8m3n9p2q4r5s
      type: object
      description: >-
        When present, geofences override the job's default geofences (from its
        sites) for :naive and :accuracy_strict strategies.
      properties:
        strategy:
          type: string
          x-stoplight:
            id: t7u8v9w0x1y2z
          enum:
            - historical
            - naive
            - accuracy_strict
          default: historical
          nullable: true
        delay_seconds:
          type: integer
          x-stoplight:
            id: a3b4c5d6e7f8g
          description: Only valid for :naive and :accuracy_strict strategies
          nullable: true
        geofences:
          type: array
          x-stoplight:
            id: p4q5r6s7t8u9v
          description: >-
            Inline geofence definitions to use instead of the job's default
            geofences. Only used for :naive and :accuracy_strict strategies.
          items:
            $ref: '#/components/schemas/NextBillionGeofence-Create'
          nullable: true
      additionalProperties: false
    GeofenceTrigger-Read:
      title: GeofenceTrigger-Read
      x-stoplight:
        id: cyjkjb1roiwj8
      type: object
      required:
        - geofence_trigger_type
        - triggered_location
        - geofence
      properties:
        geofence_trigger_type:
          $ref: '#/components/schemas/GeofenceTriggerType'
        triggered_location:
          $ref: '#/components/schemas/GeofenceTrigger-LocationHistory-Read-Nested'
        geofence:
          $ref: '#/components/schemas/Geofence-Data'
      additionalProperties: false
    NextBillionGeofence-Create:
      $ref: '#/components/schemas/Geofence-Data'
      x-stoplight:
        id: 8b9d859e5388e
    GeofenceTriggerType:
      title: GeofenceTriggerType
      x-stoplight:
        id: vmzafgjn6h2y7
      enum:
        - enter
        - exit
    GeofenceTrigger-LocationHistory-Read-Nested:
      title: GeofenceTrigger-LocationHistory-Read-Nested
      x-stoplight:
        id: f5bejqkavpkj1
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - lat
            - lon
            - occurred_at
          properties:
            driver:
              $ref: '#/components/schemas/Driver-Read-Minimal'
            equipment:
              $ref: '#/components/schemas/Equipment-Read-Minimal'
            order:
              $ref: '#/components/schemas/Order-Read-Minimal'
            job:
              $ref: '#/components/schemas/Job-Read-Minimal'
            lat:
              type: string
              x-stoplight:
                id: e7el87y9ml6ae
            lon:
              type: string
              x-stoplight:
                id: d2gnq6p76fkr6
            occurred_at:
              type: string
              x-stoplight:
                id: oj1vsapa4j117
              format: date-time
    Geofence-Data:
      title: Geofence-Data
      x-stoplight:
        id: ay73k76oae8gm
      type: object
      properties:
        id:
          type: string
          format: uuid
          x-stoplight:
            id: m9n8p7q6r5s4t
          description: NextBillionGeofence ID
        geofence:
          type: object
          x-stoplight:
            id: bo67u046r1ibk
          required:
            - name
            - type
          properties:
            id:
              type: string
              x-stoplight:
                id: nm2o97jli2zqm
              format: uuid
              description: NextBillion Geofence ID
            name:
              type: string
              x-stoplight:
                id: x5sp8wq8d2ack
            type:
              type: string
              x-stoplight:
                id: d91rv1gbtfkm0
              description: '`circle` or `polygon`'
            geojson:
              type: object
              x-stoplight:
                id: vk7dx7ipdbuxa
              required:
                - type
                - coordinates
              properties:
                type:
                  type: string
                  x-stoplight:
                    id: 65qatpxdox3e9
                  description: type should be `Polygon`
                coordinates:
                  type: array
                  x-stoplight:
                    id: 3an8g587wblcs
                  description: >-
                    This should be an enclosed polygon.


                    Example format:

                    [[[-118.226140484,34.048200454],[-118.22616052,34.046872766],[-118.226198738,34.04952736],[-118.226140484,34.048200454]]]
                  items:
                    x-stoplight:
                      id: 2kltvjxl5xks6
                    type: array
                    items:
                      x-stoplight:
                        id: k93dt39dghru4
                      type: array
                      items: {}
            circle_center:
              type: object
              x-stoplight:
                id: 6xr3h683f7cl9
              required:
                - lat
                - lon
              properties:
                lat:
                  type: number
                  x-stoplight:
                    id: y70xc1ptapv1g
                lon:
                  type: number
                  x-stoplight:
                    id: uy3twrpcueq9m
            circle_radius:
              type: number
              x-stoplight:
                id: qrnq301sqfl3d
            tag:
              x-stoplight:
                id: debfy3x1l48zc
              enum:
                - pickup
                - loading
                - drop_off
                - unloading
                - check_in
                - scaling
                - ticketing
              deprecated: true
        moving_geofence:
          type: boolean
          x-stoplight:
            id: y15533dbr62js
          default: false
        tag:
          $ref: '#/components/schemas/GeofenceTag'
        geofence_type:
          $ref: '#/components/schemas/NullableGeofenceType'
      additionalProperties: false
    UnauthenticatedError-Response:
      title: UnauthenticatedError-Response
      x-stoplight:
        id: o477eph7ttbzt
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/UnauthenticatedError'
      additionalProperties: false
    Error-Response:
      title: Error-Response
      x-stoplight:
        id: 52cydhphee3qe
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/Error'
      additionalProperties: false
    ModelError-Response:
      title: ModelError-Response
      x-stoplight:
        id: payf9ndh3l6np
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ModelError'
      additionalProperties: false
    Identifier:
      title: Identifier
      x-stoplight:
        id: gnd39lue5v7ol
      type: object
      required:
        - id
      properties:
        id:
          type: string
          x-stoplight:
            id: 2e38hjk4zd58m
          format: uuid
      additionalProperties: false
    Driver-Read-Minimal:
      title: Driver-Read-Minimal
      x-stoplight:
        id: f1d1he04n4yjs
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          x-stoplight:
            id: x918p1q0av9nk
          required:
            - first_name
            - last_name
          properties:
            first_name:
              type: string
              x-stoplight:
                id: pvqq6tp23r5eq
            last_name:
              type: string
              x-stoplight:
                id: 74tvy3qy47xc0
    Equipment-Read-Minimal:
      title: Equipment-Read-Minimal
      x-stoplight:
        id: m3uxip3u2g73e
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - name
            - external_id
          properties:
            name:
              type: string
              x-stoplight:
                id: 8j8x3f9jezxeq
            external_id:
              type: string
              x-stoplight:
                id: y33jc1a9rphsf
              nullable: true
    Order-Read-Minimal:
      title: Order-Read-Minimal
      x-stoplight:
        id: wpgfl9nff3zhz
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          x-stoplight:
            id: crmvgzs6hb81e
          required:
            - order_id
          properties:
            order_id:
              type: string
              x-stoplight:
                id: 7ac5dtqqp7juv
    Job-Read-Minimal:
      title: Job-Read-Minimal
      x-stoplight:
        id: phqsqzej6mcm3
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          x-stoplight:
            id: ic6xdggfjavde
          required:
            - job_id
          properties:
            job_id:
              type: string
              x-stoplight:
                id: pcseir7z97s0x
    GeofenceTag:
      title: GeofenceTag
      x-stoplight:
        id: anytkmb3ydi6c
      enum:
        - scaling
        - site
        - loading
        - unloading
        - check_in
        - ticketing
    NullableGeofenceType:
      title: NullableGeofenceType
      x-stoplight:
        id: ii94t82oqh5xo
      allOf:
        - $ref: '#/components/schemas/GeofenceType'
      nullable: true
      type: string
    UnauthenticatedError:
      title: UnauthenticatedError
      x-stoplight:
        id: 202o69l0fs40h
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          x-stoplight:
            id: tg10dt7s0l6bw
          properties:
            error_type:
              type: string
              x-stoplight:
                id: wvq8c0qsym4hz
          required:
            - error_type
    Error:
      title: Error
      x-stoplight:
        id: 3g57kkik3l464
      type: object
      description: An Error.
      required:
        - code
      properties:
        code:
          type: string
          x-stoplight:
            id: 7o9x1t8v0bgfo
      additionalProperties: false
    ModelError:
      title: ModelError
      x-stoplight:
        id: nhp6714o4j1qt
      description: A Model-specific error
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          required:
            - errors
          properties:
            errors:
              type: array
              x-stoplight:
                id: m4ul9vcq2deh6
              items:
                $ref: '#/components/schemas/ModelError-Item'
    GeofenceType:
      title: GeofenceType
      x-stoplight:
        id: geahowr9r8ly1
      nullable: true
      enum:
        - moving
        - circle
        - polygon
      readOnly: true
    ModelError-Item:
      title: ModelError-Item
      x-stoplight:
        id: b93chwval2t8d
      type: object
      required:
        - model
        - field
        - message
      properties:
        model:
          type: string
          x-stoplight:
            id: 30myfyjkno8ao
          description: The Model associated with this Error
        field:
          type: string
          x-stoplight:
            id: 8gl4ed3uxhdws
          description: The field associated with this Error
        message:
          type: string
          x-stoplight:
            id: bmgbrtmw17qsj
          description: The Error message
      additionalProperties: false
  responses:
    UnauthenticatedError:
      description: Example response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthenticatedError-Response'
            type: object
    Error:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error-Response'
            type: object
    ModelError:
      description: ''
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ModelError-Response'
            type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````