Skip to main content
POST
/
serverless
/
files
/
file
/
url
/
{file}
Upload file from URL
curl --request POST \
  --url https://api.fal.ai/v1/serverless/files/file/url/{file} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "https://example.com/cat.jpg"
}
'
import requests

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

payload = { "url": "https://example.com/cat.jpg" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://example.com/cat.jpg'})
};

fetch('https://api.fal.ai/v1/serverless/files/file/url/{file}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
true
{
"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

file
string
required

Target file path (including filename)

Example:

"datasets/images/cat.jpg"

Body

application/json

Upload a file from a URL into the target path

url
string<uri>
required

Publicly accessible URL for the file

Response

Upload initiated

Indicates whether the operation was successful