API referenceFilesUpdate a file

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

HeaderRequiredValue
AuthorizationYesBearer <key>: a private inference key (sk_live_...). See Authentication.
Content-TypeYesapplication/json

Path parameters

ParameterTypeDescription
file_idstringStarts with file_.

Body parameters

ParameterTypeRequiredNotes
expires_atinteger or nullNoUnix 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).
filenamestringNoUp 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"
}
FieldTypeDescription
expires_atinteger or nullThe new expiry. A file.expired webhook event fires at this time.
filenamestringThe 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:

StatustypecodeWhen
400invalid_request_errorinvalid_expiryLess than one hour or more than 365 days away.
409conflict_errorfile_in_useShortening the expiry of a file a running batch reads is refused until the batch ends.
404not_found_errorfile_not_foundNo file with this id in the key’s workspace.
401authentication_errorinvalid_api_keyThe key is missing, unknown, revoked or expired.
429rate_limit_errorrate_limitedToo many requests; wait for Retry-After. See Rate-limit headers.
Was this page helpful?