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

# Generate a presigned upload URL

> Returns a short-lived presigned PUT URL so the client can upload the file
directly to S3, bypassing the backend. The client then calls confirm.



## OpenAPI

````yaml post /v1/uploads/presign
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: >-
    Flextell REST API referansı. Kimlik doğrulama, scope ve istek kuralları için
    API sekmesindeki rehberlere bakın.
servers:
  - url: https://app.flextell.ai/api
    description: Üretim
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/uploads/presign:
    post:
      tags:
        - File
      summary: Generate a presigned upload URL
      description: >-
        Returns a short-lived presigned PUT URL so the client can upload the
        file

        directly to S3, bypassing the backend. The client then calls confirm.
      operationId: file.presign
      parameters:
        - name: X-Tenant
          in: header
          required: true
          description: >-
            Tenant identifier. Send the Tenant ID in the `X-Tenant` header to
            scope API requests to a specific tenant.
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FilePresignRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    type: object
                    properties:
                      upload_url:
                        type: string
                      key:
                        type: string
                      group_id: {}
                      headers:
                        anyOf:
                          - type: string
                          - type: array
                            items:
                              type: string
                            minItems: 0
                            maxItems: 0
                            additionalItems: false
                      expires_at:
                        type: string
                    required:
                      - upload_url
                      - key
                      - group_id
                      - headers
                      - expires_at
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '409':
          $ref: '#/components/responses/CustomerErasedException'
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    FilePresignRequest:
      type: object
      properties:
        filename:
          type: string
          description: The original file name (used to derive the storage extension).
          maxLength: 255
        content_type:
          type: string
          description: >-
            The content type the client will upload with (must match the PUT
            request).
          enum:
            - image/jpeg
            - image/png
            - image/webp
            - image/heic
            - image/heif
            - image/gif
            - application/pdf
            - application/msword
            - >-
              application/vnd.openxmlformats-officedocument.wordprocessingml.document
            - application/vnd.ms-excel
            - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
            - audio/mpeg
            - audio/mp4
            - audio/aac
            - audio/ogg
            - audio/wav
            - audio/webm
            - video/mp4
            - video/quicktime
            - video/webm
            - video/3gpp
            - video/x-matroska
            - video/mpeg
          maxLength: 255
        size:
          type: integer
          description: The declared file size in bytes.
          minimum: 1
          maximum: 52428800
        type:
          $ref: '#/components/schemas/FileType'
          description: The file type.
        description:
          type:
            - string
            - 'null'
          description: The file description.
          maxLength: 1000
        group_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            Optional group id shared by files uploaded together. Omit it to
            presign a standalone file; reuse the same uuid across a batch to
            group those files.
        fileable_type:
          type: string
          description: >-
            The fileable type (customer, lead, user, tenant, chat_log,
            ai_report, treatment, or treatment_group).
          enum:
            - customer
            - lead
            - user
            - tenant
            - chat_log
            - ai_report
            - treatment
            - treatment_group
        fileable_id:
          type: integer
          description: The fileable id.
          minimum: 1
      required:
        - filename
        - content_type
        - size
        - type
        - fileable_type
        - fileable_id
      title: FilePresignRequest
    FileType:
      type: string
      enum:
        - form_image
        - audio
        - catalog
        - certificate
        - image
        - video
        - other
        - before_after
      title: FileType
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    CustomerErasedException:
      description: The patient record has been erased and is read-only
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                description: Always false for an error.
                examples:
                  - false
              error_code:
                type: string
                description: Machine-readable error code.
                examples:
                  - CUSTOMER_ERASED
              message:
                type: string
                description: Localized error message.
            required:
              - success
              - error_code
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://dev.flextell.ai/oauth/authorize
          tokenUrl: https://dev.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.