---
title: "Initiate file upload"
method: POST
path: "/beta/file"
tags: ["File"]
---

# Initiate file upload

`POST /beta/file`

## Request

- Base URL: `https://api.friendli.ai`
- URL: `https://api.friendli.ai/beta/file`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/friendli/apis/friendli-suite-api-reference/docs/beta/file/post.ts> (a function with typed inputs; its response is checked against the schema)

Initiate file upload.

## Headers

- `X-Friendli-Team` string, nullable: ID of team to run requests as (optional parameter).

## Request body

- FileInitUploadRequest: Initiate file upload request.
  - `name` string, required: Name of the file.
  - `size` integer, required: Size of the file in bytes.
  - `digest` string, required: Digest of the file.
  - `projectId` string, required: ID of the project the file belongs to.

## Response `200`

OK - File is already uploaded.

- FileInitUploadResponse: Initiate file upload response.
  - `fileId` string, required: ID of the file.
  - `uploadUrl` string, nullable: Upload URL of the file. `None` if the file is already uploaded.
  - `aws` object, nullable: AWS fields to be uploaded with file.

## Other responses

- `202`: Accepted - Return upload URL.
- `422`: Validation Error

---

[API](https://skmtc.dev/friendli/apis/friendli-suite-api-reference.md) - [All operations](https://skmtc.dev/friendli/apis/friendli-suite-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/friendli/apis/friendli-suite-api-reference/revisions/38fb43993a11?raw)
