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