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

# Upload a file



## OpenAPI

````yaml post /v1/files
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/files:
    post:
      tags:
        - File
      summary: Upload a file
      operationId: file.store
      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:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/FileStoreRequest'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    $ref: '#/components/schemas/FileResource'
                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:
    FileStoreRequest:
      type: object
      properties:
        file:
          type: string
          format: binary
          contentMediaType: application/octet-stream
          description: The file to upload.
        type:
          $ref: '#/components/schemas/FileType'
          description: The file type.
        description:
          type:
            - string
            - 'null'
          description: The file description.
          maxLength: 1000
        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:
        - file
        - type
        - fileable_type
        - fileable_id
      title: FileStoreRequest
    FileResource:
      type: object
      properties:
        id:
          type: integer
        record_state:
          $ref: '#/components/schemas/RecordStateResource'
        name:
          type: string
        description:
          type:
            - string
            - 'null'
        type:
          type: string
        mime_type:
          type:
            - string
            - 'null'
        size:
          type:
            - integer
            - 'null'
        formatted_size:
          type: string
        group_id:
          type:
            - string
            - 'null'
        fileable_type:
          type:
            - string
            - 'null'
        fileable_id:
          type:
            - integer
            - 'null'
        fileable_name:
          type:
            - string
            - 'null'
        sort_order:
          type:
            - integer
            - 'null'
        temporary_url:
          type:
            - string
            - 'null'
        temporary_thumbnail_url:
          type:
            - string
            - 'null'
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - record_state
        - name
        - description
        - type
        - mime_type
        - size
        - formatted_size
        - group_id
        - fileable_type
        - fileable_id
        - fileable_name
        - sort_order
        - temporary_url
        - temporary_thumbnail_url
        - created_at
        - updated_at
        - deleted_at
      title: FileResource
    FileType:
      type: string
      enum:
        - form_image
        - audio
        - catalog
        - certificate
        - image
        - video
        - other
        - before_after
      title: FileType
    RecordStateResource:
      type: object
      properties:
        is_read_only:
          type: boolean
          description: >-
            True when every write on this record is refused; false does not
            imply the caller may write.
        reason_code:
          type:
            - string
            - 'null'
          description: >-
            Why the record is read-only (`CUSTOMER_ERASED`, or
            `LEAD_NOT_ASSIGNED` for a salesperson on another rep's lead), or
            null when it is not.
      required:
        - is_read_only
        - reason_code
      title: RecordStateResource
  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.