Skip to main content

Change an object's expiry

Changes when an object expires, after it was uploaded. Use it when the content's lifetime grows, for example when a chat a person keeps holds the file. Available since backend 2026.10.25.3.

PATCH /api/v1/objects/{public_id}

Permission: write, with a key of the object's own project. Another project's object answers 404.

Request​

Send exactly one of:

FieldTypeNotes
expires_atISO 8601 date or nullA date in the future, or null to keep the object until it is deleted.
expires_in_daysinteger, 1–3650Counted from now.
curl
curl -X PATCH https://fileshub.zaions.com/api/v1/objects/01JDKQXXXXXXXXXXXXXXXXXXXXX \
-H "X-API-Key: fh_live_xxx" -H "Content-Type: application/json" \
-d '{"expires_at": "2027-01-01T00:00:00Z"}'

Response​

200 OK​

{
"data": {
"public_id": "01JDKQXXXXXXXXXXXXXXXXXXXXX",
"project_id": "01JDKPXXXXXXXXXXXXXXXXXXXXX",
"original_filename": "photo.jpg",
"visibility": "private",
"mime_type": "image/jpeg",
"size_bytes": 48213,
"url": "https://fileshub.zaions.com/api/v1/objects/01JDKQXXXXXXXXXXXXXXXXXXXXX",
"expires_at": "2027-01-01T00:00:00+00:00"
},
"message": "Updated"
}

Errors​

StatusWhen
401Missing or invalid key.
403The key has no write permission.
404No object with that id in the key's project, or it has already expired.
422Neither field sent, both sent, a date in the past, or expires_in_days out of range.

Each change is recorded in the project's audit log (object.expiry_changed, with the old and new dates).