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

# Book seats for an anonymous user

> Allows an unregistered user to book seats. 
The system will automatically create a new user account if one does not exist for the provided email and send an activation link to that email.
If an account already exists, an error is returned prompting the user to log in.




## OpenAPI

````yaml api-reference/openapi.json post /api/bookings/anonymous
openapi: 3.0.0
info:
  title: Tandem IT API
  version: 1.0.0
  description: API for tandem it backend
servers:
  - url: https://tandem.hlofiys.xyz
    description: Production server
security: []
tags:
  - name: Documentation
    description: API documentation endpoint
paths:
  /api/bookings/anonymous:
    post:
      tags:
        - Bookings
      summary: Book seats for an anonymous user
      description: >
        Allows an unregistered user to book seats. 

        The system will automatically create a new user account if one does not
        exist for the provided email and send an activation link to that email.

        If an account already exists, an error is returned prompting the user to
        log in.
      operationId: createAnonymousBooking
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAnonymousBookingRequest'
      responses:
        '201':
          description: >-
            Booking successful. An account has been created and an activation
            link has been sent to the provided email.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Booking'
        '400':
          description: >-
            Bad Request. The request body is malformed or fails validation
            (e.g., invalid email, empty seat_ids).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '409':
          description: >-
            Conflict. An account with this email already exists. The user should
            log in instead.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error. An unexpected error occurred on the server.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreateAnonymousBookingRequest:
      type: object
      required:
        - email
        - phone_number
        - event_id
        - seat_ids
      properties:
        email:
          type: string
          format: email
          description: >-
            The user's email address. An account will be created if it doesn't
            exist.
        phone_number:
          type: string
          description: The user's phone number, preferably in international E.164 format.
          example: '+375291234567'
        event_id:
          type: integer
          format: int64
          description: The unique identifier for the event.
        seat_ids:
          type: array
          items:
            type: integer
            format: int64
          description: An array of unique identifiers for the seats to be booked.
          example:
            - 101
            - 102
    Booking:
      type: object
      required:
        - booking_id
        - user_id
        - event_id
        - seat_id
        - is_paid
        - created_at
        - updated_at
      properties:
        booking_id:
          type: integer
          format: int64
        user_id:
          type: string
          format: uuid
        event_id:
          type: integer
          format: int64
        seat_id:
          type: integer
          format: int64
        is_paid:
          type: boolean
          description: >-
            Indicates whether the booking has been paid for. `false` for initial
            reservation
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ValidationError:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          example: Validation failed
        errors:
          type: object
          description: A map of field names to their respective error messages.
          additionalProperties:
            type: string
          example:
            name: The name field is required.
            price: The price must be a valid number.
            hall_id: A valid hall_id is required.
    Error:
      type: object
      required:
        - message
      properties:
        message:
          type: string

````