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

# Create ticket

> Create a ticket. Optional `inbox_id` targets a specific inbox; when omitted, the ticket routes to the organization's default inbox (is_default: true). Use `created_by_role` to choose associate-on-behalf (agent logs a ticket for a requester; always emails the customer) versus customer self-service (requester opens their own ticket; emails only when inbox auto-reply is enabled). When CC email routing is enabled, optional `external_recipient_emails` sets CC recipients for the new ticket: omit or send null for none; send a list (empty or not) to set recipients. The requester (`from_email`) is always included in that list. Optional `attachment_ids` attaches files uploaded via the organization pending-attachments endpoints.



## OpenAPI

````yaml https://api.initdesk.com/schema.yaml post /organizations/{organization_id}/tickets/
openapi: 3.0.3
info:
  title: initdesk Customer API
  version: 1.19.0
  description: OpenAPI documentation for the customer-facing API served by the gateway.
servers:
  - url: https://api.initdesk.com
    description: Customer API gateway
security:
  - IntegrationToken: []
tags:
  - name: Organizations
    description: Organization metadata and context for all other resources.
  - name: Customers
    description: >-
      End users (requesters) scoped to the organization. Tickets reference
      customers by ID.
  - name: Tickets
    description: >-
      Tickets, messages, attachments, search, and statuses. A ticket is the
      conversation container; messages are nested under
      `/tickets/{pk}/messages/`.
  - name: Custom Preset Filters
    description: >-
      Saved ticket search filters scoped to the organization. Integration tokens
      receive organization-shared filters only.
  - name: Inboxes
    description: >-
      Organization mailboxes for routing tickets. Each inbox has an email prefix
      and optional default-inbox flag (is_default: true). On ticket create,
      inbox_id is optional: omit to use the default inbox, or provide an inbox
      ID to target a specific mailbox.
  - name: Tags
    description: Organization-scoped ticket tags with id, name, and optional color.
  - name: Help Center
    description: >-
      Support portal settings, knowledge base collections, articles, and article
      search.
paths:
  /organizations/{organization_id}/tickets/:
    post:
      tags:
        - Tickets
      summary: Create ticket
      description: >-
        Create a ticket. Optional `inbox_id` targets a specific inbox; when
        omitted, the ticket routes to the organization's default inbox
        (is_default: true). Use `created_by_role` to choose associate-on-behalf
        (agent logs a ticket for a requester; always emails the customer) versus
        customer self-service (requester opens their own ticket; emails only
        when inbox auto-reply is enabled). When CC email routing is enabled,
        optional `external_recipient_emails` sets CC recipients for the new
        ticket: omit or send null for none; send a list (empty or not) to set
        recipients. The requester (`from_email`) is always included in that
        list. Optional `attachment_ids` attaches files uploaded via the
        organization pending-attachments endpoints.
      operationId: create_ticket
      parameters:
        - in: path
          name: organization_id
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TicketCreationRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TicketCreationRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TicketCreationRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TicketCreation'
          description: ''
        '429':
          description: Hourly ticket creation limit exceeded for this organization.
      security:
        - IntegrationToken: []
components:
  schemas:
    TicketCreationRequest:
      type: object
      properties:
        inbox_id:
          type: integer
          writeOnly: true
          description: >-
            Optional inbox to route the new ticket. When omitted, the ticket is
            created in the organization's default inbox (is_default: true,
            typically named Main Inbox). Provide an inbox ID to target a
            specific mailbox; list available inboxes via the inboxes endpoint.
            Inbox-level settings (e.g. auto-reply) on the resolved inbox apply.
        subject:
          type: string
          minLength: 1
          maxLength: 255
        description:
          type: string
        description_html:
          type: string
        from_name:
          type: string
          minLength: 1
          maxLength: 255
        from_email:
          type: string
          format: email
          minLength: 1
          maxLength: 254
        created_by_role:
          enum:
            - associate
            - customer
          type: string
          x-spec-enum-id: 3b6d7fd7df8e507d
          writeOnly: true
          default: associate
          description: >-
            Who is creating the ticket via the API. Affects initial status,
            waiting_on, and whether the customer receives a ticket-created
            email. associate: an authenticated agent creates the ticket on
            behalf of the requester (from_email); use for phone support or
            proactive outreach. Sets status to active, waiting_on to customer,
            and created_by_user to the authenticated user. Always sends a
            ticket-created email to the customer, even when inbox auto-reply is
            disabled. customer: the requester creates the ticket for themselves
            (self-service portal, app, or integration acting as the end user).
            Sets status to created, waiting_on to associate, and leaves
            created_by_user unset. Sends a ticket-created email only when the
            inbox has auto-reply enabled. 


            * `associate` - Associate

            * `customer` - Customer
        external_recipient_emails:
          type: array
          items:
            type: string
            format: email
            minLength: 1
          nullable: true
          description: >-
            When provided as a list (empty or not), sets the ticket external CC
            list when CC email routing is enabled; omitted or null leaves it as
            the default empty list. The ticket requester (from_email) is always
            kept on the list.
        attachment_ids:
          type: array
          items:
            type: string
            format: uuid
          writeOnly: true
          description: >-
            List of pending attachment IDs to attach to the new ticket. Upload
            files via the organization pending-attachments endpoints before
            creating the ticket.
      required:
        - from_email
        - from_name
        - subject
    TicketCreation:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        public_id:
          type: string
          readOnly: true
        inbox:
          allOf:
            - $ref: '#/components/schemas/TicketInbox'
          readOnly: true
        subject:
          type: string
          maxLength: 255
        description:
          type: string
        description_html:
          type: string
        from_name:
          type: string
          maxLength: 255
        from_email:
          type: string
          format: email
          maxLength: 254
        external_recipient_emails:
          type: array
          items:
            type: string
            format: email
          nullable: true
          description: >-
            When provided as a list (empty or not), sets the ticket external CC
            list when CC email routing is enabled; omitted or null leaves it as
            the default empty list. The ticket requester (from_email) is always
            kept on the list.
      required:
        - from_email
        - from_name
        - id
        - inbox
        - public_id
        - subject
    TicketInbox:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        name:
          type: string
          readOnly: true
          title: Inbox Name
        email_prefix:
          type: string
          readOnly: true
        customer_interaction_style:
          enum:
            - helpdesk
            - conversational
          type: string
          x-spec-enum-id: b8814c0c94798024
          readOnly: true
          description: >-
            Helpdesk exposes ticket numbers in customer emails and messages;
            conversational keeps interactions natural without ticket references.


            * `helpdesk` - Helpdesk

            * `conversational` - Conversational
      required:
        - customer_interaction_style
        - email_prefix
        - id
        - name
  securitySchemes:
    IntegrationToken:
      type: apiKey
      in: header
      name: X-Initdesk-Token

````