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

# Create ticket

> Creates one or more active tickets (external gateway). Supplements require supplement_id and price per unit; optional quantity applies purchase_limit validation after collapsing duplicate supplement_id entries. For external payments, you may also send service_charge_amount (absolute amount per unit) for a supplement; it will be stored separately as service_charge_amount/service_charge_type=fixed and added into the stored unit price. Free supplements from the ticket rate are NOT auto-added here; the selection must be provided by the client.



## OpenAPI

````yaml post /tickets
openapi: 3.0.0
info:
  title: Channel Manager API
  version: 0.1.0
  description: >-
    Official API documentation for Channel Manager. All endpoints are protected
    by an API key.
servers:
  - url: https://channels-service-alpha.fourvenues.com
    description: Test server
  - url: https://channels-service.fourvenues.com
    description: Production server
security: []
tags: []
paths:
  /tickets:
    post:
      tags:
        - Tickets
      summary: Create ticket
      description: >-
        Creates one or more active tickets (external gateway). Supplements
        require supplement_id and price per unit; optional quantity applies
        purchase_limit validation after collapsing duplicate supplement_id
        entries. For external payments, you may also send service_charge_amount
        (absolute amount per unit) for a supplement; it will be stored
        separately as service_charge_amount/service_charge_type=fixed and added
        into the stored unit price. Free supplements from the ticket rate are
        NOT auto-added here; the selection must be provided by the client.
      operationId: createTicket
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                ticket_rate_id:
                  type: string
                  description: Ticket rate id of a ticket.
                  example: 5f8d0f8b9d2b3b0017b6d8a0
                discount_code:
                  type: string
                  description: Discount code of a ticket.
                  example: DISCOUNT_CODE
                send_resources:
                  type: boolean
                  description: Send resources to the client.
                  example: true
                tickets:
                  type: array
                  items:
                    type: object
                    properties:
                      price_id:
                        type: string
                        description: Price id of the ticket.
                        example: '1234567890'
                      qr_code:
                        type: string
                        description: >-
                          QRCode. Optional. If not provided, it will be
                          generated automatically.
                        example: ABCDE12345
                      total_price:
                        type: number
                        description: Total price of a ticket (fees included).
                        example: 10
                      fee:
                        type: number
                        description: Fee of a ticket (included in total_price).
                        example: 1
                      full_name:
                        type: string
                        description: >-
                          Full name of a ticket. May be required depending on
                          the settings of the ticket rate.
                        example: John Doe
                      phone:
                        type: string
                        description: >-
                          Phone number of a ticket. May be required depending on
                          the settings of the ticket rate.
                        example: '+34666666666'
                      email:
                        type: string
                        description: >-
                          Email of a ticket. May be required depending on the
                          settings of the ticket rate.
                        example: john@fourvenues.com
                      gender:
                        type: string
                        enum:
                          - '0'
                          - '1'
                      birthday:
                        type: string
                        description: Client's birthday.
                        example: '1990-01-01'
                      address:
                        type: string
                        description: Client's address.
                        example: 123 Main St, New York, NY 10001
                      postal_code:
                        type: string
                        description: Client's postal code.
                        example: '10001'
                      country_code:
                        type: string
                        description: Client's country code. (ISO3166-2)
                        example: ES
                      personal_document_type:
                        type: string
                        enum:
                          - dni
                          - nie
                          - passport
                          - other
                        description: Client's personal document type.
                        example: dni
                      personal_document_number:
                        type: string
                        description: Client's personal document number.
                        example: '1234567890'
                      warranty:
                        type: object
                        properties:
                          enabled:
                            type: boolean
                            example: true
                            description: If the warranty is enabled.
                          hours:
                            type: number
                            example: 12
                            description: >-
                              Hours before the event start the warranty can be
                              used.
                      answers:
                        type: array
                        items:
                          type: object
                          properties:
                            question_id:
                              type: string
                              description: Question's identifier.
                              example: '1234567890'
                            answer:
                              type: string
                              description: Answer.
                              example: Answer
                      supplements:
                        type: array
                        description: Optional supplements to attach to this ticket.
                        items:
                          $ref: '#/components/schemas/TicketSupplementCreateRequest'
                    required:
                      - price_id
                      - total_price
              required:
                - ticket_rate_id
                - tickets
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Ticket'
                  success:
                    type: boolean
        '400':
          description: >-
            Bad Request. Common supplement errors: Supplement not found;
            minimum/maximum quantity not met (after collapsing duplicate
            supplement_id entries); only one free supplement allowed per ticket.
      security:
        - ApiKey: []
components:
  schemas:
    TicketSupplementCreateRequest:
      type: object
      description: >-
        Supplement selection when creating tickets via POST /tickets (external
        gateway). The client supplies the unit price; service charge is taken
        from the ticket rate.
      required:
        - supplement_id
        - price
      properties:
        supplement_id:
          type: string
          description: Identifier of the supplement.
          example: '1643064796675'
        price:
          type: number
          description: Unit price paid by the client for this supplement pack.
          example: 12
        quantity:
          type: integer
          minimum: 1
          example: 1
          description: >-
            Number of units. Defaults to 1. Same aggregation and validation
            rules as checkout.
    Ticket:
      type: object
      properties:
        _id:
          type: string
          description: The unique identifier for a ticket
          example: 5f8d0f8b9d2b3b0017b6d8a0
        event_id:
          type: string
          description: Event id of a ticket
          example: 5f8d0f8b9d2b3b0017b6d8a0
        ticket_rate_id:
          type: string
          description: Ticket rate id of a ticket
          example: 5f8d0f8b9d2b3b0017b6d8a0
        qr_code:
          type: string
          description: QRCode of a ticket
          example: ABCDE12345
        status:
          type: string
          enum:
            - processing
            - active
            - voided
            - filled_client
            - pending_payment
          description: Status of a ticket
          example: active
        price:
          $ref: '#/components/schemas/PriceTicketRate'
        payment_currency:
          type: string
          description: Currency of the payment
          example: EUR
        channel_id:
          type: string
          description: Channel id of a ticket
          example: 5f8d0f8b9d2b3b0017b6d8a0
        fees:
          type: object
          properties:
            organization:
              type: number
              description: Fee charged to the client by the organization
              example: 1.1
            discocil:
              type: number
              description: Fee charged by Fourvenues to the organization
              example: 0.7
        full_name:
          type: string
          description: Full name of a ticket
          example: John Doe
        phone:
          type: string
          description: Phone number of a ticket
          example: '1234567890'
        email:
          type: string
          description: Email of a ticket
          example: john.appleseed@fourvenues.com
        gender:
          type: string
          description: Gender of the client.
          enum:
            - 0 = women
            - 1 = men
          example: 0
        birthday:
          type: string
          description: Birthday of a ticket
          example: '1990-01-01'
        address:
          type: string
          description: Address of a ticket
          example: 123 Main St, New York, NY 10001
        postal_code:
          type: string
          description: Postal code of a ticket
          example: '10001'
        country_code:
          type: string
          description: Country code of a ticket
          example: ES
        personal_document_type:
          type: string
          enum:
            - dni
            - nie
            - passport
            - other
          description: Personal document type of a ticket
          example: dni
        personal_document_number:
          type: string
          description: Personal document number of a ticket
          example: '1234567890'
        answers:
          type: array
          items:
            type: object
            properties:
              question_id:
                type: string
                description: Question id of a ticket
                example: '1234567890'
              answer:
                type: string
                description: Answer of a ticket
                example: Answer
        supplements:
          type: array
          description: Supplements attached to this ticket after purchase.
          items:
            $ref: '#/components/schemas/TicketSupplement'
        refunded:
          type: number
          description: Total refunded amount of a ticket
          example: 10
        refunded_at:
          type: string
          description: Refunded date of a ticket
          example: '2020-10-19T07:00:00.000Z'
        refunds:
          type: array
          description: Refunds of a ticket
          items:
            type: object
            properties:
              channel_id:
                type: string
                description: Channel id of a ticket
                example: 5f8d0f8b9d2b3b0017b6d8a0
              amount:
                type: number
                description: Refund amount of a ticket
                example: 10
              at:
                type: string
                description: Refund date of a ticket
                example: '2020-10-19T07:00:00.000Z'
        for:
          type: number
          description: Clients that can access with this ticket
          example: 1
        enter:
          type: number
          description: Clients that have entered with this ticket
          example: 1
        entry_time:
          type: string
          description: Entry time of the clients with this ticket
          example: '2022-07-19T07:00:00.000Z'
        total_supplements:
          type: number
          description: >-
            Sum of supplement line totals (unit price × purchase quantity) for
            this ticket.
          example: 2
        supplements_service_charge_total:
          type: number
          description: Total service charge applied to supplements on this ticket.
          example: 0.6
        total_fees:
          type: number
          description: Total price of the fees
          example: 1.1
        total_price:
          type: number
          description: >-
            Total price of the ticket + all extras (supplements, fees, warranty
            price, etc.)
          example: 16.1
        warranty:
          type: object
          properties:
            total:
              type: number
              example: 1
              description: Total amount that costs the warranty.
            hours:
              type: number
              example: 12
              description: Hours before the event the warranty can be used.
            cost:
              type: number
              example: 0.2
              description: GGDD warranty cost for this ticket.
        discount_amount:
          type: number
          description: Amount discounted by a discount code
          example: 5
    PriceTicketRate:
      type: object
      description: >-
        A ticket rate can have one or multiple prices but only one can be active
        at a time.
      properties:
        _id:
          type: string
          example: '1643064796675'
          description: Unique identifier for the price.
        name:
          type: string
          example: Early Bird
          description: Name of the price.
        price:
          type: number
          example: 12
          description: Price of the ticket.
        valid_until:
          type: string
          example: '2022-01-01T00:00:00.000Z'
          description: Date until the price will be available.
        quantity:
          type: number
          example: 0
          description: >-
            Max number of tickets that can be purchased with this price. NOTE: 0
            means unlimited.
        fee_type:
          type: string
          example: percentage
          enum:
            - percentage
            - fixed
          description: Type of the fee.
        fee_quantity:
          type: number
          example: 10
          description: Quantity of the fee.
        includes:
          type: string
          example: 1 Drink
          description: Content the price includes.
        additional_info:
          type: string
          example: Only valid before 2:00 am.
          description: Additional info.
        used:
          type: number
          example: '55'
          description: Number of tickets sold of this price
      required:
        - id
        - price
        - valid_until
        - quantity
        - includes
        - additional_info
    TicketSupplement:
      type: object
      description: Supplement line on a purchased ticket.
      properties:
        _id:
          type: string
          description: Supplement identifier (same as supplement_id).
          example: '1643064796675'
        supplement_id:
          type: string
          description: Supplement identifier.
          example: '1643064796675'
        label:
          type: string
          example: 1 Copa
        price:
          type: number
          description: Unit price of the supplement on this ticket.
          example: 12
        has_fake_price:
          type: boolean
          example: true
        fake_price:
          type: number
          example: 15
          description: Original price before discount when has_fake_price is true.
        description:
          type: string
          example: Includes one drink at the bar
        total_price:
          type: number
          description: 'Line total: price × supplement_units.'
          example: 24
        supplement_units:
          type: number
          description: Supplement packs purchased (purchase_quantity).
          example: 2
        product_quantity:
          type: number
          description: >-
            Redeemable items per purchased pack, as configured on the ticket
            rate (e.g. 4 drinks per pack).
          example: 4
        redemption_deadline_value:
          type: number
          description: >-
            Unix timestamp copied from the rate when redemption deadline was
            enabled at purchase time.
          example: 1798851600
  securitySchemes:
    ApiKey:
      in: header
      name: X-Api-Key
      type: apiKey

````