> ## 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:
  - url: https://api.leen.dev/v1
    description: Production API
  - url: https://api.eu-c1.leen.dev/v1
    description: Production API (EU Region)
  - url: https://api.ap-se2.leen.dev/v1
    description: Production Api (APAC Region)
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:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ITSMTicketCreateRequestModel'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ITSMTicketCreateRespModel'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
        '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:
        - Connection-ID: []
          API-Key: []
components:
  schemas:
    ITSMTicketCreateRequestModel:
      properties:
        name:
          type: string
          title: Name
          description: Name/Title of the Ticket
        project_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Project Id
          description: >-
            Leen project UUID. Either project_id or project_vendor_id must be
            provided.
        project_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Project Vendor Id
          description: >-
            Vendor's project identifier (e.g., Jira project key 'PROJ').
            Alternative to project_id.
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
          description: Type of the Ticket (e.g., Task, Bug, Story)
        type_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Vendor Id
          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.
        type_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Id
          description: 'Deprecated: use type_vendor_id instead. Vendor issue type ID.'
          deprecated: true
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Description of the Ticket
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          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.
        priority:
          anyOf:
            - type: string
            - type: 'null'
          title: Priority
          description: Priority of the Ticket
        assigned_user_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Assigned User Id
          description: >-
            Leen user UUID. Either assigned_user_id or assigned_user_vendor_id
            can be provided.
        assigned_user_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Assigned User Vendor Id
          description: >-
            Vendor's user identifier (e.g., Jira accountId). Alternative to
            assigned_user_id.
        parent_ticket_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Parent Ticket Id
          description: Parent Ticket ID (for sub-tasks)
        parent_ticket_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Ticket Vendor Id
          description: >-
            Vendor's ticket identifier (e.g., Jira issue key 'PROJ-123').
            Alternative to parent_ticket_id.
        identifier:
          anyOf:
            - type: string
            - type: 'null'
          title: Identifier
          description: >-
            User-provided tracking identifier (auto-generated from
            project-type-hash if not provided)
      type: object
      required:
        - name
      title: ITSM Ticket Create Request
    ITSMTicketCreateRespModel:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: Leen's UUID for the Ticket
        active:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Active
          description: Whether the Ticket is active
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
          description: Type of the Ticket (e.g., Epic, Story, Task, Bug)
        type_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Id
          description: Vendor-specific type ID (e.g., Jira issue type ID)
        parent_ticket_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Parent Ticket Id
          description: Parent Ticket ID (for sub-tasks)
        name:
          type: string
          title: Name
          description: Name of the Ticket
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Description of the Ticket
        ticket_created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ticket Created At
          description: Creation time of the Ticket in the vendor system
        due_date:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Due Date
          description: Due date of the Ticket
        closed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Closed At
          description: Closing time of the Ticket
        assigned_user_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Assigned User Id
          description: User ID assigned to the Ticket
        created_by_user_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Created By User Id
          description: User ID who created the Ticket
        status:
          type: string
          title: Status
          description: Status of the Ticket
        status_updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Status Updated At
          description: Last status update time
        project_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Project Id
          description: Project ID the Ticket belongs to
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tags
          description: Tags associated with the Ticket
        priority:
          anyOf:
            - type: string
            - type: 'null'
          title: Priority
          description: Priority of the Ticket
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
          description: URL of the Ticket
        identifier:
          anyOf:
            - type: string
            - type: 'null'
          title: Identifier
          description: User-provided tracking identifier for the Ticket
        vendor_attributes:
          allOf:
            - $ref: '#/components/schemas/ITSMTicketVendorAttributes'
          description: Vendor-specific attributes of the Ticket
        parent_ticket_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Ticket Vendor Id
          description: >-
            Vendor key of the parent ticket (e.g. 'PROJ-42'). Populated when the
            request used parent_ticket_vendor_id.
        assigned_user_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Assigned User Vendor Id
          description: >-
            Vendor account ID of the assigned user (e.g. Jira accountId).
            Populated when the request used assigned_user_vendor_id.
        type_vendor_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Vendor Id
          description: >-
            Vendor issue type ID (e.g. '10034'). Populated when the request used
            type_vendor_id.
      type: object
      required:
        - id
        - name
        - status
        - vendor_attributes
      title: ITSM Ticket Create Response
      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).
    ErrorResponse:
      properties:
        type:
          type: string
          title: Type
          description: Type of error
        code:
          type: string
          title: Code
          description: Error code
        message:
          type: string
          title: Message
          description: Error message
        detail:
          items:
            type: object
          type: array
          title: Detail
          description: List of error dictionaries
      type: object
      required:
        - type
        - code
        - message
        - detail
      title: ErrorResponse
    ITSMTicketVendorAttributes:
      properties:
        id:
          type: string
          title: Id
          description: Vendor's ID for the Ticket
        vendor:
          type: string
          title: Vendor
          description: Vendor name
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
          description: Creation time of the Ticket in Vendor
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
          description: Last update time of the Ticket in Vendor
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
          description: Vendor type of the Ticket
        type_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Type Id
          description: Vendor type ID of the Ticket
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          description: Vendor status of the Ticket
        priority:
          anyOf:
            - type: string
            - type: 'null'
          title: Priority
          description: Vendor priority of the Ticket
        data:
          anyOf:
            - oneOf:
                - $ref: '#/components/schemas/JiraTicketVendorAttributesData'
              discriminator:
                propertyName: vendor
                mapping:
                  JIRA:
                    $ref: '#/components/schemas/JiraTicketVendorAttributesData'
            - type: 'null'
          title: Data
          description: Vendor-specific data associated with the Ticket
      type: object
      required:
        - id
        - vendor
      title: ITSM Ticket Vendor Attributes
    JiraTicketVendorAttributesData:
      properties:
        vendor:
          type: string
          enum:
            - JIRA
          const: JIRA
          title: Vendor
          default: JIRA
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        statusCategory:
          anyOf:
            - type: string
            - type: 'null'
          title: Statuscategory
        customFields:
          anyOf:
            - type: object
            - type: 'null'
          title: Customfields
      type: object
      title: JiraTicketVendorAttributesData
  securitySchemes:
    Connection-ID:
      type: apiKey
      in: header
      name: X-CONNECTION-ID
    API-Key:
      type: apiKey
      in: header
      name: X-API-KEY

````