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

# Bulk Create ITSM Tickets (Sync)

> Create multiple ITSM tickets synchronously.

Calls the vendor's bulk create API directly and returns per-ticket results immediately.
Supports both Leen UUID fields and vendor ID fields (project_vendor_id,
assigned_user_vendor_id, parent_ticket_vendor_id, type_vendor_id).

When vendor IDs are provided, local DB persistence is skipped (ticket_id=None in
results) and the tickets will appear after the next connector sync.

Response (200 OK):
- total/succeeded/failed counts
- results[]: per-ticket entry with vendor_ticket_id on success, error on failure
- HTTP status is always 200; check failed > 0 for per-ticket failures



## OpenAPI

````yaml post /itsm/tickets/bulk/sync
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/bulk/sync:
    post:
      tags:
        - ITSM
        - Tickets
      summary: Bulk Create ITSM Tickets (Sync)
      description: >-
        Create multiple ITSM tickets synchronously.


        Calls the vendor's bulk create API directly and returns per-ticket
        results immediately.

        Supports both Leen UUID fields and vendor ID fields (project_vendor_id,

        assigned_user_vendor_id, parent_ticket_vendor_id, type_vendor_id).


        When vendor IDs are provided, local DB persistence is skipped
        (ticket_id=None in

        results) and the tickets will appear after the next connector sync.


        Response (200 OK):

        - total/succeeded/failed counts

        - results[]: per-ticket entry with vendor_ticket_id on success, error on
        failure

        - HTTP status is always 200; check failed > 0 for per-ticket failures
      operationId: sync_bulk_create_tickets
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ITSMTicketBulkCreateRequestModel'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ITSMTicketBulkCreateSyncResponseModel'
        '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
      security:
        - Connection-ID: []
          API-Key: []
components:
  schemas:
    ITSMTicketBulkCreateRequestModel:
      properties:
        tickets:
          items:
            $ref: '#/components/schemas/ITSMTicketCreateRequestModel'
          type: array
          maxItems: 50
          minItems: 1
          title: Tickets
          description: List of tickets to create (1-50 items)
      type: object
      required:
        - tickets
      title: ITSM Ticket Bulk Create Request
    ITSMTicketBulkCreateSyncResponseModel:
      properties:
        total:
          type: integer
          title: Total
          description: Total number of tickets in the request.
        succeeded:
          type: integer
          title: Succeeded
          description: Number of tickets successfully created.
        failed:
          type: integer
          title: Failed
          description: Number of tickets that failed to create.
        results:
          items:
            $ref: '#/components/schemas/ITSMBulkCreateTicketResult'
          type: array
          title: Results
          description: Per-ticket results in request order.
      type: object
      required:
        - total
        - succeeded
        - failed
        - results
      title: ITSM Ticket Bulk Create Sync Response
    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
    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
    ITSMBulkCreateTicketResult:
      properties:
        success:
          type: boolean
          title: Success
        request_index:
          type: integer
          title: Request Index
        identifier:
          anyOf:
            - type: string
            - type: 'null'
          title: Identifier
        ticket_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Ticket Id
          description: >-
            Leen UUID of the created ticket. None when vendor IDs were used (no
            local persistence).
        vendor_ticket_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Vendor Ticket Id
          description: >-
            Vendor ticket identifier (e.g. Jira issue key 'PROJ-123'). Present
            on success.
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message if this ticket failed.
      type: object
      required:
        - success
        - request_index
      title: ITSMBulkCreateTicketResult
  securitySchemes:
    Connection-ID:
      type: apiKey
      in: header
      name: X-CONNECTION-ID
    API-Key:
      type: apiKey
      in: header
      name: X-API-KEY

````