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

ParameterTypeRequiredDescription
idstringRequiredThe 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

ParameterTypeRequiredDescription
expires_atstring (ISO 8601) or nullRequiredNew expiry (must be in the future), or null to never expire.

Responses

StatusDescription
200The updated upload object.
400expires_at is not in the future.
404No upload with this id on your account.
409The 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()