> ## 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.

# Update a Job

> Update a `Job` by ID

This endpoint requires the `edit_job` permission.

If setting the `driver_id`, the `assign_job` permission is also required.



## OpenAPI

````yaml /api-reference/openapi.json patch /v1/jobs/{id}
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/jobs/{id}:
    parameters:
      - schema:
          type: string
        name: id
        in: path
        required: true
        description: Job ID
      - $ref: '#/components/parameters/Accept-Language'
    patch:
      tags:
        - Jobs
      summary: Update a Job
      description: >-
        Update a `Job` by ID


        This endpoint requires the `edit_job` permission.


        If setting the `driver_id`, the `assign_job` permission is also
        required.
      operationId: patch-v1-jobs-id
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Job-Update'
        description: ''
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Job-Read'
                required:
                  - data
        '400':
          $ref: '#/components/responses/Error'
        '401':
          $ref: '#/components/responses/UnauthenticatedError'
        '403':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '406':
          $ref: '#/components/responses/Error'
        '409':
          $ref: '#/components/responses/StateError'
        '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:
    Job-Update:
      title: Job-Update
      x-stoplight:
        id: 7pgu7obbcmmal
      type: object
      properties:
        job_start_at:
          type: string
          x-stoplight:
            id: 9honxf37kab3m
          format: date-time
        notes:
          type: string
          x-stoplight:
            id: j1g08m0l4svr8
          nullable: true
        quantity:
          type: number
          x-stoplight:
            id: cy88a4semz4yb
          nullable: true
        unit_of_measure:
          $ref: '#/components/schemas/NullableOrderUnitOfMeasure'
        load_unit_of_measure:
          $ref: '#/components/schemas/NullableOrderUnitOfMeasure'
        equipment_id:
          x-stoplight:
            id: p86w6pq4wlsk1
          type: string
          nullable: true
        material_id:
          x-stoplight:
            id: rr4ncjvlovjw5
          type: string
          nullable: true
        waypoints:
          type: array
          x-stoplight:
            id: 0bv1s5bvwicc0
          items:
            $ref: '#/components/schemas/Waypoint-Update-Destroyable'
        sales_contact:
          $ref: '#/components/schemas/Contact-Update-Destroyable'
        foreman_contact:
          $ref: '#/components/schemas/Contact-Update-Destroyable'
        supervisor_contact:
          $ref: '#/components/schemas/Contact-Update-Destroyable'
        collaborator_contact:
          $ref: '#/components/schemas/Contact-Update-Destroyable'
        driver_id:
          type: string
          x-stoplight:
            id: jadmvq8ammhyp
          nullable: true
        priority:
          type: integer
          x-stoplight:
            id: 6btti38mbfay9
        customer_rate_id:
          type: string
          x-stoplight:
            id: 9hnt0jgdevrhw
          format: uuid
          nullable: true
        vendor_rate_id:
          type: string
          x-stoplight:
            id: l0lsr0r06gx5n
          format: uuid
          nullable: true
        billable_hours:
          type: number
          x-stoplight:
            id: hbf3w63lzkwpg
        additional_equipment_ids:
          type: array
          x-stoplight:
            id: q9mdqgfv3ym3h
          minItems: 0
          items:
            x-stoplight:
              id: 3oauddfa0i0k0
            type: string
            format: uuid
        foreman_ids:
          type: array
          x-stoplight:
            id: 38gzkcegzs98b
          minItems: 0
          items:
            x-stoplight:
              id: 12fh56ct6i3do
            type: string
            format: uuid
        collaborator_ids:
          type: array
          x-stoplight:
            id: a8gzkcegzs98b
          minItems: 0
          items:
            x-stoplight:
              id: a2fh56ct6i3do
            type: string
            format: uuid
        salesperson_ids:
          type: array
          x-stoplight:
            id: b8gzkcegzs99c
          minItems: 0
          items:
            x-stoplight:
              id: b2fh56ct6i3eo
            type: string
            format: uuid
        service_class_id:
          type: string
          x-stoplight:
            id: tuqzg44a7iyrz
          format: uuid
          nullable: true
        hauler_rate_type:
          type: string
          nullable: true
        driver_rate_id:
          type: string
          x-stoplight:
            id: yk8b39a12fuj4
          nullable: true
        driver_rate_value:
          type: number
          x-stoplight:
            id: xx22exf2mwn29
          nullable: true
        driver_rate_type:
          $ref: '#/components/schemas/NullableRateType'
        customer_rate_value:
          type: number
          x-stoplight:
            id: lmxbocvhb2yja
          nullable: true
        customer_rate_type:
          $ref: '#/components/schemas/NullableRateType'
        vendor_rate_value:
          type: number
          x-stoplight:
            id: ognfpa181evso
          nullable: true
        vendor_rate_type:
          $ref: '#/components/schemas/NullableRateType'
        phase_id:
          type: string
          x-stoplight:
            id: rd18vcmzyug4p
          nullable: true
        requested_loads_count:
          type: integer
          x-stoplight:
            id: 6gi27c5w5c2s3
          minimum: 1
          maximum: 25
          deprecated: true
          description: >-
            Deprecated in favor of `quantity` and `unit_of_measure`. When
            `unit_of_measure` is `Load`, then `quantity` is the number of loads,
            otherwise it is `1`.
        requested_equipment_type_name:
          type: string
          x-stoplight:
            id: ef4wd2le70qgw
          nullable: true
        requested_equipment_type_accounting_id:
          type: string
          x-stoplight:
            id: ef4wd2le80qgw
          nullable: true
        equipment_type_gross_capacity:
          type: number
          x-stoplight:
            id: tsyyom1lf1u19
          nullable: true
        recurring_loads:
          type: boolean
          x-stoplight:
            id: 33aap8yjtdkww
        material_rate_assignment:
          $ref: '#/components/schemas/MaterialRateAssignment-Update'
        equipment_type_gross_capacity_unit_of_measure:
          $ref: '#/components/schemas/NullableOrderUnitOfMeasure'
        job_time:
          type: integer
          x-stoplight:
            id: dtsd9v5rc788u
          nullable: true
        compliance_override:
          type: boolean
          x-stoplight:
            id: c9m2p4xk7rj1a
          description: When true, logs a compliance override for the job assignment
      additionalProperties: false
    Job-Read:
      title: Job-Read
      x-stoplight:
        id: fk1whoyjcw1dx
      allOf:
        - $ref: '#/components/schemas/Job-Read-Nested'
        - $ref: '#/components/schemas/Timestamps'
        - type: object
          x-stoplight:
            id: p33029njhin7c
          required:
            - notes
            - quantity
            - load_unit_of_measure
            - order
            - service
            - waypoints
            - company
            - priority
            - state
            - billable_hours
            - billable_hours_overridden
            - additional_equipment
            - editable
            - copyable
            - state_changed_at
            - load_cycle_avg
            - state_events
            - foremen
            - collaborators
            - salespeople
            - paused_at
            - completed_loads_count
            - requested_equipment_type_name
            - requested_equipment_type_accounting_id
            - requested_loads_count
            - equipment_type_gross_capacity
            - deletable
            - recurring_loads
            - equipment_type_gross_capacity_unit_of_measure
            - tickets_count
            - job_time
            - approved_at
            - driver_require_all_permissions
            - times_editable
          properties:
            notes:
              type: string
              x-stoplight:
                id: phsxh65xug2th
              nullable: true
            quantity:
              type: string
              x-stoplight:
                id: l8tsq23xqo4jj
              nullable: true
            load_unit_of_measure:
              $ref: '#/components/schemas/NullableOrderUnitOfMeasure'
            order:
              $ref: '#/components/schemas/Order-Read-Nested'
            equipment:
              $ref: '#/components/schemas/Equipment-Read-Nested'
            material:
              $ref: '#/components/schemas/Material-Read-Nested'
            service:
              $ref: '#/components/schemas/Service-Read-Nested'
            waypoints:
              type: array
              x-stoplight:
                id: 2ifgrsz42xjil
              items:
                $ref: '#/components/schemas/Waypoint-Read-Nested'
            company:
              $ref: '#/components/schemas/Company-Read-Nested'
            foreman_contact:
              $ref: '#/components/schemas/Contact-Read-Nested'
            sales_contact:
              $ref: '#/components/schemas/Contact-Read-Nested'
            supervisor_contact:
              $ref: '#/components/schemas/Contact-Read-Nested'
            collaborator_contact:
              $ref: '#/components/schemas/Contact-Read-Nested'
            driver:
              $ref: '#/components/schemas/Driver-Read-Nested'
            priority:
              type: integer
              x-stoplight:
                id: bns47vwaiwvuc
              minimum: 0
            project:
              $ref: '#/components/schemas/Project-Read-Nested'
            state:
              $ref: '#/components/schemas/JobState'
            billable_hours:
              type: string
              x-stoplight:
                id: sslxwnjds71t1
            billable_hours_overridden:
              type: boolean
              x-stoplight:
                id: 40omp8yjtdkjc
            additional_equipment:
              type: array
              x-stoplight:
                id: 171atci0dqxnb
              minItems: 0
              items:
                $ref: '#/components/schemas/Equipment-Read-Nested'
            editable:
              type: boolean
              x-stoplight:
                id: mnr866etesd5v
              readOnly: true
            copyable:
              type: boolean
              x-stoplight:
                id: mbb866etesd2v
              readOnly: true
            state_changed_at:
              type: string
              x-stoplight:
                id: 65al2lnrd07iw
              format: date-time
              nullable: true
            load_cycle_avg:
              type: integer
              x-stoplight:
                id: k667w729b2c88
              description: >-
                Average `LoadCycle` time in minutes of all `Loads` under this
                `Job`
            state_events:
              type: array
              x-stoplight:
                id: mhf5t00cazoxb
              items:
                $ref: '#/components/schemas/JobStateEvent'
            vendor_job_assignment:
              $ref: '#/components/schemas/JobAssignment-Read-Nested'
            customer_job_assignment:
              $ref: '#/components/schemas/JobAssignment-Read-Nested'
            foremen:
              type: array
              x-stoplight:
                id: pfd34vhu4veq9
              items:
                $ref: '#/components/schemas/Foreman-Read-Nested'
            collaborators:
              type: array
              x-stoplight:
                id: afd34vhu4veq9
              items:
                $ref: '#/components/schemas/User-Read-Nested'
            salespeople:
              type: array
              x-stoplight:
                id: bfd34vhu4veq9
              items:
                $ref: '#/components/schemas/User-Read-Nested'
            service_class:
              $ref: '#/components/schemas/ServiceClass-Read-Nested'
            hauler_rate_type:
              type: string
              nullable: true
            driver_rate:
              x-stoplight:
                id: 2oyybnpp809cm
              anyOf:
                - $ref: '#/components/schemas/RateTime-Read-Nested'
                - $ref: '#/components/schemas/RatePerUnit-Read-Nested'
                - $ref: '#/components/schemas/RateCommission-Read-Nested'
                - $ref: '#/components/schemas/RateFlatCommission-Read-Nested'
                - $ref: '#/components/schemas/RateFlatRate-Read-Nested'
            paused_at:
              type: string
              x-stoplight:
                id: 5nom5q6l1h1ex
              nullable: true
            driver_rate_value:
              type: string
              x-stoplight:
                id: 7py18hlqsxb0r
              nullable: true
            driver_rate_type:
              $ref: '#/components/schemas/NullableRateType'
            completed_loads_count:
              type: integer
              x-stoplight:
                id: y624d4j6uk6y0
            phase:
              $ref: '#/components/schemas/Phase-Read'
            requested_equipment_type_name:
              type: string
              x-stoplight:
                id: a9ptxp6x3enwn
              nullable: true
            requested_equipment_type_accounting_id:
              type: string
              x-stoplight:
                id: a9qtxp7x3fnwn
              nullable: true
            requested_loads_count:
              type: integer
              x-stoplight:
                id: cagzjsbid0xh9
              nullable: true
            equipment_type_gross_capacity:
              type: string
              x-stoplight:
                id: tzo8dx447mzlr
              nullable: true
            deletable:
              type: boolean
              x-stoplight:
                id: bnyc7ov7acgp1
            job_summary:
              $ref: '#/components/schemas/JobSummary-Read'
            recurring_loads:
              type: boolean
              x-stoplight:
                id: 00aap8yjtdkzz
            approval_status:
              $ref: '#/components/schemas/Approval-Status'
            driver_commission_rate_value:
              type: string
              x-stoplight:
                id: dffb7rsfmox6m
              description: >-
                This is the applied value when the `driver_rate_type` is
                commission-based.
              nullable: true
            driver_commission_rate_type:
              $ref: '#/components/schemas/NullableRateType'
            equipment_type_gross_capacity_unit_of_measure:
              $ref: '#/components/schemas/NullableOrderUnitOfMeasure'
            tickets_count:
              type: integer
              x-stoplight:
                id: d5zxeggcmo29t
            job_time:
              type: integer
              x-stoplight:
                id: rc788udtsd9v5
              nullable: true
            approved_at:
              type: string
              x-stoplight:
                id: 66al3lnsd07iw
              format: date-time
              nullable: true
            driver_require_all_permissions:
              type: boolean
              x-stoplight:
                id: smprzf8aeome7
              description: >-
                The `Job`'s `Company`'s feature flag setting for
                `driver_require_all_permissions` at creation time. Defaults to
                `false`.
            times_editable:
              type: boolean
              description: >-
                The `Job`'s `Company`'s feature flag setting for
                `edit_job_times` at creation time. Defaults to `false`.
        - $ref: '#/components/schemas/RoleApprovable'
          type: object
        - $ref: '#/components/schemas/MaterialRateAssignmentable'
        - $ref: '#/components/schemas/GpsStatusable'
    NullableOrderUnitOfMeasure:
      title: NullableOrderUnitOfMeasure
      x-stoplight:
        id: rtlna368z495u
      allOf:
        - $ref: '#/components/schemas/OrderUnitOfMeasure'
      type: string
      nullable: true
    Waypoint-Update-Destroyable:
      title: Waypoint-Update-Destroyable
      x-stoplight:
        id: w96rpm44miiib
      allOf:
        - type: object
          properties:
            type:
              $ref: '#/components/schemas/WaypointType'
            site_id:
              type: string
              x-stoplight:
                id: 8quojxs0ual5a
              format: uuid
            contact:
              $ref: '#/components/schemas/Contact-Update'
            ordinality:
              type: integer
              x-stoplight:
                id: 53pb6rybmktqc
        - $ref: '#/components/schemas/Destroyable'
      description: ''
    Contact-Update-Destroyable:
      title: Contact-Update-Destroyable
      x-stoplight:
        id: v9odqbnxcm0g2
      allOf:
        - $ref: '#/components/schemas/Contact-Update'
        - $ref: '#/components/schemas/Destroyable'
    NullableRateType:
      title: NullableRateType
      x-stoplight:
        id: rajiobym5ovlp
      allOf:
        - $ref: '#/components/schemas/RateType'
      nullable: true
      type: string
    MaterialRateAssignment-Update:
      title: MaterialRateAssignment-Update
      x-stoplight:
        id: r5upqq4wfyxwu
      type: object
      properties:
        sell_price:
          type: number
          x-stoplight:
            id: 7kiapccrr6e48
          nullable: true
        buy_price:
          type: number
          x-stoplight:
            id: qp93icq41x7yo
          nullable: true
        unit_of_measure:
          $ref: '#/components/schemas/NullableOrderUnitOfMeasure'
        site_id:
          type: string
          x-stoplight:
            id: zggnghj7lj6hp
          format: uuid
          nullable: true
      additionalProperties: false
    Job-Read-Nested:
      title: Job-Read-Nested
      x-stoplight:
        id: qxb3a764a1hxf
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - job_id
            - loads_count
            - job_start_at
            - unit_of_measure
          properties:
            job_id:
              type: string
              x-stoplight:
                id: 692lxpafrrxpl
            loads_count:
              type: integer
              x-stoplight:
                id: 1fh2mqq1z7l8k
              description: Count of `Loads` under this `Job`
            job_start_at:
              type: string
              x-stoplight:
                id: w4o47yoyesm9u
              format: date-time
            unit_of_measure:
              $ref: '#/components/schemas/NullableOrderUnitOfMeasure'
    Timestamps:
      title: Timestamps
      x-stoplight:
        id: t82ecgfu0oj00
      type: object
      required:
        - created_at
        - updated_at
      properties:
        created_at:
          type: string
          x-stoplight:
            id: gjj950jpq0ga9
          format: date-time
          description: ISO8601 timestamp with local timezone
        updated_at:
          type: string
          x-stoplight:
            id: bwcuyfwc7aj0e
          format: date-time
          description: ISO8601 timestamp with local timezone
      additionalProperties: false
    Order-Read-Nested:
      title: Order-Read-Nested
      x-stoplight:
        id: r53ko3b3esvvf
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          x-stoplight:
            id: e0ahzgn4xwxu1
          required:
            - account
            - job_time
            - equipment_type
            - name
            - po_job_number
            - zone
            - notes
            - charge_to_account
            - state
            - editable
            - geofence_delay_seconds
          properties:
            order_id:
              type: string
              x-stoplight:
                id: rum48z3rdg42f
            dispatch_number:
              $ref: '#/components/schemas/DispatchNumber-Read-Nested'
            account:
              $ref: '#/components/schemas/Account-Read-Nested'
            job_time:
              type: integer
              x-stoplight:
                id: 4h34cu14jafd2
              nullable: true
            equipment_type:
              $ref: '#/components/schemas/EquipmentType-Read-Nested'
            name:
              type: string
              x-stoplight:
                id: dobl4n9be89ew
              nullable: true
            po_job_number:
              type: string
              x-stoplight:
                id: kv5zezw4bcj3q
              nullable: true
            zone:
              type: string
              x-stoplight:
                id: p32eix6l65ka4
              nullable: true
            notes:
              type: string
              x-stoplight:
                id: rq1csqrap8fr
              nullable: true
            charge_to_account:
              type: string
              x-stoplight:
                id: qsgspqzxb3fgo
              nullable: true
            state:
              $ref: '#/components/schemas/OrderState'
            editable:
              type: boolean
              x-stoplight:
                id: 118ydqcue5lua
              readOnly: true
            geofence_delay_seconds:
              type: integer
              x-stoplight:
                id: 9jtzn85f51ol4
              nullable: true
            default_digital_ticket_view:
              type: boolean
              default: false
              x-stoplight:
                id: ddtv6ordnested
              description: Use the default digital ticket view for jobs in this order
    Equipment-Read-Nested:
      title: Equipment-Read-Nested
      x-stoplight:
        id: 7ezenec7ycv5l
      allOf:
        - $ref: '#/components/schemas/Equipment-Read-Typeahead'
        - type: object
          required:
            - license_number
            - zone
            - accounting_id
            - equipment_id
          properties:
            license_number:
              type: string
              x-stoplight:
                id: hw1ooa17wsadq
              nullable: true
            zone:
              type: string
              x-stoplight:
                id: 81hr4p8yp8btv
              nullable: true
            accounting_id:
              type: string
              x-stoplight:
                id: ere9qhs4cuwhi
              nullable: true
            equipment_id:
              type: string
              x-stoplight:
                id: gt7r3iqzx2w0u
    Material-Read-Nested:
      title: Material-Read-Nested
      x-stoplight:
        id: 5hvekq1lnr9ku
      type: object
      required:
        - id
        - name
        - external_id
      properties:
        id:
          type: string
          x-stoplight:
            id: c6nool5iljv3l
          format: uuid
        name:
          type: string
          x-stoplight:
            id: bsd3m2c74jis8
        external_id:
          type: string
          description: Material external_id
          x-stoplight:
            id: ab0l0yvuz5u6d
          nullable: true
      additionalProperties: false
    Service-Read-Nested:
      title: Service-Read-Nested
      x-stoplight:
        id: 4bry9oy16sin9
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          properties:
            name:
              type: string
              x-stoplight:
                id: tsb5b63pzas6h
          required:
            - name
    Waypoint-Read-Nested:
      title: Waypoint-Read-Nested
      x-stoplight:
        id: s7xrqujvsvhq0
      allOf:
        - type: object
          properties:
            type:
              $ref: '#/components/schemas/WaypointType'
            ordinality:
              type: integer
              x-stoplight:
                id: fn4w5zg9n1hyl
            contact:
              $ref: '#/components/schemas/Contact-Read-Nested'
            site:
              $ref: '#/components/schemas/Site-Read-Nested'
          required:
            - type
            - ordinality
            - site
        - $ref: '#/components/schemas/Identifier'
    Company-Read-Nested:
      title: Company-Read-Nested
      x-stoplight:
        id: cb2kn77qmf1l7
      description: Compact Company model for nested reads.
      allOf:
        - $ref: '#/components/schemas/Identifier'
          x-stoplight:
            id: jwsufva4znm91
        - $ref: '#/components/schemas/TreadId'
        - type: object
          properties:
            legal_name:
              type: string
              x-stoplight:
                id: yc10t8hieecwk
              description: The Company's name. Must be globally unique.
            company_type:
              $ref: '#/components/schemas/CompanyType'
          required:
            - legal_name
            - company_type
    Contact-Read-Nested:
      title: Contact-Read-Nested
      x-stoplight:
        id: 3u6d8qhsz5ehn
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - name
            - email
            - phone
          properties:
            name:
              type: string
              x-stoplight:
                id: sd80y9pbgvkok
              nullable: true
            email:
              type: string
              x-stoplight:
                id: 883fmt34pdeaj
              nullable: true
            phone:
              type: string
              x-stoplight:
                id: wdtqyju4t4u06
              example: '+18885551234'
              nullable: true
      description: ''
    Driver-Read-Nested:
      title: Driver-Read-Nested
      x-stoplight:
        id: lcevfprple1sa
      allOf:
        - $ref: '#/components/schemas/Driver-Read-Typeahead'
        - type: object
          x-stoplight:
            id: 19sn21xqtmd0w
          required:
            - email
          properties:
            email:
              type: string
              x-stoplight:
                id: ekvo9chmdhjkp
              nullable: true
    Project-Read-Nested:
      title: Project-Read-Nested
      x-stoplight:
        id: 9ene929zmvaog
      allOf:
        - $ref: '#/components/schemas/Project-Read-Typeahead'
        - type: object
          x-stoplight:
            id: 8t1ly6sefwmit
          required:
            - po_job_number
            - internal_notes
            - job_notes
            - notes
            - order_notes
          properties:
            po_job_number:
              type: string
              x-stoplight:
                id: w5ajmms5o1rjq
              nullable: true
            internal_notes:
              type: string
              x-stoplight:
                id: 3hbaltdu1u159
              nullable: true
            job_notes:
              type: string
              x-stoplight:
                id: fupx5op0cmel2
              nullable: true
            notes:
              type: string
              x-stoplight:
                id: 96qr64lmtj36s
              nullable: true
            order_notes:
              type: string
              x-stoplight:
                id: o38gpshallijh
              nullable: true
    JobState:
      title: JobState
      x-stoplight:
        id: qyb8p2t7h0pnn
      enum:
        - created
        - assigned
        - accepted
        - rejected
        - to_pickup
        - arrived_pickup
        - loaded
        - to_dropoff
        - arrived_dropoff
        - unloaded
        - completed
        - canceled
        - ended
        - sent
        - in_review
        - flagged
        - signed_off
        - paid
        - load_completed
      example: created
      default: created
      readOnly: true
    JobStateEvent:
      title: JobStateEvent
      x-stoplight:
        id: 1a3ulz2srbdfc
      enum:
        - accept
        - arrive
        - assign
        - cancel
        - complete
        - complete_load
        - end
        - enroute
        - flag
        - load_material
        - pay
        - reject
        - remove_flag
        - remove_signoff
        - request
        - review
        - sign_off
        - unassign
        - unload_material
    JobAssignment-Read-Nested:
      title: JobAssignment-Read-Nested
      x-stoplight:
        id: mg7965bt1bm8u
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          x-stoplight:
            id: 7cm7nl6s8xho7
          required:
            - rate_value
            - rate_type
            - commission_rate_value
            - commission_rate_type
          properties:
            customer_account:
              $ref: '#/components/schemas/Account-Read-Nested'
            vendor_account:
              $ref: '#/components/schemas/Account-Read-Nested'
            rate:
              x-stoplight:
                id: dbq76i8yjcmwt
              anyOf:
                - $ref: '#/components/schemas/RateTime-Read-Nested'
                - $ref: '#/components/schemas/RateCommission-Read-Nested'
                - $ref: '#/components/schemas/RatePerUnit-Read-Nested'
                - $ref: '#/components/schemas/RateFlatCommission-Read-Nested'
                - $ref: '#/components/schemas/RateFlatRate-Read-Nested'
            rate_value:
              type: string
              x-stoplight:
                id: 1vstlgt31c0wg
              nullable: true
            rate_type:
              $ref: '#/components/schemas/NullableRateType'
            commission_rate_value:
              type: string
              x-stoplight:
                id: kl1p5p4ii7nyy
              description: >-
                This is the applied value when the `rate_type` is
                commission-based.
              nullable: true
            commission_rate_type:
              $ref: '#/components/schemas/NullableRateType'
    Foreman-Read-Nested:
      title: Foreman-Read-Nested
      x-stoplight:
        id: f9iqzaesw4aij
      allOf:
        - $ref: '#/components/schemas/Foreman-Read-Typeahead'
        - type: object
          x-stoplight:
            id: m5idk3cd24zti
          required:
            - email
            - company
          properties:
            email:
              type: string
              x-stoplight:
                id: ft77ezeftemb1
              nullable: true
            company:
              $ref: '#/components/schemas/Company-Read-Nested'
        - $ref: '#/components/schemas/Discardable'
    User-Read-Nested:
      title: User-Read-Nested
      x-stoplight:
        id: llvhpyfas0ekp
      allOf:
        - $ref: '#/components/schemas/User-Read-Typeahead'
        - $ref: '#/components/schemas/Discardable'
        - type: object
          x-stoplight:
            id: 6i4ku1oj5jnjs
          required:
            - email
            - phone
            - external_id
            - schedule_on
          properties:
            email:
              type: string
              x-stoplight:
                id: lyetvi4zixhq9
              nullable: true
            phone:
              type: string
              x-stoplight:
                id: 5dyog3jwd9m72
              description: User's E.164 formatted phone number
              nullable: true
            external_id:
              type: string
              x-stoplight:
                id: nk3qk35smj1ej
              nullable: true
            schedule_on:
              type: boolean
              x-stoplight:
                id: 5l8bajmm29c31
    ServiceClass-Read-Nested:
      title: ServiceClass-Read-Nested
      x-stoplight:
        id: ahk4knwjgo1di
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          properties:
            name:
              type: string
              description: ServiceClass name.
          required:
            - name
    RateTime-Read-Nested:
      title: RateTime-Read-Nested
      x-stoplight:
        id: k3z13rbtdojcq
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - name
            - type
            - time_rate
          properties:
            name:
              type: string
              x-stoplight:
                id: s5zmmpgpw8ykn
            type:
              $ref: '#/components/schemas/RateType'
            time_rate:
              type: number
              x-stoplight:
                id: yzbg76z9oflup
    RatePerUnit-Read-Nested:
      title: RatePerUnit-Read-Nested
      x-stoplight:
        id: 5kl2dre6otz74
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - name
            - type
            - unit_rate
          properties:
            name:
              type: string
              x-stoplight:
                id: 7wb8p1ffoz1wz
            type:
              $ref: '#/components/schemas/RateType'
            unit_rate:
              type: number
              x-stoplight:
                id: szqf3p2vkmb0x
    RateCommission-Read-Nested:
      title: RateCommission-Read-Nested
      x-stoplight:
        id: rfosxiu0rajbx
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - name
            - type
            - commission_percentage
          properties:
            name:
              type: string
              x-stoplight:
                id: uquhf0pc3ydpf
            type:
              $ref: '#/components/schemas/RateType'
            commission_percentage:
              type: number
              x-stoplight:
                id: 44e2kldfzbxdj
    RateFlatCommission-Read-Nested:
      title: RateFlatCommission-Read-Nested
      x-stoplight:
        id: wtdgoiw8tlpl3
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - name
            - type
            - commission_amount
          properties:
            name:
              type: string
              x-stoplight:
                id: yt5g1alyyd6fu
            type:
              $ref: '#/components/schemas/RateType'
            commission_amount:
              type: number
              x-stoplight:
                id: 14a1jkho85lpw
    RateFlatRate-Read-Nested:
      title: RateFlatRate-Read-Nested
      x-stoplight:
        id: l2to0mrxz6ndu
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          x-stoplight:
            id: khly9g5a3tgap
          required:
            - name
            - type
            - flat_amount
          properties:
            name:
              type: string
              x-stoplight:
                id: 0h0s2w3tathgv
            type:
              $ref: '#/components/schemas/RateType'
            flat_amount:
              type: number
              x-stoplight:
                id: 3s2pycb09j6ph
    Phase-Read:
      title: Phase-Read
      x-stoplight:
        id: t87rtwp61n8ry
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - name
            - code
            - primary
          properties:
            name:
              type: string
              x-stoplight:
                id: joxj6kldpdok8
            code:
              type: string
              x-stoplight:
                id: mtoxuvguckczq
              nullable: true
            primary:
              type: boolean
              x-stoplight:
                id: ww6q56py1x5wq
        - $ref: '#/components/schemas/Timestamps'
    JobSummary-Read:
      title: JobSummary-Read
      x-stoplight:
        id: ejiwcf15ja1c8
      type: object
      required:
        - has_gps_data
        - logging_started_at
        - logging_ended_at
        - completed_loads_count
        - break_time_minutes
        - work_time_minutes
        - approved_work_time_minutes
        - first_geofence_entry_at
        - last_geofence_exit_at
        - job_phase_name
        - job_phase_code
        - foreman_external_id
        - delivered_quantities
        - adjusted_logging_started_at
        - adjusted_logging_ended_at
        - editable
        - loads_with_tickets_count
        - pre_clamp_logging_ended_at
        - travelled_distance_meters
        - first_sent_at
        - sent_to_driver_at
        - driver_accepted_at
        - driver_declined_at
        - first_accepted_at
        - first_declined_at
        - first_canceled_at
        - pickup_geofence_entry_count
        - dropoff_geofence_entry_count
      properties:
        has_gps_data:
          type: boolean
          x-stoplight:
            id: dgva6rsrz0vu1
        logging_started_at:
          type: string
          x-stoplight:
            id: tc4hi8okbshj9
          format: date-time
          nullable: true
        logging_ended_at:
          type: string
          x-stoplight:
            id: 4zir4ztfsw4dn
          format: date-time
          nullable: true
          description: >-
            The effective end time for logging. If clamping occurred (time
            between last activity and job end exceeded 120 minutes), this will
            be the clamped time (last activity time). The original value will be
            in pre_clamp_logging_ended_at.
        completed_loads_count:
          type: integer
          x-stoplight:
            id: rg25kq0t5f0r1
          minimum: 0
        break_time_minutes:
          type: integer
          x-stoplight:
            id: f4qypqki2mjhq
          exclusiveMinimum: false
          minimum: 0
        work_time_minutes:
          type: integer
          x-stoplight:
            id: 88ilx1un65s44
          minimum: 0
        approved_work_time_minutes:
          type: integer
          x-stoplight:
            id: 6tshrxgraj12f
          nullable: true
        first_geofence_entry_at:
          type: string
          x-stoplight:
            id: 14ppafk4hkc9q
          format: date-time
          nullable: true
        last_geofence_exit_at:
          type: string
          x-stoplight:
            id: uti6t2fcazedd
          format: date-time
          nullable: true
        job_phase_name:
          type: string
          x-stoplight:
            id: ka1g1qprw136q
          nullable: true
        job_phase_code:
          type: string
          x-stoplight:
            id: 4mc97lx598wxk
          nullable: true
        foreman_external_id:
          type: string
          x-stoplight:
            id: z31ikmks6ps4s
          nullable: true
        delivered_quantities:
          type: array
          x-stoplight:
            id: gnvbyj46n5rkw
          items:
            $ref: '#/components/schemas/DeliveredQuantity-Read'
        adjusted_logging_started_at:
          type: string
          x-stoplight:
            id: bbcfmvpk7hci8
          format: date-time
          nullable: true
        adjusted_logging_ended_at:
          type: string
          x-stoplight:
            id: bag4ffzlbputs
          format: date-time
          nullable: true
        editable:
          type: boolean
          x-stoplight:
            id: stupblzff4gab
          readOnly: true
        loads_with_tickets_count:
          type: integer
          x-stoplight:
            id: d1chn0k33894t
        pre_clamp_logging_ended_at:
          type: string
          x-stoplight:
            id: aq9ycutx6v5hn
          format: date-time
          nullable: true
          description: >-
            Original logging_ended_at value before clamping was applied. Only
            set when clamping occurred (i.e., when the time between last
            activity and job end exceeded 120 minutes).
        travelled_distance_meters:
          type: string
          x-stoplight:
            id: td3l2m3n4o5p6
          nullable: true
        first_sent_at:
          type: string
          x-stoplight:
            id: fs1a2b3c4d5e6
          format: date-time
          nullable: true
          description: Earliest JobSent event timestamp
        sent_to_driver_at:
          type: string
          x-stoplight:
            id: st2d3e4f5g6h7
          format: date-time
          nullable: true
          description: Latest JobSent event timestamp when driver is assigned
        driver_accepted_at:
          type: string
          x-stoplight:
            id: da3e4f5g6h7i8
          format: date-time
          nullable: true
          description: Latest JobAccepted event timestamp where driver created it
        driver_declined_at:
          type: string
          x-stoplight:
            id: dd4f5g6h7i8j9
          format: date-time
          nullable: true
          description: Latest JobDeclined event timestamp where driver created it
        first_accepted_at:
          type: string
          x-stoplight:
            id: fa5g6h7i8j9k0
          format: date-time
          nullable: true
          description: Earliest JobAccepted event timestamp
        first_declined_at:
          type: string
          x-stoplight:
            id: fd6h7i8j9k0l1
          format: date-time
          nullable: true
          description: Earliest JobDeclined event timestamp
        first_canceled_at:
          type: string
          x-stoplight:
            id: fc7i8j9k0l1m2
          format: date-time
          nullable: true
          description: Earliest JobCanceled event timestamp
        pickup_geofence_entry_count:
          type: integer
          x-stoplight:
            id: pg8j9k0l1m2n3
          minimum: 0
          description: Total count of site-tagged geofence entry events at pickup location
        dropoff_geofence_entry_count:
          type: integer
          x-stoplight:
            id: dg9k0l1m2n3o4
          minimum: 0
          description: Total count of site-tagged geofence entry events at dropoff location
        gps_active_period_minutes:
          type: integer
          x-stoplight:
            id: gps1a2b3c4d5e6
          nullable: true
          minimum: 0
          description: Active work time in minutes excluding pauses and breaks
        gps_total_pings:
          type: integer
          x-stoplight:
            id: gps2b3c4d5e6f7
          nullable: true
          minimum: 0
          description: Total GPS location pings recorded during the job
        gps_offline_pings:
          type: integer
          x-stoplight:
            id: gps3c4d5e6f7g8
          nullable: true
          minimum: 0
          description: Count of GPS pings recorded in offline mode (batch uploaded)
        gps_expected_pings:
          type: integer
          x-stoplight:
            id: gps4d5e6f7g8h9
          nullable: true
          minimum: 0
          description: Expected GPS pings based on active period and ping frequency
        gps_confidence_level:
          type: string
          x-stoplight:
            id: gps5e6f7g8h9i0
          nullable: true
          enum:
            - high
            - medium
            - low
          description: GPS tracking confidence level based on coverage and gap analysis
      additionalProperties: false
    Approval-Status:
      title: Approval-Status
      x-stoplight:
        id: aegeztn5w5roc
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - biller_approved
            - company_admin_approved
            - driver_approved
            - foreman_approved
            - billing_approved_at
            - field_approved_at
          properties:
            biller_approved:
              type: boolean
              x-stoplight:
                id: nfc3nt03sl8bb
            company_admin_approved:
              type: boolean
              x-stoplight:
                id: 7h8yut8t1gc5m
            driver_approved:
              type: boolean
              x-stoplight:
                id: a5dbhqhyfjyvc
            foreman_approved:
              type: boolean
              x-stoplight:
                id: s1mr5k2nb6pp9
            billing_approved_at:
              type: string
              x-stoplight:
                id: igwmhwlt4rljp
              format: date-time
              nullable: true
            field_approved_at:
              type: string
              x-stoplight:
                id: ewrpq44soitt8
              format: date-time
              nullable: true
      description: Approval status
    RoleApprovable:
      title: RoleApprovable
      x-stoplight:
        id: fie0647l1zmho
      type: object
      required:
        - approved
        - approvable
        - unapprovable
        - billing_approved_at
        - field_approved_at
      properties:
        approved:
          type: boolean
          x-stoplight:
            id: je3f3e9kzi9d8
        approvable:
          type: boolean
          x-stoplight:
            id: 3e8gmlshlm661
        unapprovable:
          type: boolean
          x-stoplight:
            id: 7t2cltf0njxtj
        billing_approved_at:
          type: string
          x-stoplight:
            id: f2bkkw0znb1uy
          format: date-time
          nullable: true
        field_approved_at:
          type: string
          x-stoplight:
            id: 78l5n1sakfgl3
          format: date-time
          nullable: true
      additionalProperties: false
    MaterialRateAssignmentable:
      title: MaterialRateAssignmentable
      x-stoplight:
        id: hb9gpvhsr3aj4
      type: object
      properties:
        material_rate_assignment:
          $ref: '#/components/schemas/MaterialRateAssignment-Read-Nested'
      additionalProperties: false
    GpsStatusable:
      title: GpsStatusable
      x-stoplight:
        id: o6oprcupw6ep7
      type: object
      required:
        - gps_status
      properties:
        gps_status:
          $ref: '#/components/schemas/GpsStatus'
      additionalProperties: false
    Error-Response:
      title: Error-Response
      x-stoplight:
        id: 52cydhphee3qe
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/Error'
      additionalProperties: false
    UnauthenticatedError-Response:
      title: UnauthenticatedError-Response
      x-stoplight:
        id: o477eph7ttbzt
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/UnauthenticatedError'
      additionalProperties: false
    StateError-Response:
      title: StateError-Response
      x-stoplight:
        id: i0wsk2gmnaqup
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/StateError'
      additionalProperties: false
    ModelError-Response:
      title: ModelError-Response
      x-stoplight:
        id: payf9ndh3l6np
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ModelError'
      additionalProperties: false
    OrderUnitOfMeasure:
      title: OrderUnitOfMeasure
      x-stoplight:
        id: kahcgn7w8swdv
      enum:
        - Load
        - Tonne
        - Ton
        - Yard
        - Meter
        - Foot
        - Liter
        - Hour
        - Bushel
        - Gallon
        - CubicMeter
        - Mile
        - Kilometer
        - Barrel
        - Bag
        - Pallet
      example: Load
    WaypointType:
      title: WaypointType
      x-stoplight:
        id: a8567v0zl3pi3
      enum:
        - pickup
        - drop_off
        - weigh_point
      example: pickup
    Contact-Update:
      title: Contact-Update
      x-stoplight:
        id: p2ny8u55sfpcx
      type: object
      properties:
        name:
          type: string
          x-stoplight:
            id: wm2na5bv2uvvv
        email:
          x-stoplight:
            id: mdv25imtbstfh
          type: string
        phone:
          type: string
          x-stoplight:
            id: rtf4rqlgwt35i
          example: '+18885551234'
      additionalProperties: false
    Destroyable:
      title: Destroyable
      x-stoplight:
        id: 2uftzhptd2l14
      type: object
      properties:
        id:
          type: string
          x-stoplight:
            id: gx1ww996hmzqm
          format: uuid
          description: Required if `_destroy` is set
        _destroy:
          type: integer
          x-stoplight:
            id: 0xjwztkz4fmcr
          description: >-
            If this is provided with value of `1` like so `_destroy: 1` then
            this model will be deleted. The `id` must be set.
      additionalProperties: false
    RateType:
      title: RateType
      x-stoplight:
        id: zn2jb7gsifkk3
      enum:
        - RatePerHour
        - RatePerDay
        - RatePerLoad
        - RatePerTon
        - RatePerTonne
        - RatePerYard
        - RatePerBushel
        - RateCommission
        - RateFlatCommission
        - RateFlatRate
      example: RatePerHour
    Identifier:
      title: Identifier
      x-stoplight:
        id: gnd39lue5v7ol
      type: object
      required:
        - id
      properties:
        id:
          type: string
          x-stoplight:
            id: 2e38hjk4zd58m
          format: uuid
      additionalProperties: false
    DispatchNumber-Read-Nested:
      title: DispatchNumber-Read-Nested
      x-stoplight:
        id: 5oe6kw6t82gnr
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - name
          properties:
            name:
              type: string
    Account-Read-Nested:
      title: Account-Read-Nested
      x-stoplight:
        id: zo8r3gsz1tm5h
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - $ref: '#/components/schemas/Discardable'
        - type: object
          x-stoplight:
            id: gl7hua7pv8xka
          required:
            - name
            - account_types
            - external_id
            - accounting_id
            - company
            - schedule_on
          properties:
            name:
              type: string
              x-stoplight:
                id: a7g065w5byfcf
            account_types:
              type: array
              x-stoplight:
                id: a0e9c3lpr1wad
              items:
                $ref: '#/components/schemas/AccountType'
            external_id:
              type: string
              x-stoplight:
                id: yfrec4y0a90cb
              nullable: true
            accounting_id:
              type: string
              x-stoplight:
                id: yfsec5y0a91cb
              nullable: true
            company:
              type: object
              x-stoplight:
                id: 9loqtu14mvlnq
              required:
                - id
              properties:
                id:
                  type: string
                  x-stoplight:
                    id: udjkdjrz08pzr
                  format: uuid
            billing_address:
              $ref: '#/components/schemas/Address-Read-Nested'
            schedule_on:
              type: boolean
              x-stoplight:
                id: 0g9kx77zym4ok
            connected_company:
              $ref: '#/components/schemas/Company-Read-Nested'
            billing_contact:
              $ref: '#/components/schemas/Contact-Read-Nested'
    EquipmentType-Read-Nested:
      title: EquipmentType-Read-Nested
      x-stoplight:
        id: em46i5kysysdh
      type: object
      required:
        - id
        - name
        - system
        - external_id
        - accounting_id
      properties:
        id:
          type: string
          x-stoplight:
            id: 835oy22o6h24z
          format: uuid
        name:
          type: string
          x-stoplight:
            id: tnszefd7lypln
        system:
          type: boolean
          x-stoplight:
            id: vimoqz5e8x6gx
        external_id:
          type: string
          x-stoplight:
            id: ttaijg77qmbgk
          nullable: true
        accounting_id:
          type: string
          x-stoplight:
            id: s4rscgptv68x3
          nullable: true
      additionalProperties: false
    OrderState:
      title: OrderState
      x-stoplight:
        id: vns4k5u34s0dg
      enum:
        - created
        - pending_request
        - accepted
        - rejected
        - in_progress
        - completed
        - canceled
        - hold
        - weather_hold
      example: created
      default: created
    Equipment-Read-Typeahead:
      title: Equipment-Read-Typeahead
      x-stoplight:
        id: sv94osohm5xhg
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - name
            - equipment_type
            - external_id
            - equipment_id
          properties:
            name:
              type: string
              description: Equipment name
            equipment_type:
              $ref: '#/components/schemas/EquipmentType-Read-Nested'
            external_id:
              type: string
              x-stoplight:
                id: jrkz95htilck3
              nullable: true
            company_share:
              $ref: '#/components/schemas/CompanyShare-Read-Nested'
            equipment_id:
              type: string
              x-stoplight:
                id: fkr9fkdtl996f
    Site-Read-Nested:
      title: Site-Read-Nested
      x-stoplight:
        id: rt6xqxsfzf4iv
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - name
            - lat
            - lon
            - full_address
            - routable
          properties:
            name:
              type: string
              x-stoplight:
                id: 7r0x7wicrvwyy
            lat:
              type: string
              x-stoplight:
                id: cr6y5v0hdl5oo
              nullable: true
            lon:
              type: string
              x-stoplight:
                id: f23mkvamncbuw
              nullable: true
            address:
              $ref: '#/components/schemas/Address-Read-Nested'
            full_address:
              type: string
              x-stoplight:
                id: uxixxnmgfi47i
              nullable: true
            routable:
              type: boolean
              x-stoplight:
                id: uobfxkm0hujhv
            next_billion_geofence:
              $ref: '#/components/schemas/NextBillionGeofence-Read'
        - $ref: '#/components/schemas/Discardable'
    TreadId:
      title: TreadId
      x-stoplight:
        id: 43k4t5tl359m4
      type: object
      required:
        - tread_id
      properties:
        tread_id:
          type: string
          x-stoplight:
            id: zi3ld7djflw6f
          pattern: ^[0-9A-F]{6}$
          minLength: 6
          maxLength: 6
          example: ABC123
          description: Tread ID
      additionalProperties: false
    CompanyType:
      title: CompanyType
      x-stoplight:
        id: dkzo7gjbtb1b3
      enum:
        - broker
        - contractor
        - hauler
        - owner_operator
        - producer
        - super
      example: hauler
      description: Company Type
    Driver-Read-Typeahead:
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          x-stoplight:
            id: 5vacab4kzhkj4
          required:
            - first_name
            - last_name
            - schedule_on
            - phone
            - managed
            - company
          properties:
            first_name:
              type: string
              x-stoplight:
                id: 4gb9hhpizab3h
              description: First name
            last_name:
              type: string
              x-stoplight:
                id: my6q150nen1kb
              description: Last name
            company:
              $ref: '#/components/schemas/Company-Read-Nested'
            company_share:
              $ref: '#/components/schemas/CompanyShare-Read-User-Nested'
            equipment:
              $ref: '#/components/schemas/Equipment-Read-Nested'
            default_equipment:
              $ref: '#/components/schemas/Equipment-Read-Nested'
            schedule_on:
              type: boolean
              x-stoplight:
                id: 7dq6dvne8bqcr
            company_day_driver_stat:
              $ref: '#/components/schemas/CompanyDayDriverStat-Read'
            phone:
              type: string
              x-stoplight:
                id: y4l44re1zfaa9
              description: User's E.164 formatted phone number
              nullable: true
            managed:
              type: boolean
              x-stoplight:
                id: k8m3xq0sz6wt4
            labels:
              type: array
              items:
                $ref: '#/components/schemas/Label-Read-Nested'
              description: Labels assigned to this driver
        - $ref: '#/components/schemas/GpsStatusable'
      title: Driver-Read-Typeahead
    Project-Read-Typeahead:
      title: Project-Read-Typeahead
      x-stoplight:
        id: 3wdg6ghyvsknb
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - name
            - external_id
          properties:
            name:
              type: string
              description: Project name
            external_id:
              type: string
              x-stoplight:
                id: 7kipqxvhrgvk0
              nullable: true
    Foreman-Read-Typeahead:
      title: Foreman-Read-Typeahead
      x-stoplight:
        id: kdwiblw3n3qtm
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          x-stoplight:
            id: mhsvzlxjbapan
          required:
            - first_name
            - last_name
            - phone
          properties:
            first_name:
              type: string
              x-stoplight:
                id: 8fst58e2tam8v
              description: First name
            last_name:
              type: string
              x-stoplight:
                id: av8z4dxam69hi
              description: Last name
            company_share:
              $ref: '#/components/schemas/CompanyShare-Read-Nested'
            phone:
              type: string
              x-stoplight:
                id: 7b5vdi0y2qt5m
              description: User's E.164 formatted phone number
              nullable: true
    Discardable:
      title: Discardable
      x-stoplight:
        id: 46axlb8u5wjay
      type: object
      required:
        - discarded_at
      properties:
        discarded_at:
          type: string
          x-stoplight:
            id: cy8t6fecoyxbo
          format: date-time
          nullable: true
      additionalProperties: false
    User-Read-Typeahead:
      title: User-Read-Typeahead
      x-stoplight:
        id: ttbbss5b5k66f
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - first_name
            - last_name
          properties:
            first_name:
              type: string
              description: First name
              x-stoplight:
                id: gwo999rcdahmg
            last_name:
              type: string
              description: Last name
              x-stoplight:
                id: l9omnnsq644bh
      description: ''
    DeliveredQuantity-Read:
      title: DeliveredQuantity-Read
      x-stoplight:
        id: trwwil0vsjrtn
      type: object
      required:
        - delivered
        - unit_of_measure
        - material_name
        - total
        - ticketed
      properties:
        delivered:
          type: string
          x-stoplight:
            id: xqo11su8z94my
        unit_of_measure:
          $ref: '#/components/schemas/NullableOrderUnitOfMeasure'
        material_name:
          type: string
          x-stoplight:
            id: h7jmwwi6jx02h
          nullable: true
        total:
          type: string
          x-stoplight:
            id: 8ghxe07yz102y
        ticketed:
          type: boolean
          nullable: true
          x-stoplight:
            id: hxg8e07yz102y
      additionalProperties: false
    MaterialRateAssignment-Read-Nested:
      title: MaterialRateAssignment-Read-Nested
      x-stoplight:
        id: iddmbrcip2me5
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - sell_price
            - buy_price
            - unit_of_measure
          properties:
            sell_price:
              type: string
              x-stoplight:
                id: i2ac5k345i0bx
              nullable: true
            buy_price:
              type: string
              x-stoplight:
                id: 66qhs855s4pne
              nullable: true
            unit_of_measure:
              $ref: '#/components/schemas/NullableOrderUnitOfMeasure'
            site:
              $ref: '#/components/schemas/Site-Read-Nested'
    GpsStatus:
      title: GpsStatus
      x-stoplight:
        id: 3b02180lfd6ve
      description: GPS Ping status for a record
      type: object
      required:
        - status
        - last_ping_at
      properties:
        status:
          x-stoplight:
            id: 7f6aqydupq3ac
          enum:
            - online
            - offline
            - idle
            - no_signal
        last_ping_at:
          type: string
          x-stoplight:
            id: 1ikh7blmxdqcz
          format: date-time
          nullable: true
      additionalProperties: false
    Error:
      title: Error
      x-stoplight:
        id: 3g57kkik3l464
      type: object
      description: An Error.
      required:
        - code
      properties:
        code:
          type: string
          x-stoplight:
            id: 7o9x1t8v0bgfo
      additionalProperties: false
    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
    StateError:
      title: StateError
      x-stoplight:
        id: zgcsl4t8bsn3c
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          x-stoplight:
            id: ntvt2atfotcge
          required:
            - errors
          properties:
            errors:
              type: array
              x-stoplight:
                id: noi1jg6o8psl7
              items:
                $ref: '#/components/schemas/StateError-Item'
    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'
    AccountType:
      title: AccountType
      x-stoplight:
        id: i4vfmd4rwrq8p
      enum:
        - customer
        - vendor
      example: customer
    Address-Read-Nested:
      title: Address-Read-Nested
      x-stoplight:
        id: cvym2dzuo375q
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - $ref: '#/components/schemas/Address-Read'
    CompanyShare-Read-Nested:
      title: CompanyShare-Read-Nested
      x-stoplight:
        id: makajouqsb7jq
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          x-stoplight:
            id: s6h0nfzt2fjry
          required:
            - external_id
            - ticket_match_id
            - sender_company
            - dispatchable
            - schedule_on
            - rate_override
            - expires_at
          properties:
            external_id:
              type: string
              x-stoplight:
                id: c9ls3nrhbih3v
              nullable: true
            ticket_match_id:
              type: string
              x-stoplight:
                id: a1cd3nrhbih3v
              nullable: true
            sender_company:
              $ref: '#/components/schemas/Company-Read-Nested'
            dispatchable:
              type: boolean
              x-stoplight:
                id: kd884ihz6qi6w
            schedule_on:
              type: boolean
              x-stoplight:
                id: kd884ihz61234
            rate_override:
              type: boolean
              x-stoplight:
                id: mq4osazzielxo
            expires_at:
              type: string
              x-stoplight:
                id: aaa111jpq0ga9
              format: date-time
              description: ISO8601 timestamp with local timezone
              nullable: true
    NextBillionGeofence-Read:
      title: NextBillionGeofence-Read
      x-stoplight:
        id: 60y0z4bb3pu6m
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - $ref: '#/components/schemas/Geofence-Data'
    CompanyShare-Read-User-Nested:
      title: CompanyShare-Read-User-Nested
      x-stoplight:
        id: 8czythac5qhgz
      allOf:
        - $ref: '#/components/schemas/CompanyShare-Read-Nested'
        - type: object
          properties:
            default_equipment:
              $ref: '#/components/schemas/Equipment-Read-Default-Nested'
    CompanyDayDriverStat-Read:
      title: CompanyDayDriverStat-Read
      x-stoplight:
        id: 3grxlvq5qo470
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - $ref: '#/components/schemas/Timestamps'
        - type: object
          x-stoplight:
            id: e0k1y5lyccj7x
          properties:
            day:
              type: string
              x-stoplight:
                id: tq2kbgspesbyq
              format: date
            jobs_count:
              type: integer
              x-stoplight:
                id: lq3o1iorx79vx
      description: CompanyDayDriverStat
    Label-Read-Nested:
      title: Label-Read-Nested
      x-stoplight:
        id: lbl1readnest01
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          properties:
            name:
              type: string
              x-stoplight:
                id: lbl1nestnm0001
              description: Label name
            color:
              type: string
              x-stoplight:
                id: lbl1nestcol001
              description: Hex color code for the label
              pattern: ^#[0-9A-Fa-f]{6}$
          required:
            - name
            - color
    StateError-Item:
      title: StateError-Item
      x-stoplight:
        id: dgw2jdmi7ozjj
      allOf:
        - $ref: '#/components/schemas/ModelError-Item'
        - type: object
          x-stoplight:
            id: jrgi7oapao3e5
          required:
            - state
            - event
          properties:
            state:
              type: string
              x-stoplight:
                id: mah8jye43io32
              description: The current state value of the field on this Model
            event:
              type: string
              x-stoplight:
                id: dtgu62ni9ofuh
              description: The failed state event called on the Model
    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
    Address-Read:
      title: Address-Read
      x-stoplight:
        id: v1mcd2qgns2tf
      type: object
      required:
        - thoroughfare
        - premise
        - locality
        - administrative_area
        - postal_code
        - country
        - lat
        - lon
        - place_id
      properties:
        thoroughfare:
          type: string
          x-stoplight:
            id: 8wrr7qkc9ilqn
        premise:
          type: string
          x-stoplight:
            id: z4jth408out1q
          nullable: true
        locality:
          type: string
          x-stoplight:
            id: kfby6wqpgvxbz
        administrative_area:
          type: string
          x-stoplight:
            id: c9bkrloxf4t8d
        postal_code:
          type: string
          x-stoplight:
            id: 7zq51k1mof3o3
        country:
          type: string
          x-stoplight:
            id: iydw9q619ya01
          pattern: ^[A-Z]{2}
          example: US
          minLength: 2
          maxLength: 2
        lat:
          type: string
          x-stoplight:
            id: kqu1qtf9rivh1
          description: |-
            latitude of the `Address`. 

            Must be a stringified number between -90 and 90 inclusive.

            Required if `lon` is present.
          nullable: true
        lon:
          type: string
          x-stoplight:
            id: oly2yabkzpk9g
          description: |-
            longitude of the `Address`. 

            Must be a stringified number between -180 and 180 inclusive.

            Required if `lat` is present.
          nullable: true
        place_id:
          type: string
          x-stoplight:
            id: im1fdq7qqxdij
          description: NextBillion placeID
          nullable: true
      additionalProperties: false
    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
    Equipment-Read-Default-Nested:
      title: Equipment-Read-Default-Nested
      x-stoplight:
        id: kojte9y4g6t9v
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - name
            - external_id
            - equipment_type
            - equipment_id
          properties:
            name:
              type: string
              description: Equipment name
            external_id:
              type: string
              nullable: true
            equipment_type:
              $ref: '#/components/schemas/EquipmentType-Read-Nested'
            company_share:
              $ref: '#/components/schemas/CompanyShare-Read-Nested'
            equipment_id:
              type: string
              x-stoplight:
                id: v25n5jka8apv0
    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
    GeofenceType:
      title: GeofenceType
      x-stoplight:
        id: geahowr9r8ly1
      nullable: true
      enum:
        - moving
        - circle
        - polygon
      readOnly: true
  responses:
    Error:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error-Response'
            type: object
    UnauthenticatedError:
      description: Example response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthenticatedError-Response'
            type: object
    StateError:
      description: Example response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StateError-Response'
            type: object
    ModelError:
      description: ''
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ModelError-Response'
            type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````