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

# Create or update a work item event

> Creates or updates a source-system event associated with a work item.



## OpenAPI

````yaml rulebase_api2_public_openapi.json POST /v1/work_items/{id}/events
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}/events:
    post:
      tags:
        - Work items
      summary: Create or update a work item event
      description: >-
        Create or update an event associated with a work item. Events are
        upserted by external ID.
      operationId: upsertWorkItemEvent
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                event:
                  type: object
                  properties:
                    external_id:
                      type: string
                      minLength: 1
                    actor_email:
                      type: string
                      format: email
                    actor_name:
                      type: string
                      minLength: 1
                    actor_external_id:
                      type: string
                      minLength: 1
                    content:
                      type: string
                      nullable: true
                    occurred_at:
                      type: string
                      nullable: true
                      format: date-time
                  required:
                    - external_id
              required:
                - event
      responses:
        '201':
          description: Work item event created or updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    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
                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 event
          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

````