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

# Initiate File Upload

> Start a new file upload to Friendli Suite via the API. Returns a file ID and pre-signed upload URL to begin transferring your file data.

Initiate file upload.

To request successfully, it is required to enter a **Personal API Key** (e.g. flp\_XXX) in the **Bearer Token** field.
Refer to the [authentication section](/openapi/introduction#authentication) on our introduction page to learn more and [visit here](https://friendli.ai/suite/~/setting/keys) to generate your API Key.

<Info>
  This API is currently in **Beta**.
  While we strive to provide a stable and reliable experience, this feature is still under active development.
  As a result, you may encounter unexpected behavior or limitations.
  We encourage you to provide feedback to help us improve the feature before its official release.

  * [Feature request & feedback](mailto:support@friendli.ai)
  * [Contact support](mailto:support@friendli.ai)
</Info>


## OpenAPI

````yaml https://github.com/friendliai/friendli-openapi/raw/refs/heads/main/openapi.yaml post /beta/file
openapi: 3.1.0
info:
  title: Friendli Suite API Reference
  description: This is an OpenAPI reference of Friendli Suite API.
  termsOfService: https://friendli.ai/terms-of-service
  contact:
    name: FriendliAI Support Team
    email: support@friendli.ai
  version: 0.1.0
servers:
  - url: https://api.friendli.ai
security: []
tags:
  - name: Serverless.Chat
  - name: Serverless.ToolAssistedChat
  - name: Serverless.Messages
  - name: Serverless.ChatRender
  - name: Serverless.Completions
  - name: Serverless.Token
  - name: Serverless.Audio
  - name: Serverless.Model
  - name: Serverless.Knowledge
  - name: Dedicated.Chat
  - name: Dedicated.Messages
  - name: Dedicated.ChatRender
  - name: Dedicated.Completions
  - name: Dedicated.Embeddings
  - name: Dedicated.TextClassification
  - name: Dedicated.Token
  - name: Dedicated.Image
  - name: Dedicated.Audio
  - name: Dedicated.Endpoint
  - name: Container.Chat
  - name: Container.Messages
  - name: Container.Completions
  - name: Container.TextClassification
  - name: Container.Token
  - name: Container.Image
  - name: Container.Audio
  - name: Cost
  - name: Dataset
  - name: File
paths:
  /beta/file:
    post:
      tags:
        - File
      summary: Initiate file upload
      description: Initiate file upload.
      operationId: init_upload
      parameters:
        - name: X-Friendli-Team
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: ID of team to run requests as (optional parameter).
            title: X-Friendli-Team
          description: ID of team to run requests as (optional parameter).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileInitUploadRequest'
      responses:
        '200':
          description: OK - File is already uploaded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileInitUploadResponse'
        '202':
          description: Accepted - Return upload URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileInitUploadResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - token: []
components:
  schemas:
    FileInitUploadRequest:
      properties:
        name:
          type: string
          title: Name
          description: Name of the file.
        size:
          type: integer
          title: Size
          description: Size of the file in bytes.
        digest:
          type: string
          pattern: ^[a-zA-Z0-9_+.-]+:[a-fA-F0-9]+$
          title: Digest
          description: Digest of the file.
        projectId:
          type: string
          title: Projectid
          description: ID of the project the file belongs to.
      type: object
      required:
        - name
        - size
        - digest
        - projectId
      title: FileInitUploadRequest
      description: Initiate file upload request.
    FileInitUploadResponse:
      properties:
        fileId:
          type: string
          title: Fileid
          description: ID of the file.
        uploadUrl:
          anyOf:
            - type: string
            - type: 'null'
          title: Uploadurl
          description: Upload URL of the file. `None` if the file is already uploaded.
        aws:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Aws
          description: AWS fields to be uploaded with file.
      type: object
      required:
        - fileId
      title: FileInitUploadResponse
      description: Initiate file upload response.
    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:
    token:
      type: http
      description: >-
        When using Friendli Suite API for inference requests, you need to
        provide a **Personal API Key** for authentication and authorization
        purposes.


        For more detailed information, please refer
        [here](https://friendli.ai/docs/openapi/introduction#authentication).
      scheme: bearer

````