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

# Update Work Order

> Update a work order's details and configuration. Work order must be in the `DRAFT` state



## OpenAPI

````yaml PATCH /work-order/{id}
openapi: 3.1.0
info:
  title: Serial
  version: '1.0'
  description: Access and control your Serial data programmatically.
  contact:
    name: Devon Copeland
    email: support@serial.io
    url: www.serial.io
  summary: Serial API
servers:
  - url: https://api.serial.io
security:
  - serial-default-security: []
tags:
  - name: AI
    description: AI Endpoints
  - name: Auth
    description: Auth Endpoints
  - name: Companies
    description: Company Endpoints
  - name: Component Instances
    description: Component Instance Endpoints
  - name: Components
    description: Component Endpoints
  - name: Datasets
    description: Dataset Endpoints
  - name: Fields
    description: Field Endpoints
  - name: Legacy
    description: Legacy Endpoints
  - name: Part Numbers
    description: Part Number Endpoints
  - name: Processes
    description: Process Endpoints
  - name: Properties
    description: Property Endpoints
  - name: Storage
    description: Storage Endpoints
  - name: Users
    description: User Endpoints
  - name: Work Orders
    description: Work Order Endpoints
paths:
  /work-order/{id}:
    parameters:
      - $ref: '#/components/parameters/work-order-id'
    patch:
      tags:
        - Work Orders
      summary: Update Work Order
      description: >-
        Update a work order's details and configuration. Work order must be in
        the `DRAFT` state
      operationId: patch-work-order-id
      parameters: []
      requestBody:
        $ref: '#/components/requestBodies/work-order'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Work-order'
components:
  parameters:
    work-order-id:
      name: id
      in: path
      required: true
      schema:
        type: string
      description: >-
        The work order UUID (`work_order.id`) or work order number
        (`work_order.wo_number`). Both will map to the same work order
  requestBodies:
    work-order:
      content:
        application/json:
          schema:
            type: object
            x-examples:
              Example 1:
                name: Work Order 1
                description: This is a test work order
                component_id: 550e8400-e29b-41d4-a716-446655440002
                part_number_id: null
                phase: Phase 1
                quantity: 10
                approvals:
                  - approver_id: 550e8400-e29b-41d4-a716-446655440004
                assignee_user_id: 550e8400-e29b-41d4-a716-446655440006
                deadline: '2023-07-27T10:15:00.000Z'
            properties:
              name:
                type: string
              component_id:
                type: string
                format: uuid
              quantity:
                type: integer
                minimum: 1
              updated_by_user_id:
                type: string
                x-stoplight:
                  id: jc83efvycr50r
                format: uuid
              description:
                type: string
              part_number_id:
                type: string
                format: uuid
              phase:
                type: string
              assignee_user_id:
                type: string
                format: uuid
              deadline:
                type: string
                format: date-time
            required:
              - name
              - component_id
              - quantity
              - updated_by_user_id
          examples:
            Example 1:
              value:
                name: KS1 Drone - CalFire Order
                description: Urgent order for upcoming summer fire season
                component_id: 41afafe5-2a48-424a-baef-34c2ad44ef7b
                part_number_id: 7dec118a-512b-42ec-bf53-7cec3d14d5c7
                phase: string
                quantity: 10
                assignee_user_id: e942d24d-8cee-4fa2-bf68-164509e32e2f
                deadline: '2019-08-24T14:15:22Z'
                updated_by_user_id: 1b287364-14ff-4b72-8953-b40399093a6f
      description: Request body for creating or updating a work order
  schemas:
    Work-order:
      type: object
      x-examples:
        Example 1:
          id: 550e8400-e29b-41d4-a716-446655440000
          company_id: 550e8400-e29b-41d4-a716-446655440001
          wo_number: 12345
          name: Work Order 1
          description: This is a test work order
          component_id: 550e8400-e29b-41d4-a716-446655440002
          part_number_id: null
          created_at: '2023-06-27T10:15:00.000Z'
          created_by_user_id: 550e8400-e29b-41d4-a716-446655440003
          status: APPROVED
          phase: Phase 1
          quantity: 10
          approvals:
            - approver_id: 550e8400-e29b-41d4-a716-446655440004
              requested_by: 550e8400-e29b-41d4-a716-446655440005
              requested_at: '2023-06-26T08:00:00.000Z'
              status: null
              last_updated_at: null
          assignee_user_id: 550e8400-e29b-41d4-a716-446655440006
          deadline: '2023-07-27T10:15:00.000Z'
          activity_log:
            - id: 550e8400-e29b-41d4-a716-446655440007
              message: Work order created
              created_at: '2023-06-27T10:15:00.000Z'
              created_by: 550e8400-e29b-41d4-a716-446655440008
              type: CREATION
          last_edited_at: '2023-06-27T10:20:00.000Z'
      description: Work Order Data
      properties:
        id:
          type: string
        wo_number:
          type: integer
          minimum: 0
        name:
          type: string
        description:
          type:
            - string
            - 'null'
        component_id:
          type: string
        part_number_id:
          type:
            - string
            - 'null'
          format: uuid
        created_at:
          type: string
          format: date-time
        created_by_user_id:
          type: string
          format: uuid
        status:
          enum:
            - DRAFT
            - REVIEW
            - PRODUCTION
            - COMPLETE
            - CANCELED
            - ARCHIVED
          default: DRAFT
        phase:
          type: string
        quantity:
          type: integer
        approvals:
          type: object
          description: Approvals object will have one key value pair for every approver
          properties:
            '[approver_user_id]':
              type: object
              x-stoplight:
                id: 2de15jln9d5rj
              properties:
                approver_user_id:
                  type: string
                  format: uuid
                  x-stoplight:
                    id: 1lkn81sb5itfg
                requested_by_user_id:
                  type: string
                  format: uuid
                  x-stoplight:
                    id: 2u2e3mz9tj0vn
                requested_at:
                  type: string
                  format: date-time
                status:
                  enum:
                    - APPROVED
                    - REJECTED
                    - null
                last_updated_at:
                  type:
                    - string
                    - 'null'
                  format: date-time
        assignee_user_id:
          type:
            - string
            - 'null'
          format: uuid
        deadline:
          type:
            - string
            - 'null'
          format: date-time
        activity_log:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
              message:
                type:
                  - string
                  - 'null'
              added_at:
                type: string
                format: date-time
                x-stoplight:
                  id: namn2karaaux7
              added_by_user_id:
                type: string
                format: uuid
                x-stoplight:
                  id: 50mo1pr3t2i5r
              type:
                enum:
                  - CREATED
                  - COMMENTED
                  - SET_STATUS
                  - GENERAL_UPDATE
                  - SET_APPROVAL
                  - UPDATED_APPROVERS
                  - REMOVED_APPROVAL
              data:
                type: string
                x-stoplight:
                  id: 13txktq4uwfrl
                description: Data object dependant on the activity type
        last_edited_at:
          type:
            - string
            - 'null'
          format: date-time
        attachments:
          type: array
          x-stoplight:
            id: 8rlgsuy75vqly
          description: Multiple datasets can be added to the attachments object
          items:
            x-stoplight:
              id: zx4wqr1jrbnmc
            type: object
            properties:
              dataset_id:
                type: string
                x-stoplight:
                  id: 1j8c082mffovz
                format: uuid
              value:
                type: string
                x-stoplight:
                  id: tlav6dj9prhzu
                description: >-
                  Value is the file id if the data type is file or image.
                  Otherwise it is the attachment text value
              file_name:
                type:
                  - string
                  - 'null'
                x-stoplight:
                  id: s33ev6fa0xciv
                format: uuid
              added_at:
                type: string
                x-stoplight:
                  id: igyrvi94hruib
                format: date-time
              added_by_user_id:
                type: string
                x-stoplight:
                  id: da6jads6oqvh3
              is_deleted:
                type: boolean
                x-stoplight:
                  id: dhrjruagqnjte
  securitySchemes:
    serial-default-security:
      type: http
      scheme: bearer
      description: '**API Key** or **Token** formatted as `Bearer <YOUR_KEY_OR_TOKEN>`'

````