> ## 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.

# Create a new event

> Creates a new event entity in the system.
By default, a newly created event is hidden (`is_visible: false`).
This is a protected endpoint. Access is restricted to users with `admin` or `manager` roles. An attempt to access this endpoint with insufficient privileges will result in a 403 Forbidden error.




## OpenAPI

````yaml api-reference/openapi.json post /api/events
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/events:
    post:
      tags:
        - 'Admin: Events'
      summary: Create a new event
      description: >
        Creates a new event entity in the system.

        By default, a newly created event is hidden (`is_visible: false`).

        This is a protected endpoint. Access is restricted to users with `admin`
        or `manager` roles. An attempt to access this endpoint with insufficient
        privileges will result in a 403 Forbidden error.
      operationId: createEvent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEventRequest'
      responses:
        '201':
          description: The event was successfully created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Event'
        '400':
          description: Validation error. Incorrect or missing data in the request body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          description: >-
            Unauthorized. Authentication credentials were not provided or are
            invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            Access denied. The user does not have permission to perform this
            action
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: The hall with the specified ID was not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict. An event with the same data already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - BearerAuth: []
components:
  schemas:
    CreateEventRequest:
      type: object
      required:
        - name
        - description
        - start_time
        - end_time
        - hall_id
      properties:
        name:
          type: string
          description: Event name
        description:
          type: string
          description: Event description
        start_time:
          type: string
          format: date-time
          description: Event start time. Must be on the same day as end_time.
          example: '2025-09-15T19:00:00Z'
        end_time:
          type: string
          format: date-time
          description: Event end time. Must be on the same day as start_time.
          example: '2025-09-15T19:00:00Z'
        max_bookings_per_user:
          type: integer
          description: The maximum number of seats a single user can book for this event
          default: 1
        is_visible:
          type: boolean
          description: >-
            Controls whether the event is displayed on the public-facing event
            list
          default: false
        schedule:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleItem'
        hall_id:
          type: integer
          format: int64
          description: Unique hall ID
    Event:
      type: object
      required:
        - event_id
        - name
        - description
        - start_time
        - end_time
        - max_bookings_per_user
        - preview_image_url
        - is_visible
        - schedule
        - hall_id
      properties:
        event_id:
          type: integer
          format: int64
        name:
          type: string
          description: Event name
        description:
          type: string
          description: Event description
        start_time:
          type: string
          format: date-time
          description: Event start time
        end_time:
          type: string
          format: date-time
          description: Event end time
        max_bookings_per_user:
          type: integer
          description: The maximum number of seats a single user can book for this event
          default: 1
        preview_image_url:
          type: string
          description: Link to download the event preview image
        is_visible:
          type: boolean
          description: >-
            Controls whether the event is displayed on the public-facing event
            list
          default: false
        schedule:
          type: array
          items:
            $ref: '#/components/schemas/ScheduleItem'
        hall_id:
          type: integer
          format: int64
          description: Unique hall ID
    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
    ScheduleItem:
      type: object
      required:
        - time
        - description
      properties:
        time:
          type: string
          description: Time of the schedule item (for example, '15:00')
          example: '15:00'
        description:
          type: string
          description: Description of the schedule item
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````