Update a file

SDK platic.files.update()

Change a file’s title or description, refresh a page automatically or replace its content. Send at least one field. The change reaches all agents that use the file.

Before changing it, check which agents use it with Get a file and include=affectedAgents.

Example

await platic.files.update("file_123", { title: "Prices 2027" });

Path parameters

ParameterTypeDescriptionRequired
fileIdstringThe file✓

Request body

Send at least one field. With replacement it is a replacement; without it, a data change.

Rename

{
  "title": "Return policies 2026",
  "description": "Deadlines, conditions and exceptions for returning a product. Use it when people ask about exchanges or refunds."
}

Keep a page up to date

Only for url files. It re-reads the page every that many hours, for all the agents that use it:

{ "refresh": { "intervalHours": 168 } }

To turn it off:

{ "refresh": null }

Replace the content

The new content is processed and, in the meantime, agents keep using the previous one. You can rename in the same change:

{
  "title": "Service hours",
  "replacement": {
    "type": "text",
    "text": "We are open Monday to Saturday from 9:00 to 19:00."
  }
}

With another page:

{ "replacement": { "type": "url", "url": "https://acme.com/help/returns" } }

With a document up to 1 MiB (file) or a larger one (upload, which answers with an address to upload it to, like Upload a file):

{
  "replacement": {
    "type": "upload",
    "fileName": "returns-manual-2026.pdf",
    "contentType": "application/pdf",
    "byteSize": 8126464
  }
}
FieldTypeDescription
titlestringNew name, 1 to 200 characters.
descriptionstringNew description, up to 1024 characters.
refreshobject | nullOnly in url files, without replacement. { "intervalHours": N } with N in 6, 12, 24, 48, 72, 168, 336 or 720; null turns it off. On another type it answers 422.
replacementobjectThe new content. A single type:
replacement.typestringtext, url, file (base64 up to 1 MiB) or upload (up to 50 MiB).
replacement.textstringWith text: up to 1 MiB.
replacement.urlstringWith url: public, http or https.
replacement.fileName, replacement.contentTypestringWith file and upload.
replacement.contentBase64stringWith file.
replacement.byteSizeintegerWith upload: the exact size in bytes, from 1 to 52,428,800.

Inside replacement, the fields of its type are required.

Response

Data change

200 OK with the file:

{
  "status": "success",
  "data": {
    "fileId": "fH3kL9mQ2xR7",
    "title": "Return policies",
    "description": "Deadlines, conditions and exceptions for returning a product.",
    "kind": "url",
    "lifecycle": "available",
    "activeVersionId": "vr_2Lp9Qs",
    "pipelineStatus": "ready",
    "latestUploadId": "up_4Tn8Vb2Kc1",
    "attachmentCount": 2,
    "createdAt": "2026-10-30T16:02:11.000Z",
    "updatedAt": "2026-11-01T11:20:03.000Z",
    "sourceUrl": "https://acme.com/policies/returns",
    "refresh": {
      "intervalHours": 168,
      "nextRunAt": "2026-11-08T11:20:03.000Z",
      "lastRunAt": "2026-11-01T10:12:45.000Z",
      "lastResult": "unchanged",
      "lastError": null
    },
    "tags": [],
    "fileName": null,
    "contentType": null,
    "byteSize": 3420
  }
}

The fields are those of Get a file.

Replacement

202 Accepted, like Create a file but with link: null (connections do not change). With upload it also has upload next to data, like Upload a file:

{
  "status": "success",
  "data": {
    "accepted": true,
    "fileId": "fH3kL9mQ2xR7",
    "uploadId": "up_7Wc2Np4Lz8",
    "link": null,
    "statusUrl": "/v1/files/fH3kL9mQ2xR7/jobs/up_7Wc2Np4Lz8"
  }
}

Read the processing until terminal is true. With ready, all agents that had the connection active use the new content. With failed, they keep the previous one.

Errors

Statusdetails.codeWhen
400INVALID_INPUTYou sent no field, mixed types in replacement or a value is not valid.
403RESOURCE_NOT_ACCESSIBLEYou do not have Integrations nor can you edit all the agents that use it.
409FILE_JOB_IN_PROGRESSThere is already an open processing on this file. Wait for it to finish.
410FILE_DELETEDThe file was already deleted.
413SIZE_LIMIT_EXCEEDEDThe replacement is over the limit (1 MiB inline or 50 MiB in upload).
422INVALID_INPUTrefresh on a file that is not url (details.fields: ["refresh"]).
422INVALID_CONTENT_TYPEThe replacement document's type is not supported or does not match.
429QUOTA_EXCEEDEDReplacement with 30 open processings in the workspace.
429STORAGE_LIMIT_EXCEEDEDThe workspace reached its storage limit.

The ones that apply to all operations are in common errors.

Notes

  • In the SDK: use platic.files.update(fileId, ...) to change title, description or refresh, and platic.files.replace(fileId, ...) to replace content (if you pass a document over 1 MiB, the SDK opens the upload session automatically).
  • Replacing changes the type. The file takes the type of the new content. Replacing it with another page (url) changes sourceUrl and keeps refresh. Replacing it with text or a document removes sourceUrl and refresh: it is no longer read from the page.
  • There is no history. The previous content is discarded when the new one is ready. To go back, replace it again.
  • A title or description you set replaces the AI-generated one and no longer changes by itself.
  • To re-read the same page or the same document, without changing it, use Reprocess a file.