Upload files to your organization and manage them. Member and admin keys can use every endpoint on this page. See files for how runs mount them.
The file object
idstringfile_9c41d2a07be35f1e8a6c0d4b9e2f7a13.namestringguides/refunds.md.sizeintegercontent_typestringcreated_attimestampsourcestringupload, or output for a file a run saved.run_idstringrun_pathstringkeepbooleanexpires_attimestamp | nullUpload a file
/v1/filesmultipart/form-data.filefilerequirednamestringexpires_in_daysintegerkeepbooleantrue to keep the file whatever the retention policy says.curl $EPHEMERAL_URL/v1/files \
-H "Authorization: Bearer $EPHEMERAL_API_KEY" \
-F file=@refunds.md \
-F name=guides/refunds.mdThe response is 201 Created with the file object. Uploading again under an existing name adds a new file with a new ID; the older upload is kept.
{
"id": "file_9c41d2a07be35f1e8a6c0d4b9e2f7a13",
"name": "guides/refunds.md",
"size": 18234,
"content_type": "text/plain; charset=utf-8",
"created_at": "2026-10-03T08:02:17.553Z"
}List files
/v1/filescursor, a list of the newest limit files. With cursor, one page with items and next_cursor; pass next_cursor as cursor, with the same filters, for the next page, until it is empty.run_idstringsourcestringupload or output.prefixstringruns/run_abc/.limitintegercursorstringnext_cursor of the previous page.Download a file
/v1/files/{id}curl $EPHEMERAL_URL/v1/files/file_9c41d2a07be35f1e8a6c0d4b9e2f7a13 \
-H "Authorization: Bearer $EPHEMERAL_API_KEY" -o refunds.mdChange a file
/v1/files/{id}namestringexpires_in_daysintegerexpires_attimestampkeepbooleanuse_policybooleanThe response is the file object. Workflows that refer to the file by its old name stop finding it, while references by ID keep working.
Delete a file
/v1/files/{id}204 No Content. Takes an ID.Queued runs that reference the file fail when they start, and later runs that name it fail at creation with 400. If an older upload with the same name exists, references by name resolve to that one instead.
Storage and retention
/v1/storageusageobjectfiles, file_bytes, state_entries, state_bytes, stores and total_bytes.policyobjectoutput_file_days, upload_file_days and state_days, each a number of days or null for no limit.limitsobjectbillingobjectstorage_micros_per_gb_month, state_write_micros, owed_micros, owed_since and delete_after (when something is owed), unbilled_writes, unbilled_storage_micros, charged_last_30_days_micros and writes_refused./v1/storage/policynull to keep; a field you leave out keeps its current value. It applies to what is stored now as well as later; older items are deleted within minutes. A file's own expiry or keep setting, and an entry's ttl_seconds, take precedence.curl -X PUT $EPHEMERAL_URL/v1/storage/policy \
-H "Authorization: Bearer $EPHEMERAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"output_file_days": 30, "upload_file_days": null, "state_days": 90}'On the hosted service, GET /v1/me also returns storage_micros_per_gb_month and state_write_micros, and storage_owed_micros when anything is owed. While $0.01 or more is owed, saving files, run outputs and state is refused with 402. See storage billing.
State
Key-value stores that runs share. See state for the idea. A store name is letters, digits, dot, dash and underscore; a key is up to 512 bytes of text, URL-encoded in the path; a value is any JSON up to 1 MiB.
/v1/state{"items": [{ "store", "entries", "bytes", "updated_at" }]}./v1/state/{store}prefix, cursor and limit. Returns {"store", "items": [{ "store", "key", "version", "size", "created_at", "updated_at", "expires_at" }], "has_more", "next_cursor"}./v1/state/{store}{"deleted_entries": 12}./v1/state/{store}/entries/{key}value and version./v1/state/{store}/entries/{key}valueany JSONrequiredttl_secondsintegerif_versioninteger0 means only if it does not exist. A mismatch returns 409./v1/state/{store}/entries/{key}?if_version= deletes it only at that version./v1/state/{store}/entry?key=key query parameter instead of the path: GET, PUT and DELETE take the same bodies and give the same answers. Use it for keys that contain slashes, or two in a row, such as URLs.Each write costs $0.01 per 1,000 writes on the hosted service; reads are free.