For AI agents: this page is also available as Markdown at https://docs.refabric.com/api-reference/platform/files/delete-a-file.md, and the index of every page is https://docs.refabric.com/llms.txt.
Platform API › Files
Delete a file
The file is deleted; after it its address answers 404.
DELETE
https://api.refabric.com/v1/files/{ref}import os
import requests
url = "https://api.refabric.com/v1/files/{ref}"
headers = {"Authorization": f"Key {os.environ['REFABRIC_API_KEY']}"}
response = requests.delete(url, headers=headers)
print(response.json()){
"file": "art:3f2a",
"deleted": true
}Important
- What is deleted: one produced file (
art:…). - What is NOT deleted: the record of the jobs that made or used it.
- An upload, a record or a library item answers
422 file_not_deletable.
Authentication. A key with files:write: deleting cannot be undone.
Common use cases
- Remove a produced image you no longer want to keep.
See also
GET /v1/files/{ref}
Authorization
Authorization: Key $REFABRIC_API_KEYScope: files:write
Parameters
Path parameters
- stringrequired
Header parameters
- stringoptional
The contract version you wrote against (a date). Absent: the current version.
format: date
- stringoptional
Your own id for this request; we answer it back under X-Client-Request-ID.
max length 128
Response
200 — Done: the answer is in the body.
- stringrequired
The file deleted.
Example:
art:3f2a - booleanrequired
Always
true.Values
true
Example:
true
- 401 — No valid API key was sent.
- 403 — Your key or your plan does not allow this.
- 404 — Nothing has this address.
- 422 — A field is missing or has a value this operation cannot use.
- 429 — Too many requests: wait for the number of seconds in the Retry-After header.
- 500 — Something went wrong on our side; retry, and quote the request id if it keeps happening.