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

# Upload or update a preview image for an event

> Uploads or replaces the preview image for a specific event.

The request body must be of type `multipart/form-data` with a single file part named `preview_image`.

**Constraints:**
- **File Size Limit:** 10 MB.
- **Allowed Formats:** JPEG, PNG, and WebP (`image/jpeg`, `image/png`, `image/webp`).




## OpenAPI

````yaml api-reference/openapi.json post /api/events/{event_id}/preview-image
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/{event_id}/preview-image:
    parameters:
      - name: event_id
        in: path
        required: true
        schema:
          type: integer
          format: int64
    post:
      tags:
        - 'Admin: Events'
      summary: Upload or update a preview image for an event
      description: >
        Uploads or replaces the preview image for a specific event.


        The request body must be of type `multipart/form-data` with a single
        file part named `preview_image`.


        **Constraints:**

        - **File Size Limit:** 10 MB.

        - **Allowed Formats:** JPEG, PNG, and WebP (`image/jpeg`, `image/png`,
        `image/webp`).
      operationId: uploadEventPreviewImage
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - preview_image
              properties:
                preview_image:
                  type: string
                  format: binary
                  description: The image file to upload.
      responses:
        '200':
          description: Image uploaded successfully. Returns the URL of the uploaded image.
          content:
            application/json:
              schema:
                type: object
                properties:
                  preview_image_url:
                    type: string
                    format: uri
        '400':
          description: >-
            Bad Request. The request is malformed, e.g., missing 'preview_image'
            part or invalid file type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden. The user does not have permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found. The event with the specified `event_id` does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: Payload Too Large. The uploaded image file exceeds the 10MB limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          description: Unsupported Media Type. The file is not a jpeg, png, or webp.
          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:
    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
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````