Skip to main content
POST
/
serverless
/
files
/
file
/
local
/
{target_path}
Upload local file (multipart/form-data)
curl --request POST \
  --url https://api.fal.ai/v1/serverless/files/file/local/{target_path} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'file_upload=<unknown>'
import requests

url = "https://api.fal.ai/v1/serverless/files/file/local/{target_path}"

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_upload\"\r\n\r\n<unknown>\r\n-----011000010111000001101001--"
headers = {
"Authorization": "<api-key>",
"Content-Type": "multipart/form-data"
}

response = requests.post(url, data=payload, headers=headers)

print(response.text)
const form = new FormData();
form.append('file_upload', '<unknown>');

const options = {method: 'POST', headers: {Authorization: '<api-key>'}};

options.body = form;

fetch('https://api.fal.ai/v1/serverless/files/file/local/{target_path}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
true
{
"error": {
"type": "validation_error",
"message": "Invalid request parameters"
}
}
{
"error": {
"type": "authorization_error",
"message": "Authentication required"
}
}
{
"error": {
"type": "rate_limited",
"message": "Rate limit exceeded"
}
}
{
"error": {
"type": "server_error",
"message": "An unexpected error occurred"
}
}

Authorizations

Authorization
string
header
required

API key must be prefixed with "Key ", e.g. Authorization: Key YOUR_API_KEY

Path Parameters

target_path
string
required

Target path (including filename)

Example:

"datasets/images/cat.jpg"

Query Parameters

unzip
boolean | null
default:false

If true and the uploaded file is a ZIP, it will be extracted

Example:

false

Body

multipart/form-data
file_upload
any

Binary file content

Response

Upload completed

Indicates whether the operation was successful