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

# Update an alert rule

> Changes the fields sent; the whole rule is checked again afterwards (title, zones, members, time window). Fields the action does not use are cleared. Geofences are refreshed on the phones when the rule watched or now watches zones. An unknown or foreign id is answered with 400 invalid_request. Admins, operators and the company key may call it; workers get 403.



## OpenAPI

````yaml v1/openapi.json PATCH /alerts/configs/{id}
openapi: 3.1.0
info:
  title: Hellotracks REST API
  version: '1'
  description: >-
    Plain REST resources over HTTPS, for tools, automations and services. The ht
    command line is built on it.
  contact:
    email: api@hellotracks.com
servers:
  - url: https://api.hellotracks.com/v1
security:
  - ApiKey: []
tags:
  - name: Sign-up and sign-in
    description: >-
      Create a company or get an API key by an emailed code, without a key; and
      check which account a key belongs to.
  - name: Company
    description: The company the API key belongs to, with its settings and teams.
  - name: Members
    description: 'The people in the company: admins, operators and workers.'
  - name: API keys
    description: 'The company''s API keys: list, create, revoke and delete.'
  - name: Jobs
    description: 'Jobs: work at a location on a date, assigned to a member.'
  - name: Places
    description: 'Places: customer sites and other saved locations with a check-in radius.'
  - name: Zones
    description: 'Zones: the company''s geofences.'
  - name: Routing
    description: Route optimization for one member's day.
  - name: ETA pages
    description: >-
      Live ETA pages (eta.page links) that show a job's recipient when the
      worker arrives.
  - name: Maps
    description: Rendered maps as GeoJSON, and public map share links.
  - name: Timesheets
    description: Clock-in and clock-out entries of members, with totals, and editing them.
  - name: Forms
    description: >-
      Form templates, submitted forms, attachments for file and image fields,
      and forms linked to places and jobs.
  - name: Alerts
    description: >-
      Alert rules (configs) that watch members, places and zones, and the alerts
      (instances) they raised.
  - name: Reports
    description: >-
      Reports: the newer reporting API (catalog, preview, run, saved) and the
      older one (types, generate, jobs, uploads, recurring).
  - name: Webhooks
    description: URLs Hellotracks calls when jobs, check-ins, clock-ins or alerts happen.
paths:
  /alerts/configs/{id}:
    patch:
      tags:
        - Alerts
      summary: Update an alert rule
      description: >-
        Changes the fields sent; the whole rule is checked again afterwards
        (title, zones, members, time window). Fields the action does not use are
        cleared. Geofences are refreshed on the phones when the rule watched or
        now watches zones. An unknown or foreign id is answered with 400
        invalid_request. Admins, operators and the company key may call it;
        workers get 403.
      operationId: updateAlertConfig
      parameters:
        - name: id
          in: path
          required: true
          description: Alert config id (numeric).
          schema:
            type: string
          example: '1700000000001'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AlertConfigInput'
            example:
              status: paused
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Envelope'
                properties:
                  data:
                    type: object
                    properties:
                      config:
                        $ref: '#/components/schemas/AlertConfig'
              example:
                data:
                  config:
                    id: '1700000000001'
                    createdAt: 1761900000000
                    title: Late at warehouse
                    description: Did not check in at the warehouse
                    action: no_check_in
                    actionCode: 4
                    actionLabel: Does not check in
                    duration: ''
                    intervalMs: 0
                    memberIds:
                      - a1b2c3
                    teamIds: []
                    placeIds:
                      - d4e5f6
                    andPlaceIds: []
                    zoneIds: []
                    zones: []
                    emails:
                      - dispatch@example.com
                    email: dispatch@example.com
                    phone: ''
                    slackChannelId: ''
                    weekdays: 31
                    weekdayNames:
                      - monday
                      - tuesday
                      - wednesday
                      - thursday
                      - friday
                    timeStart: '08:00'
                    timeEnd: '09:00'
                    timeStartCode: 800
                    timeEndCode: 900
                    status: 1
                    statusText: paused
                    type: 1
                    typeText: regular
                    companyUid: c0c0c0
                error: null
                meta:
                  path: /v1/alerts/configs/1700000000001
                  method: PATCH
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    AlertConfigInput:
      type: object
      additionalProperties: false
      description: >-
        Fields of an alert rule. Unknown fields are refused. On create, title
        and an action are required; on update, only the fields sent change. Also
        accepted: actionCode/action1 for action, andActionCode/action2 for
        andAction, message for description, place1Ids for placeIds, place2Ids
        for andPlaceIds, zones for zoneIds, email for emails,
        interval/intervalMs for duration.
      properties:
        title:
          type: string
          description: Required (not empty after the change).
        description:
          type: string
          description: Message sent with the alert.
        message:
          type: string
          description: Alias of description; wins when both are set.
        action:
          type: string
          enum:
            - checks_in
            - checks_out
            - checks_any
            - no_check_in
            - no_check_out
            - no_check_any
            - idle
            - enters_zone
            - leaves_zone
            - no_connection_to_device
            - enters_danger_zone
            - battery_low
          description: >-
            Trigger name (case-insensitive). Required on create unless
            actionCode is given.
        actionCode:
          type: integer
          minimum: 1
          maximum: 12
          description: >-
            checks_in=1, checks_out=2, checks_any=3, no_check_in=4,
            no_check_out=5, no_check_any=6, idle=7, enters_zone=8,
            leaves_zone=9, no_connection_to_device=10, enters_danger_zone=11,
            battery_low=12.
        action1:
          type: integer
          description: Alias of actionCode.
        andAction:
          type: string
          enum:
            - none
            - checks_in
            - checks_out
            - no_check_in
            - no_check_out
          description: >-
            Second condition, only for checks_in, checks_out and checks_any.
            "none" or empty removes it.
        andActionCode:
          type: integer
        action2:
          type: integer
          description: Alias of andActionCode.
        duration:
          oneOf:
            - type: integer
              description: Milliseconds.
            - type: string
              pattern: ^\d+(m|h)?$
              description: Milliseconds, or minutes/hours like "10m", "30m", "1h".
          description: >-
            For idle, no_connection_to_device and rules with an andAction;
            defaults to 1h there and is set to 0 otherwise.
        interval:
          description: Alias of duration.
        intervalMs:
          description: Alias of duration.
        memberIds:
          oneOf:
            - type: array
              items:
                type: string
            - type: string
              description: Comma-separated.
          description: Members of the company.
        teamIds:
          oneOf:
            - type: array
              items:
                type: string
            - type: string
          description: Team numbers (1 to the company's team count).
        placeIds:
          oneOf:
            - type: array
              items:
                type: string
            - type: string
          description: Places for the place actions; cleared for other actions.
        place1Ids:
          description: Alias of placeIds.
        andPlaceIds:
          oneOf:
            - type: array
              items:
                type: string
            - type: string
          description: Places for the andAction.
        place2Ids:
          description: Alias of andPlaceIds.
        zoneIds:
          oneOf:
            - type: array
              items:
                type: string
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/AlertZoneRef'
          description: >-
            Zones (numeric ids) for the zone actions; required for enters_zone,
            leaves_zone, enters_danger_zone.
        zones:
          description: Alias of zoneIds.
        emails:
          oneOf:
            - type: array
              items:
                type: string
            - type: string
          description: E-mail recipients (must contain @).
        email:
          description: Alias of emails.
        phone:
          type: string
        slackChannelId:
          type: string
        weekdays:
          oneOf:
            - type: integer
              minimum: 0
              maximum: 127
              description: >-
                Bitmask: bit 0 = Monday ... bit 6 = Sunday (1 = Monday only, 31
                = Monday to Friday, 127 = every day).
            - type: array
              items:
                type: string
              description: >-
                Weekday names: monday/mon/mo, tuesday/tue/tu, wednesday/wed/we,
                thursday/thu/th, friday/fri/fr, saturday/sat/sa, sunday/sun/su
                (case-insensitive).
        timeStart:
          type: string
          pattern: ^\d{2}:\d{2}$
          description: HH:mm, 00:00 to 23:59.
        timeEnd:
          type: string
          pattern: ^\d{2}:\d{2}$
          description: HH:mm, after 00:00, up to 24:00.
        status:
          oneOf:
            - type: string
              enum:
                - active
                - paused
                - archived
                - deleted
            - type: integer
              enum:
                - 0
                - 1
                - 2
          description: Defaults to active on create.
    Envelope:
      type: object
      properties:
        data:
          description: The payload.
        error:
          type: 'null'
        meta:
          $ref: '#/components/schemas/Meta'
    AlertConfig:
      type: object
      description: An alert rule.
      properties:
        id:
          type: string
          description: Numeric id, as a string.
          example: '1700000000001'
        createdAt:
          type: integer
          format: int64
          description: Milliseconds since the epoch.
        title:
          type: string
        description:
          type: string
          description: The message text sent with the alert.
        action:
          type: string
          enum:
            - checks_in
            - checks_out
            - checks_any
            - no_check_in
            - no_check_out
            - no_check_any
            - idle
            - enters_zone
            - leaves_zone
            - no_connection_to_device
            - enters_danger_zone
            - battery_low
        actionCode:
          type: integer
        actionLabel:
          type: string
        andAction:
          type: string
          enum:
            - checks_in
            - checks_out
            - no_check_in
            - no_check_out
          description: Only present when the rule has a second condition.
        andActionCode:
          type: integer
        andActionLabel:
          type: string
        duration:
          type: string
          description: >-
            Duration as text: "1h", "30m", or plain milliseconds when not whole
            minutes; empty when 0.
          example: 1h
        intervalMs:
          type: integer
          format: int64
        memberIds:
          type: array
          items:
            type: string
        teamIds:
          type: array
          items:
            type: string
          description: Team numbers as strings.
        placeIds:
          type: array
          items:
            type: string
        andPlaceIds:
          type: array
          items:
            type: string
        zoneIds:
          type: array
          items:
            type: string
        zones:
          type: array
          items:
            $ref: '#/components/schemas/AlertZoneRef'
        emails:
          type: array
          items:
            type: string
        email:
          type: string
          description: The same e-mails, comma-separated.
        phone:
          type: string
        slackChannelId:
          type: string
        weekdays:
          type: integer
          description: Bitmask, bit 0 = Monday ... bit 6 = Sunday.
        weekdayNames:
          type: array
          items:
            type: string
            enum:
              - monday
              - tuesday
              - wednesday
              - thursday
              - friday
              - saturday
              - sunday
        timeStart:
          type: string
          description: HH:mm
          example: '08:00'
        timeEnd:
          type: string
          description: HH:mm
          example: '18:00'
        timeStartCode:
          type: integer
          description: HHMM as a number (800 = 08:00).
        timeEndCode:
          type: integer
          description: HHMM as a number (1800 = 18:00, 2400 = end of day).
        status:
          type: integer
          enum:
            - 0
            - 1
            - 2
          description: 0 active, 1 paused, 2 deleted.
        statusText:
          type: string
          enum:
            - active
            - paused
            - deleted
            - unknown
        type:
          type: integer
          enum:
            - 1
            - 2
            - 3
          description: 1 regular, 2 dynamic (has an andAction), 3 one-time.
        typeText:
          type: string
          enum:
            - regular
            - dynamic
            - one_time
        companyUid:
          type: string
    AlertZoneRef:
      type: object
      properties:
        id:
          type: string
          example: '12'
        title:
          type: string
          example: Warehouse
    Meta:
      type: object
      properties:
        path:
          type: string
          description: The request path, without /v1.
          example: /jobs
        method:
          type: string
          example: GET
    ErrorEnvelope:
      type: object
      properties:
        data:
          type: 'null'
        error:
          $ref: '#/components/schemas/Error'
        meta:
          $ref: '#/components/schemas/Meta'
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable error code for programs.
          enum:
            - invalid_request
            - invalid_format
            - invalid_data
            - invalid_api_key
            - unknown_user
            - authentication_failed
            - forbidden
            - not_found
            - already_exists
            - throttled
            - not_ready
            - clock_invalid
            - force_logout
            - internal_error
            - unknown_error
        message:
          type: string
          description: Why it failed, for people.
  responses:
    BadRequest:
      description: The request is invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            data: null
            error:
              code: invalid_request
              message: date must be YYYY-MM-DD
            meta:
              path: /jobs
              method: GET
    Unauthorized:
      description: The API key is missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            data: null
            error:
              code: invalid_api_key
              message: Invalid Hellotracks API key.
            meta:
              path: /jobs
              method: GET
    Forbidden:
      description: The key may not do this.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            data: null
            error:
              code: forbidden
              message: No permission.
            meta:
              path: /jobs
              method: GET
    TooManyRequests:
      description: Too many requests; slow down.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            data: null
            error:
              code: throttled
              message: Too many requests.
            meta:
              path: /jobs
              method: GET
    ServerError:
      description: Hellotracks failed; retry later.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            data: null
            error:
              code: internal_error
              message: Hellotracks API is temporarily unavailable.
            meta:
              path: /jobs
              method: GET
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: API-Key
      description: >-
        Your API key, from More → API & Integrations in the dashboard, or from
        ht signup / ht auth login.

````

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