Endpoints
Files
Every picture and video the API makes is saved as a file in your Rend Library, with a permanent file id. List your API files, get a fresh link to one, download it or delete it.
GEThttps://rend.ai/api/v1/files
GEThttps://rend.ai/api/v1/files/{id}
GEThttps://rend.ai/api/v1/files/{id}/content
DELETEhttps://rend.ai/api/v1/files/{id}
Where results go
- Your Library. Each result lands in a Library folder named
API, or thefolderyou send, and shows in the app like any file. Its tags includeapiand anytagsyou send; its description is the prompt. Folders are one level deep, so"folder": "Clients/Acme"makes a folder namedClients/Acme. - A project, if you name one. Send
projectwith one of your project ids and the file is also added to that project’s media. Projects shared with you are refused before anything is charged. - Links last 24 hours. Every
urlis a signed link that works for 24 hours (url_expires_at). Get the file again for a fresh one; thefile_idnever changes. - How long files are kept. On a paid plan, or with storage added (a storage pack or pay-as-you-go storage), API files stay until you delete them and count toward your storage like any file. On the free plan they are deleted 24 hours after they are made. Send
"store": falseto have any file deleted after 24 hours. If your storage is full, the result is still delivered, kept for 24 hours, and the reply says so instorage_note. expires_atis when the file will be deleted, ornullwhile you keep it.
List files
GEThttps://rend.ai/api/v1/files
Your API files, newest first. Files you deleted, here or in the app, are left out.
| Query | Type | Description |
|---|---|---|
limit |
integer | 1 to 100. Default 20. |
after |
string | A file id from the last page, for the next page. |
type |
string | image or video. |
project |
string | Only files added to this project. |
folder |
string | Only files in this Library folder. |
has_more says whether another page follows; pass last_id as after to get it.
curl "https://api.rend.ai/v1/files?type=image&limit=10" \
-H "Authorization: Bearer $REND_API_KEY"import os, requests
headers = {"Authorization": f"Bearer {os.environ['REND_API_KEY']}"}
page = requests.get("https://api.rend.ai/v1/files", headers=headers, params={"type": "image", "limit": 10}).json()
for file in page["data"]:
print(file["id"], file["filename"], file["expires_at"])const response = await fetch("https://api.rend.ai/v1/files?type=image&limit=10", {
headers: { Authorization: `Bearer ${process.env.REND_API_KEY}` },
});
const page = await response.json();
for (const file of page.data) console.log(file.id, file.filename, file.expires_at);{
"object": "list",
"data": [{
"id": "file_3f9a0c1d2b7e4a6f8c0d1e2f",
"object": "file",
"type": "image",
"status": "stored",
"filename": "a-red-bicycle-against-a-yellow-wall.png",
"bytes": 1843210,
"content_type": "image/png",
"model": "rend-image",
"prompt": "A red bicycle against a yellow wall",
"size": "1024x1536",
"tags": ["bicycle"],
"project": null,
"folder": "API",
"source": "api",
"request_id": "img-6c1f...",
"key": "Production",
"created_at": 1796500000,
"expires_at": null,
"url": "https://rend.ai/api/media/...?grant=...",
"url_expires_at": 1796586400,
"library_url": "https://rend.ai/studio/library/folder%3A..."
}],
"first_id": "file_3f9a0c1d2b7e4a6f8c0d1e2f",
"last_id": "file_3f9a0c1d2b7e4a6f8c0d1e2f",
"has_more": false
}Get a file
GEThttps://rend.ai/api/v1/files/{id}
The file’s details and a fresh 24-hour url. A video’s file also has seconds and video_id. A deleted file has status: "deleted" and no url.
Download a file
GEThttps://rend.ai/api/v1/files/{id}/content
Redirects to the file. A deleted file returns a 410 with code file_deleted.
Delete a file
DELETEhttps://rend.ai/api/v1/files/{id}
Moves the file to Recently deleted in the app, where it can be restored for 7 days, and takes it out of any project it was added to. A file placed in an edit is refused with a 409 (file_in_use); remove it from the edit first.
curl -L https://api.rend.ai/v1/files/file_3f9a0c1d2b7e4a6f8c0d1e2f/content \
-H "Authorization: Bearer $REND_API_KEY" -o picture.png
curl -X DELETE https://api.rend.ai/v1/files/file_3f9a0c1d2b7e4a6f8c0d1e2f \
-H "Authorization: Bearer $REND_API_KEY"file = requests.get("https://api.rend.ai/v1/files/file_3f9a0c1d2b7e4a6f8c0d1e2f", headers=headers).json()
open("picture.png", "wb").write(requests.get(file["url"]).content)
requests.delete("https://api.rend.ai/v1/files/file_3f9a0c1d2b7e4a6f8c0d1e2f", headers=headers)const auth = { Authorization: `Bearer ${process.env.REND_API_KEY}` };
const file = await (await fetch("https://api.rend.ai/v1/files/file_3f9a0c1d2b7e4a6f8c0d1e2f", { headers: auth })).json();
const bytes = Buffer.from(await (await fetch(file.url)).arrayBuffer());
await fetch("https://api.rend.ai/v1/files/file_3f9a0c1d2b7e4a6f8c0d1e2f", { method: "DELETE", headers: auth });{ "id": "file_3f9a0c1d2b7e4a6f8c0d1e2f", "object": "file", "deleted": true }Errors
| Status | Code | Why |
|---|---|---|
| 400 | (none) | A bad limit, type or after. The message says which. |
| 404 | file_not_found |
No file with that id on your account. |
| 409 | file_in_use |
The file is placed in an edit, so it can’t be deleted yet. |
| 410 | file_deleted |
/content for a file that was deleted. |
| 503 | (none) | Files are briefly unavailable. Try again shortly. |