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

# Update a work item

> Updates a work item. Omitted fields keep their stored values and custom attributes are merged.



## OpenAPI

````yaml rulebase_api2_public_openapi.json PATCH /v1/work_items/{id}
openapi: 3.1.0
info:
  title: Rulebase API v2
  version: 2.0.0
  description: Read data from Rulebase using an organization API key.
servers:
  - url: https://api2.rulebase.co
    description: US
  - url: https://eu.api2.rulebase.co
    description: EU
security: []
paths:
  /v1/work_items/{id}:
    patch:
      tags:
        - Work items
      summary: Update a work item
      description: >-
        Update a work item. Omitted fields keep their stored values,
        `custom_attributes` are merged, and `external_id` is immutable.
      operationId: updateWorkItem
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                work_item:
                  type: object
                  properties:
                    agent_email:
                      type: string
                      format: email
                    agent_name:
                      type: string
                      minLength: 1
                    agent_external_id:
                      type: string
                      minLength: 1
                    type:
                      type: string
                      minLength: 1
                    status:
                      type: string
                      enum:
                        - pending
                        - in_progress
                        - completed
                        - cancelled
                    completed_at:
                      type: string
                      nullable: true
                      format: date-time
                    custom_attributes:
                      type: object
                      additionalProperties:
                        nullable: true
                  additionalProperties: false
              required:
                - work_item
      responses:
        '200':
          description: Work item updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      external_id:
                        type: string
                      agent:
                        type: object
                        properties:
                          id:
                            type: string
                            nullable: true
                          name:
                            type: string
                            nullable: true
                          email:
                            type: string
                            nullable: true
                          external_id:
                            type: string
                            nullable: true
                          avatar_url:
                            type: string
                            nullable: true
                        required:
                          - id
                          - name
                          - email
                          - external_id
                          - avatar_url
                      agents:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              nullable: true
                            name:
                              type: string
                              nullable: true
                            email:
                              type: string
                              nullable: true
                            external_id:
                              type: string
                              nullable: true
                            avatar_url:
                              type: string
                              nullable: true
                          required:
                            - id
                            - name
                            - email
                            - external_id
                            - avatar_url
                      type:
                        type: string
                      status:
                        type: string
                        enum:
                          - pending
                          - in_progress
                          - completed
                          - cancelled
                      short_description:
                        type: string
                        nullable: true
                      description:
                        type: string
                        nullable: true
                      completed_at:
                        type: string
                        nullable: true
                        format: date-time
                      custom_attributes:
                        type: object
                        additionalProperties:
                          nullable: true
                      events:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              format: uuid
                            external_id:
                              type: string
                            actor:
                              type: object
                              nullable: true
                              properties:
                                id:
                                  type: string
                                  nullable: true
                                name:
                                  type: string
                                  nullable: true
                                email:
                                  type: string
                                  nullable: true
                                external_id:
                                  type: string
                                  nullable: true
                                avatar_url:
                                  type: string
                                  nullable: true
                              required:
                                - id
                                - name
                                - email
                                - external_id
                                - avatar_url
                            content:
                              type: string
                              nullable: true
                            occurred_at:
                              type: string
                              nullable: true
                              format: date-time
                            deleted_at:
                              type: string
                              nullable: true
                              format: date-time
                            created_at:
                              type: string
                              format: date-time
                          required:
                            - id
                            - external_id
                            - actor
                            - content
                            - occurred_at
                            - deleted_at
                            - created_at
                      created_at:
                        type: string
                        format: date-time
                      updated_at:
                        type: string
                        format: date-time
                      qa_score:
                        type: number
                        nullable: true
                        minimum: 0
                        maximum: 1
                    required:
                      - id
                      - external_id
                      - agent
                      - agents
                      - type
                      - status
                      - short_description
                      - description
                      - completed_at
                      - custom_attributes
                      - events
                      - created_at
                      - updated_at
                      - qa_score
                required:
                  - data
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '404':
          description: Work item not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '422':
          description: Invalid work item
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '429':
          description: >-
            Rate limit exceeded. Retry after the number of seconds in the
            Retry-After header.
          headers:
            Retry-After:
              schema:
                type: string
              description: Seconds to wait before retrying
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Rulebase organization API key

````