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

# Create ITSM Ticket

> Create a new ITSM ticket.

Vendor ID fields (project_vendor_id, assigned_user_vendor_id,
parent_ticket_vendor_id) are passed straight through to the vendor without extra
DB resolution. The ticket is always persisted locally and the full DB record is
returned.



## OpenAPI

````yaml post /itsm/tickets
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:
    post:
      tags:
        - ITSM
        - Tickets
      summary: Create ITSM Ticket
      description: >-
        Create a new ITSM ticket.


        Vendor ID fields (project_vendor_id, assigned_user_vendor_id,

        parent_ticket_vendor_id) are passed straight through to the vendor
        without extra

        DB resolution. The ticket is always persisted locally and the full DB
        record is

        returned.
      operationId: create_ticket
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ITSMTicketCreateRequestModel'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ITSMTicketCreateRespModel'
          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:
    ITSMTicketCreateRequestModel:
      properties:
        assigned_user_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: >-
            Leen user UUID. Either assigned_user_id or assigned_user_vendor_id
            can be provided.
          title: Assigned User Id
        assigned_user_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Vendor's user identifier (e.g., Jira accountId). Alternative to
            assigned_user_id.
          title: Assigned User Vendor 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
        identifier:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            User-provided tracking identifier (auto-generated from
            project-type-hash if not provided)
          title: Identifier
        name:
          description: Name/Title 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
        parent_ticket_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Vendor's ticket identifier (e.g., Jira issue key 'PROJ-123').
            Alternative to parent_ticket_id.
          title: Parent Ticket Vendor Id
        priority:
          anyOf:
            - type: string
            - type: 'null'
          description: Priority of the Ticket
          title: Priority
        project_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: >-
            Leen project UUID. Required for vendors that use projects (e.g.
            Jira). Omit for vendors without projects (e.g. ServiceNow — table is
            derived from ticket type).
          title: Project Id
        project_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Vendor's project identifier (e.g., Jira project key 'PROJ').
            Alternative to project_id. Omit for vendors without projects.
          title: Project Vendor Id
        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. Note: Jira does not support setting status at
            creation time — tickets are always created with the workflow's
            default status. Use the update endpoint to change status after
            creation.
          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
        type:
          anyOf:
            - type: string
            - type: 'null'
          description: Type of the Ticket (e.g., Task, Bug, Story)
          title: Type
        type_id:
          anyOf:
            - type: string
            - type: 'null'
          deprecated: true
          description: 'Deprecated: use type_vendor_id instead. Vendor issue type ID.'
          title: Type Id
        type_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Vendor issue type ID (e.g., Jira issue type ID). Alternative to type
            — at least one must be provided. Preferred over type when both are
            given.
          title: Type Vendor Id
        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
      required:
        - name
      title: ITSM Ticket Create Request
      type: object
    ITSMTicketCreateRespModel:
      description: >-
        Response model for ticket creation. Extends ScopedITSMTicketRespModel
        with

        vendor ID fields that are echoed back when vendor IDs were provided in
        the

        request (rather than Leen UUIDs).
      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
        assigned_user_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Vendor account ID of the assigned user (e.g. Jira accountId).
            Populated when the request used assigned_user_vendor_id.
          title: Assigned User Vendor 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
        parent_ticket_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Vendor key of the parent ticket (e.g. 'PROJ-42'). Populated when the
            request used parent_ticket_vendor_id.
          title: Parent Ticket Vendor 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
        type_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Vendor issue type ID (e.g. '10034'). Populated when the request used
            type_vendor_id.
          title: Type Vendor 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 Create Response
      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.