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

# Upload a file

> Upload a file to storage. Returns file metadata including path for use in records.



## OpenAPI

````yaml post /api/v1/files/upload
openapi: 3.1.0
info:
  title: SnackBase
  description: Open-source Backend-as-a-Service (BaaS)
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/files/upload:
    post:
      tags:
        - files
        - files
      summary: Upload a file
      description: >-
        Upload a file to storage. Returns file metadata including path for use
        in records.
      operationId: upload_file_api_v1_files_upload_post
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_file_api_v1_files_upload_post'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_upload_file_api_v1_files_upload_post:
      properties:
        file:
          type: string
          format: binary
          title: File
          description: File to upload
      type: object
      required:
        - file
      title: Body_upload_file_api_v1_files_upload_post
    FileUploadResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Upload success status
          default: true
        file:
          $ref: '#/components/schemas/FileMetadataResponse'
          description: Uploaded file metadata
        message:
          type: string
          title: Message
          description: Success message
          default: File uploaded successfully
      type: object
      required:
        - file
      title: FileUploadResponse
      description: Response schema for file upload.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    FileMetadataResponse:
      properties:
        filename:
          type: string
          title: Filename
          description: Original filename
        size:
          type: integer
          title: Size
          description: File size in bytes
        mime_type:
          type: string
          title: Mime Type
          description: MIME type of the file
        path:
          type: string
          title: Path
          description: >-
            Relative storage path. Local files use account_id/uuid_filename. S3
            files use s3/account_id/uuid_filename.
      type: object
      required:
        - filename
        - size
        - mime_type
        - path
      title: FileMetadataResponse
      description: Response schema for file metadata.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````