Files
Upload an image
Stores an image you send as the request body, with no multipart encoding: curl --data-binary @photo.jpg. PNG, JPEG or WebP, up to 4 MB; the type is read from the bytes. Pass the returned ID in a model’s input. Send videos and sounds through POST /v1/uploads instead.
Needs an API key with the generations:write scope.
POST
https://api.tryleap.ai
/
v1
/
files
Upload an image
curl --request POST \
--url https://api.tryleap.ai/v1/files \
--header 'Content-Type: image/png' \
--header 'x-api-key: <api-key>' \
--data '<string>'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'image/png'},
body: '<string>'
};
fetch('https://api.tryleap.ai/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tryleap.ai/v1/files"
payload = "<string>"
headers = {
"x-api-key": "<api-key>",
"Content-Type": "image/png"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text){
"id": "file_3Kd9Qm2Xr7Lp4Vn8Tc1Wb6Ys",
"object": "file",
"content_type": "image/jpeg",
"bytes": 1843210,
"width": 1200,
"height": 1600,
"duration": null,
"filename": "grandma-1962.jpg",
"url": "https://api.tryleap.ai/files/eyJrIjoibWVkaWEvb3V0cHV0cy9nZW5fN0hxMm1WeDlMcjRLcDhUbjNXYzZZYjFEIn0",
"created_at": "2026-10-04T18:20:03.441Z"
}Authorizations
ApiKeyBearer
Your workspace API key, leap_.... Create one at https://app.tryleap.ai/go/api, and keep it on your server.
Query Parameters
Body
image/pngimage/jpegimage/webp
The image itself.
The body is of type file.
Response
The stored file.
A photo, video or sound stored in your workspace, to pass as a model input.
When it was stored.
Pattern:
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$⌘I
Upload an image
curl --request POST \
--url https://api.tryleap.ai/v1/files \
--header 'Content-Type: image/png' \
--header 'x-api-key: <api-key>' \
--data '<string>'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'image/png'},
body: '<string>'
};
fetch('https://api.tryleap.ai/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tryleap.ai/v1/files"
payload = "<string>"
headers = {
"x-api-key": "<api-key>",
"Content-Type": "image/png"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text){
"id": "file_3Kd9Qm2Xr7Lp4Vn8Tc1Wb6Ys",
"object": "file",
"content_type": "image/jpeg",
"bytes": 1843210,
"width": 1200,
"height": 1600,
"duration": null,
"filename": "grandma-1962.jpg",
"url": "https://api.tryleap.ai/files/eyJrIjoibWVkaWEvb3V0cHV0cy9nZW5fN0hxMm1WeDlMcjRLcDhUbjNXYzZZYjFEIn0",
"created_at": "2026-10-04T18:20:03.441Z"
}