Update upload expiry
Set, extend or clear a hosted upload's expiry.
Change when a hosted upload expires: pass a future ISO 8601 timestamp to set or extend the expiry, or null to make the file never expire. Extending also revives a file that expired recently — as long as its content is still in storage. Once the hourly cleanup has removed an expired file's content, the call answers 409 — upload the file again to get a new link.
PATCH /v3/uploads/{id}
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Required | The upload id returned by POST /v3/uploads — always starts with up_ (e.g. up_9f3KzQ7wXt2mB4hN). Find it with GET /v3/uploads or copy it from the Uploads screen. |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
expires_at | string (ISO 8601) or null | Required | New expiry (must be in the future), or null to never expire. |
Responses
| Status | Description |
|---|---|
200 | The updated upload object. |
400 | expires_at is not in the future. |
404 | No upload with this id on your account. |
409 | The file expired and its content was already removed — upload it again. |
Code examples
cURL
curl -X PATCH https://api.wemail.io/v3/uploads/{id} \
-H "Authorization: Bearer afn_live_…" \
-H "Content-Type: application/json" \
-d '{ "expires_at": "2027-01-01T00:00:00Z" }'Node.js
const res = await fetch("https://api.wemail.io/v3/uploads/{id}", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.WEMAIL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ "expires_at": "2027-01-01T00:00:00Z" }),
});
const data = await res.json();Python
import os, requests
r = requests.patch(
"https://api.wemail.io/v3/uploads/{id}",
headers={"Authorization": f"Bearer {os.environ['WEMAIL_API_KEY']}"},
json={ "expires_at": "2027-01-01T00:00:00Z" },
)
data = r.json()