Update a file
⚠️
Preview — this feature is being built; the design below is the spec.
PATCH https://app.syntic.ai/v1/files/{file_id}Change a file’s expiry or display name. Use it to keep a tool output or an uploaded document longer than its default expiry, or to make a file expire sooner once you no longer need it. The bytes, purpose and id never change.
For how this fits into a full workflow, see Files API.
Headers
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer <key>: a private inference key (sk_live_...). See Authentication. |
Content-Type | Yes | application/json |
Path parameters
| Parameter | Type | Description |
|---|---|---|
file_id | string | Starts with file_. |
Body parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
expires_at | integer or null | No | Unix seconds, at least one hour from now and at most 365 days from now. null keeps the file until you delete it (counts toward storage quota). |
filename | string | No | Up to 255 characters. Does not change the content type. |
Response
200 OK, Content-Type: application/json
{
"id": "file_01JBW9Q6RZ",
"object": "file",
"filename": "lease.pdf",
"purpose": "document",
"bytes": 482113,
"mime_type": "application/pdf",
"created_at": 1791820800,
"expires_at": 1797091200,
"status": "ready",
"source": "upload",
"workspace_id": "wrkspc_01JC0A2C4E6G8J0L2N4Q"
}| Field | Type | Description |
|---|---|---|
expires_at | integer or null | The new expiry. A file.expired webhook event fires at this time. |
filename | string | The display name. |
Examples
curl -sS -X PATCH "https://app.syntic.ai/v1/files/file_01JC3D5F7H9K1M3P5R7T" \
-H "Authorization: Bearer $SYNTIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"expires_at": 1797091200
}'Errors
Errors use the error envelope and carry a request_id. Codes specific to this operation:
| Status | type | code | When |
|---|---|---|---|
| 400 | invalid_request_error | invalid_expiry | Less than one hour or more than 365 days away. |
| 409 | conflict_error | file_in_use | Shortening the expiry of a file a running batch reads is refused until the batch ends. |
| 404 | not_found_error | file_not_found | No file with this id in the key’s workspace. |
| 401 | authentication_error | invalid_api_key | The key is missing, unknown, revoked or expired. |
| 429 | rate_limit_error | rate_limited | Too many requests; wait for Retry-After. See Rate-limit headers. |
Was this page helpful?