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

# Initialize file upload

> Start a file upload by requesting a presigned URL. PUT the file contents directly to the returned URL, then call `POST /files/{file_id}/confirm` to trigger processing.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/files/init
openapi: 3.1.0
info:
  title: Memic API
  description: >-
    Memic is a memory layer for AI applications. The Memic API lets you ingest
    documents, run semantic search and chat, and manage prompts — all scoped to
    an environment via a single API key.
  version: 1.0.0
servers:
  - url: https://api.memic.ai
    description: Production
security:
  - MemicApiKey: []
tags:
  - name: Endpoints
    description: All 10 Memic API endpoints.
paths:
  /api/v1/files/init:
    post:
      tags:
        - Endpoints
      summary: Initialize file upload
      description: >-
        Start a file upload by requesting a presigned URL. PUT the file contents
        directly to the returned URL, then call `POST /files/{file_id}/confirm`
        to trigger processing.
      operationId: initFileUpload
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileInitUploadRequestDTO'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileInitUploadResponseDTO'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - MemicApiKey: []
components:
  schemas:
    FileInitUploadRequestDTO:
      properties:
        filename:
          type: string
          maxLength: 500
          minLength: 1
          title: Filename
          description: Original filename
        size:
          type: integer
          exclusiveMinimum: 0
          title: Size
          description: File size in bytes
        mime_type:
          type: string
          title: Mime Type
          description: MIME type of the file
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Optional metadata
        reference_id:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Reference Id
          description: >-
            Client-provided reference ID for linking with external systems
            (e.g., 'TG_G1_Math'). Stored in both database and Pinecone for
            lookup-based search filtering.
        environment_slug:
          anyOf:
            - type: string
            - type: 'null'
          title: Environment Slug
          description: >-
            Target environment slug ('staging' or 'production'). Defaults to
            'production'.
          default: production
        folder_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Folder Id
          description: >-
            Target folder ID within the environment. If not provided, uses the
            default folder.
      type: object
      required:
        - filename
        - size
        - mime_type
      title: FileInitUploadRequestDTO
      description: Request DTO for initializing file upload (presigned URL approach).
    FileInitUploadResponseDTO:
      properties:
        file_id:
          type: string
          format: uuid4
          title: File Id
        upload_url:
          type: string
          title: Upload Url
        expires_in:
          type: integer
          title: Expires In
          description: URL expiry in seconds
          default: 3600
      type: object
      required:
        - file_id
        - upload_url
      title: FileInitUploadResponseDTO
      description: Response DTO for file upload initialization.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
  securitySchemes:
    MemicApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Memic API key. Every key is bound to exactly one environment — get one
        from the Memic dashboard under API Keys.

````