Skip to main content
PATCH
/
v3
/
files
/
{id}
Update a file's expiry
curl --request PATCH \
  --url https://api.opper.ai/v3/files/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "ttl_seconds": 123
}
'
import requests

url = "https://api.opper.ai/v3/files/{id}"

payload = { "ttl_seconds": 123 }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({ttl_seconds: 123})
};

fetch('https://api.opper.ai/v3/files/{id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "bytes": 123,
  "created_at": "2023-11-07T05:31:56Z",
  "expires_at": "2023-11-07T05:31:56Z",
  "filename": "<string>",
  "id": "<string>",
  "mime_type": "<string>",
  "object": "file",
  "purpose": "<string>",
  "status": "<string>"
}
{
  "error": {
    "code": "<string>",
    "message": "<string>",
    "details": "<unknown>"
  },
  "meta": {}
}
{
  "error": {
    "code": "<string>",
    "message": "<string>",
    "details": "<unknown>"
  },
  "meta": {}
}
See the Files guide.

Authorizations

Authorization
string
header
required

API key authentication. Pass your API key as a Bearer token.

Path Parameters

id
string
required

File ID (file_…)

Body

application/json
ttl_seconds
integer
required

Positive integer (max 3153600000

Response

Successful response

bytes
integer
created_at
string<date-time>
expires_at
string<date-time>
filename
string
id
string

file_… id

mime_type
string
object
string
Example:

"file"

purpose
string
status
string