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

# Create Work Order

> Creates a new work order with associated tasks, compensation details, and notes.



## OpenAPI

````yaml POST /work-orders/create/
openapi: 3.0.1
info:
  title: OpenAPI Datatruck
  description: >-
    To be able to use Datatruck OpenAPI you should create tokens from your
    dashboard. Go to your dashboard and create token with appropriate scopes and
    expiration. Expiration and scopes are optional as well as description for
    your token, but remember name is required.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://{company}.datatruck.io/api/v1/openapi/
security: []
paths:
  /work-orders/create/:
    post:
      summary: Create Work Order
      description: >-
        Creates a new work order with associated tasks, compensation details,
        and notes.
      operationId: createWorkOrder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkOrderRequest'
            example:
              reference_number: REF-12345
              status: Pending
              type_work_order: Repair
              payment_type: Credit Card
              truck: Truck-45
              trailer: Trailer-22
              fee_total_price: '50.00'
              tax_total_price: '25.00'
              total_price: '500.00'
              invoice_id: INV-98765
              scheduled_on_date: '2025-03-10T08:00:00Z'
              assigned_to: John Doe
              odometer: 120000
              location: Los Angeles, CA
              vendor: ABC Auto Repair
              vendor_phone: +1-555-1234
              vendor_email: vendor@example.com
              procedure_name: TRK Accident Damage / Repair
              notes:
                - body: Replace front brake pads
              work_order_tasks:
                - custom_task: Brake replacement
                  parts_price: '200.00'
                  parts_quantity: 2
                  total_parts_price: '400.00'
                  labor_price: '100.00'
                  labor_hours: 2
                  total_labor_price: '200.00'
                  total_price: '600.00'
              compensation:
                - driver: Driver Name
                  customer: Customer Name
              tags:
                - name: Urgent
      responses:
        '201':
          description: Work order created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkOrderResponse'
        '400':
          description: Invalid request data
components:
  schemas:
    WorkOrderRequest:
      type: object
      required:
        - status
        - type_work_order
        - payment_type
        - invoice_id
        - assigned_to
        - odometer
        - vendor
      properties:
        reference_number:
          type: string
          nullable: true
          example: REF-12345
          description: Reference number for the work order
        status:
          type: string
          example: Pending
          description: Current status of the work order
        type_work_order:
          type: string
          example: Repair
          description: Type of work order
        payment_type:
          type: string
          example: Credit Card
          description: Payment method used
        truck:
          type: string
          nullable: true
          example: Truck-45
        trailer:
          type: string
          nullable: true
          example: Trailer-22
        fee_total_price:
          type: string
          format: decimal
          example: '50.00'
          description: Total fees for the work order
        tax_total_price:
          type: string
          format: decimal
          example: '25.00'
          description: Total tax for the work order
        total_price:
          type: string
          format: decimal
          example: '500.00'
          description: Total price of the work order
        invoice_id:
          type: string
          example: INV-98765
          description: Associated invoice ID
        scheduled_on_date:
          type: string
          format: date-time
          example: '2025-03-10T08:00:00Z'
          description: Scheduled date and time for the work order
        assigned_to:
          type: string
          example: John Doe
          description: Person assigned to the work order
        odometer:
          type: integer
          example: 120000
          description: Vehicle odometer reading
        location:
          type: string
          nullable: true
          example: Los Angeles, CA
          description: Location where the work order is being performed
        vendor:
          type: string
          example: ABC Auto Repair
          description: Vendor responsible for the work order
        vendor_phone:
          type: string
          nullable: true
          example: +1-555-1234
          description: Vendor phone number
        vendor_email:
          type: string
          nullable: true
          example: vendor@example.com
          description: Vendor email address
        procedure_name:
          type: string
          nullable: true
          example: TRK Accident Damage / Repair
          description: >-
            Procedure name list: {"name": "TRK Accident Damage / Repair"},
            {"name": "TRK Complex Repair"}, {"name": "TRK Air System Leakage"},
            {"name": "TRK Brake Issue"}, {"name": "TRK ABS failure"}, {"name":
            "TRK Body Damage"}, {"name": "TRK 5th Wheel Repair"}, {"name": "TRK
            Alignment/Balancing"}, {"name": "TRK Tire Repair / Replacement"},
            {"name": "TRK TIre Rim Repair / Replacement"}, {"name": "TRK Tire
            Hub Repair / Replacement/Oil refill"}, {"name": "TRK Check Engine
            Light"}, {"name": "TRK Stop Engine Light"}, {"name": "TRK Starter
            failure"}, {"name": "TRK Oil Leakage"}, {"name": "TRK Coolant
            Leakage"}, {"name": "TRK Fuel Leakage"}, {"name": "TRK Electrical
            Issues"}, {"name": "TRK Lights repair"}, {"name": "TRK Def system
            issue"}, {"name": "TRK Exhaust system issue"}, {"name": "TRK
            Suspension issue"}, {"name": "TRK Windshield"}, {"name": "TRK Side
            Windows repair/replacement"}, {"name": "TRK Wiper blades
            replacement"}, {"name": "TRK Inner appliances Issues"}, {"name":
            "TRK Inverter failure"}, {"name": "TRK Air conditioner service"},
            {"name": "TRK Wash"}, {"name": "TRK TOW"}, {"name": "TRK Other
            Repair"}, {"name": "TRL Accident Damage / Repair"}, {"name": "TRL
            Complex Repair"}, {"name": "TRL Air System Leakage"}, {"name": "TRL
            Brake Issue"}, {"name": "TRL ABS failure"}, {"name": "TRL Body
            Damage"}, {"name": "TRL 5th Wheel Repair"}, {"name": "TRL
            Alignment/Balancing"}, {"name": "TRL Tire Repair / Replacement"},
            {"name": "TRL TIre Rim Repair / Replacement"}, {"name": "TRL Tire
            Hub Repair / Replacement/Oil refill"}, {"name": "TRL Check Engine
            Light"}, {"name": "TRL Stop Engine Light"}, {"name": "TRL Starter
            failure"}, {"name": "TRL Oil Leakage"}, {"name": "TRL Coolant
            Leakage"}, {"name": "TRL Fuel Leakage"}, {"name": "TRL Electrical
            Issues"}, {"name": "TRL Lights repair"}, {"name": "TRL Def system
            issue"}, {"name": "TRL Exhaust system issue"}, {"name": "TRL
            Suspension issue"}, {"name": "TRL Windshield"}, {"name": "TRL Side
            Windows repair/replacement"}, {"name": "TRL Wiper blades
            replacement"}, {"name": "TRL Inner appliances Issues"}, {"name":
            "TRL Inverter failure"}, {"name": "TRL Air conditioner service"},
            {"name": "TRL Wash"}, {"name": "TRL TOW"}, {"name": "TRL Other
            Repair"}
        notes:
          type: array
          items:
            type: object
            properties:
              body:
                type: string
                description: Note content
          description: Additional notes related to the work order
        work_order_tasks:
          type: array
          items:
            $ref: '#/components/schemas/WorkOrderTask'
          description: List of tasks related to the work order
        compensation:
          type: array
          items:
            $ref: '#/components/schemas/WorkOrderCompensation'
          description: Compensation details for the work order
        tags:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                description: Tag name
          description: Tags associated with the work order
    WorkOrderResponse:
      type: object
      properties:
        id:
          type: integer
          example: 12345
          description: Unique work order ID
    WorkOrderTask:
      type: object
      properties:
        id:
          type: integer
          example: 1
        number:
          type: string
          nullable: true
          example: TASK-1001
        custom_task:
          type: string
          nullable: true
          example: Brake replacement
        parts_price:
          type: string
          format: decimal
          example: '200.00'
        parts_quantity:
          type: integer
          example: 2
        total_parts_price:
          type: string
          format: decimal
          example: '400.00'
        labor_price:
          type: string
          format: decimal
          example: '100.00'
        labor_hours:
          type: integer
          example: 2
        total_labor_price:
          type: string
          format: decimal
          example: '200.00'
        total_price:
          type: string
          format: decimal
          example: '600.00'
    WorkOrderCompensation:
      type: object
      properties:
        driver:
          type: string
          nullable: true
          example: Driver Name
        customer:
          type: string
          nullable: true
          example: Customer Name

````