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

# Update ITSM Ticket by ID

> Update an ITSM ticket.

This endpoint follows a vendor-first pattern:
1. Updates the ticket in the vendor system (e.g., JIRA)
2. If vendor update succeeds, updates the local database
3. Returns the updated ticket

Updatable fields:
- status: Ticket status (normalized to Leen values)
- priority: Ticket priority (normalized to Leen values)
- assigned_user_id: UUID of the assigned user
- name: Ticket title/summary
- description: Ticket description

Note: All fields are optional. Only provided fields will be updated.



## OpenAPI

````yaml patch /itsm/tickets/{ticket_id}
openapi: 3.1.0
info:
  title: Leen Security API
  version: 0.0.1
servers:
  - description: Production API (US)
    url: https://api.leen.dev/v1
  - description: Production API (EU)
    url: https://api.eu-c1.leen.dev/v1
  - description: Production API (APAC)
    url: https://api.ap-se2.leen.dev/v1
security: []
paths:
  /itsm/tickets/{ticket_id}:
    patch:
      tags:
        - ITSM
        - Tickets
      summary: Update ITSM Ticket by ID
      description: |-
        Update an ITSM ticket.

        This endpoint follows a vendor-first pattern:
        1. Updates the ticket in the vendor system (e.g., JIRA)
        2. If vendor update succeeds, updates the local database
        3. Returns the updated ticket

        Updatable fields:
        - status: Ticket status (normalized to Leen values)
        - priority: Ticket priority (normalized to Leen values)
        - assigned_user_id: UUID of the assigned user
        - name: Ticket title/summary
        - description: Ticket description

        Note: All fields are optional. Only provided fields will be updated.
      operationId: update_ticket_by_id
      parameters:
        - in: path
          name: ticket_id
          required: true
          schema:
            format: uuid
            title: Ticket Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ITSMTicketUpdateRequestModel'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScopedITSMTicketRespModel'
          description: Successful Response
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Content
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '501':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Implemented
      security:
        - API-Key: []
          Connection-ID: []
components:
  schemas:
    ITSMTicketUpdateRequestModel:
      properties:
        assigned_user_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: User ID assigned to the Ticket
          title: Assigned User Id
        comments:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Public-facing comments visible to end users. ServiceNow: maps to
            'comments'. Ignored for Jira.
          title: Comments
        description:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
            - type: 'null'
          description: >-
            Description of the Ticket. Accepts plain text or an Atlassian
            Document Format (ADF) document — an object, or that object
            serialized to a string — for rich text such as headings, bold and
            code blocks. ADF is passed to Jira unchanged; plain text is wrapped
            for you. Vendors that store plain text (e.g. ServiceNow) receive the
            flattened text.
          title: Description
        name:
          anyOf:
            - type: string
            - type: 'null'
          description: Name/Title of the Ticket
          title: Name
        priority:
          anyOf:
            - type: string
            - type: 'null'
          description: Priority of the Ticket
          title: Priority
        resolution_notes:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Detailed explanation of resolution. ServiceNow: maps to
            'close_notes'. Ignored for Jira.
          title: Resolution Notes
        resolution_reason:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Category/reason for resolution. ServiceNow: maps to 'close_code'.
            Ignored for Jira.
          title: Resolution Reason
        status:
          anyOf:
            - type: string
            - type: 'null'
          description: Status of the Ticket
          title: Status
        status_change_reason:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Reason for a status change (e.g. reason for putting on hold).
            ServiceNow: maps to 'hold_reason'. Ignored for Jira.
          title: Status Change Reason
        work_notes:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Internal work notes visible only to agents. ServiceNow: maps to
            'work_notes'. Ignored for Jira.
          title: Work Notes
      title: ITSM Ticket Update Request
      type: object
    ScopedITSMTicketRespModel:
      properties:
        active:
          anyOf:
            - type: boolean
            - type: 'null'
          description: Whether the Ticket is active
          title: Active
        assigned_user_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: User ID assigned to the Ticket
          title: Assigned User Id
        closed_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: Closing time of the Ticket
          title: Closed At
        created_by_user_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: User ID who created the Ticket
          title: Created By User Id
        description:
          anyOf:
            - type: string
            - type: 'null'
          description: Description of the Ticket
          title: Description
        due_date:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: Due date of the Ticket
          title: Due Date
        id:
          description: Leen's UUID for the Ticket
          format: uuid
          title: Id
          type: string
        identifier:
          anyOf:
            - type: string
            - type: 'null'
          description: User-provided tracking identifier for the Ticket
          title: Identifier
        name:
          description: Name of the Ticket
          title: Name
          type: string
        parent_ticket_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: Parent Ticket ID (for sub-tasks)
          title: Parent Ticket Id
        priority:
          anyOf:
            - type: string
            - type: 'null'
          description: Priority of the Ticket
          title: Priority
        project_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: Project ID the Ticket belongs to
          title: Project Id
        status:
          description: Status of the Ticket
          title: Status
          type: string
        status_updated_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: Last status update time
          title: Status Updated At
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Tags associated with the Ticket
          title: Tags
        ticket_created_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: Creation time of the Ticket in the vendor system
          title: Ticket Created At
        type:
          anyOf:
            - type: string
            - type: 'null'
          description: Type of the Ticket (e.g., Epic, Story, Task, Bug)
          title: Type
        type_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Vendor-specific type ID (e.g., Jira issue type ID)
          title: Type Id
        url:
          anyOf:
            - type: string
            - type: 'null'
          description: URL of the Ticket
          title: Url
        vendor_attributes:
          $ref: '#/components/schemas/ITSMTicketVendorAttributes'
          description: Vendor-specific attributes of the Ticket
      required:
        - id
        - name
        - status
        - vendor_attributes
      title: ITSM Ticket
      type: object
    ErrorResponse:
      properties:
        code:
          description: Error code
          title: Code
          type: string
        detail:
          description: List of error dictionaries
          items:
            additionalProperties: true
            type: object
          title: Detail
          type: array
        message:
          description: Error message
          title: Message
          type: string
        type:
          description: Type of error
          title: Type
          type: string
      required:
        - type
        - code
        - message
        - detail
      title: ErrorResponse
      type: object
    ITSMTicketVendorAttributes:
      properties:
        created_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: Creation time of the Ticket in Vendor
          title: Created At
        data:
          anyOf:
            - discriminator:
                mapping:
                  JIRA: '#/components/schemas/JiraTicketVendorAttributesData'
                  SERVICENOW_ITSM: '#/components/schemas/ServiceNowTicketVendorAttributesData'
                propertyName: vendor
              oneOf:
                - $ref: '#/components/schemas/JiraTicketVendorAttributesData'
                - $ref: '#/components/schemas/ServiceNowTicketVendorAttributesData'
            - type: 'null'
          description: Vendor-specific data associated with the Ticket
          title: Data
        id:
          description: Vendor's ID for the Ticket
          title: Id
          type: string
        priority:
          anyOf:
            - type: string
            - type: 'null'
          description: Vendor priority of the Ticket
          title: Priority
        status:
          anyOf:
            - type: string
            - type: 'null'
          description: Vendor status of the Ticket
          title: Status
        type:
          anyOf:
            - type: string
            - type: 'null'
          description: Vendor type of the Ticket
          title: Type
        type_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Vendor type ID of the Ticket
          title: Type Id
        updated_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: Last update time of the Ticket in Vendor
          title: Updated At
        vendor:
          description: Vendor name
          title: Vendor
          type: string
      required:
        - id
        - vendor
      title: ITSM Ticket Vendor Attributes
      type: object
    JiraTicketVendorAttributesData:
      properties:
        customFields:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Customfields
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        statusCategory:
          anyOf:
            - type: string
            - type: 'null'
          title: Statuscategory
        vendor:
          const: JIRA
          default: JIRA
          title: Vendor
          type: string
      title: JiraTicketVendorAttributesData
      type: object
    ServiceNowTicketVendorAttributesData:
      properties:
        customFields:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Customfields
        number:
          anyOf:
            - type: string
            - type: 'null'
          title: Number
        priorityNumeric:
          anyOf:
            - type: string
            - type: 'null'
          title: Prioritynumeric
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
        vendor:
          const: SERVICENOW_ITSM
          default: SERVICENOW_ITSM
          title: Vendor
          type: string
      title: ServiceNowTicketVendorAttributesData
      type: object
  securitySchemes:
    API-Key:
      in: header
      name: X-API-KEY
      type: apiKey
    Connection-ID:
      in: header
      name: X-CONNECTION-ID
      type: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.