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

# Create ticket

> Create a ticket manually, from a review, or for an external customer association. If review_id is provided the ticket is created with source_type review and deduplicated against active review tickets.



## OpenAPI

````yaml POST /tickets
openapi: 3.0.1
info:
  title: Masivo's REST API
  description: Learn how to use Masivo's REST API
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://app.masivo.ai/api/storefront/v1
security:
  - bearerAuth: []
paths:
  /tickets:
    post:
      description: >-
        Create a ticket manually, from a review, or for an external customer
        association. If review_id is provided the ticket is created with
        source_type review and deduplicated against active review tickets.
      parameters:
        - in: header
          name: x-account-id
          description: The account that owns the ticket
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TicketCreate'
      responses:
        '201':
          description: Ticket created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Ticket'
        '400':
          description: Ticket creation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Invalid request body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    TicketCreate:
      type: object
      required:
        - title
      properties:
        title:
          type: string
          maxLength: 200
        description:
          type: string
          maxLength: 5000
        pipeline_id:
          type: string
          format: uuid
          description: >-
            Ticket pipeline id. The account default pipeline is used when
            omitted.
        stage_code:
          type: string
          description: >-
            Internal stage code within pipeline_id. The pipeline default stage
            is used when omitted.
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
          default: medium
        status:
          type: string
          enum:
            - open
            - resolved
            - closed
          default: open
        source_type:
          type: string
          enum:
            - manual
            - review
            - journey
            - system
          default: manual
        review_id:
          type: string
          format: uuid
          description: >-
            Review id to associate and deduplicate against an active review
            ticket.
        customer_id:
          type: string
          description: >-
            External customer id to associate with the ticket when there is no
            review.
        actor_user_id:
          type: string
          format: uuid
          description: >-
            Agent/profile id that should be recorded as the creator. If omitted,
            the first account member is used.
        assignee_user_ids:
          type: array
          items:
            type: string
            format: uuid
          description: Account member ids to assign to the ticket on creation.
        idempotency_key:
          type: string
          maxLength: 200
        required_fields:
          type: object
          description: >-
            Values required when the initial status maps to a stage with
            required fields.
          additionalProperties:
            type: string
    Ticket:
      type: object
      properties:
        id:
          type: string
          format: uuid
        account_id:
          type: string
          format: uuid
        pipeline_id:
          type: string
          format: uuid
        stage_code:
          type: string
          example: new
        status:
          type: string
          enum:
            - open
            - resolved
            - closed
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
        title:
          type: string
        description:
          type: string
          nullable: true
        source_type:
          type: string
          enum:
            - manual
            - review
            - journey
            - system
        created_by_user_id:
          type: string
          format: uuid
        assignees:
          type: array
          description: Current assignee snapshots synced from the ticket_assignees table.
          items:
            $ref: '#/components/schemas/TicketAssignee'
        communication_summary:
          $ref: '#/components/schemas/TicketCommunicationSummary'
        review_id:
          type: string
          format: uuid
          nullable: true
        brand_id:
          type: string
          nullable: true
        channel_id:
          type: string
          nullable: true
        store_id:
          type: string
          nullable: true
        resolved_at:
          type: string
          format: date-time
          nullable: true
        closed_at:
          type: string
          format: date-time
          nullable: true
        reopened_at:
          type: string
          format: date-time
          nullable: true
        first_resolved_at:
          type: string
          format: date-time
          nullable: true
        resolution_count:
          type: number
        resolution_summary:
          type: string
          nullable: true
        closure_reason:
          type: string
          nullable: true
        associations:
          type: array
          items:
            $ref: '#/components/schemas/TicketAssociation'
        comments:
          type: array
          items:
            $ref: '#/components/schemas/TicketComment'
        stage_history:
          type: array
          items:
            $ref: '#/components/schemas/TicketStageHistoryEntry'
        dedupe_fingerprint:
          type: string
          nullable: true
        idempotency_key:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        deleted_at:
          type: string
          format: date-time
          nullable: true
    Error:
      required:
        - error
        - details
      type: object
      properties:
        error:
          type: string
        details:
          type: string
    TicketAssignee:
      type: object
      description: Active assignee snapshot stored on the ticket.
      properties:
        user_id:
          type: string
          format: uuid
        role:
          type: string
          enum:
            - assignee
            - watcher
        assigned_at:
          type: string
          format: date-time
        assigned_by_user_id:
          type: string
          format: uuid
    TicketCommunicationSummary:
      type: object
      properties:
        thread_count:
          type: number
        latest_thread_id:
          type: string
          format: uuid
          nullable: true
        latest_message_id:
          type: string
          format: uuid
          nullable: true
        latest_message_at:
          type: string
          format: date-time
          nullable: true
        latest_message_preview:
          type: string
          nullable: true
        channel:
          $ref: '#/components/schemas/CommunicationChannel'
        channel_account_id:
          type: string
          nullable: true
        external_thread_id:
          type: string
          nullable: true
        direction:
          $ref: '#/components/schemas/CommunicationDirection'
        unread_count:
          type: number
        status:
          type: string
          enum:
            - open
            - closed
          nullable: true
    TicketAssociation:
      type: object
      properties:
        associated_type:
          type: string
          enum:
            - review
            - customer
            - journey
            - campaign
            - event
        associated_id:
          type: string
        created_at:
          type: string
          format: date-time
    TicketComment:
      type: object
      properties:
        id:
          type: string
          format: uuid
        author_user_id:
          type: string
          format: uuid
        body:
          type: string
        is_internal:
          type: boolean
        created_at:
          type: string
          format: date-time
    TicketStageHistoryEntry:
      type: object
      properties:
        from_pipeline_id:
          type: string
          format: uuid
          nullable: true
        to_pipeline_id:
          type: string
          format: uuid
          nullable: true
        from_stage_code:
          type: string
          nullable: true
        to_stage_code:
          type: string
        changed_by_user_id:
          type: string
          format: uuid
        changed_at:
          type: string
          format: date-time
        duration_seconds:
          type: number
          nullable: true
    CommunicationChannel:
      type: string
      enum:
        - email
        - whatsapp
        - chat
        - review
        - system
        - other
    CommunicationDirection:
      type: string
      enum:
        - inbound
        - outbound
        - internal
        - system
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````