Files

Give an agent information to use in its replies: text, web pages or documents (PDF, Word, Excel, PowerPoint, Markdown, CSV, HTML and images). Create a file or upload a document, then connect it to the agents that need it. Each file is stored and processed once in the workspace.

Quick example

import { readFileSync } from "node:fs";

// Up to 1 MiB goes inline; from 1 to 50 MiB the SDK opens the upload session itself
const file = await platic.files.createFile({
  data: readFileSync("./prices.pdf"),
  fileName: "prices.pdf",
  attachment: { agentId },
});

const job = await platic.agents.files.waitForJob(agentId, file.fileId, file.uploadId);
// With job.status === "ready", the agent already uses it

What you need to know

  • They apply live: connecting, pausing or scheduling or editing a file takes effect immediately, without publishing the agent. Editing a file changes the content for every agent that uses it; pausing or scheduling it affects only that agent.
  • Background processing (202): creating, replacing or reprocessing opens a processing (uploadId) that goes through awaiting_upload -> queued -> parsing -> chunking -> embedding -> ready or failed. If you create it with attachment.agentId, the connection starts paused and activates by itself when it reaches ready (activateOnReady: true). While a replacement is processing, agents keep using the previous version.
  • AI-generated names: if you omit title or description, Platica generates them automatically when it finishes processing the content (you can also ask for a proposal without saving with Suggest metadata).
  • Up-to-date pages: a url file can re-read itself every 6, 12, 24, 48, 72, 168, 336 or 720 hours (refresh.intervalHours).
- **Size:** text up to 1 MiB; documents up to 1 MiB in base64 with [Create a file](/api-reference/files/create), or up to 50 MiB with [Upload a file](/api-reference/files/upload). - **Workspace:** at most 30 simultaneous processing jobs, 1,000 files and 3 GiB of storage. - **Validity:** download links, 5 min; `confirmationToken` to [delete](/api-reference/files/delete), 10 min. Scheduling up to 366 days. - **Permissions:** listing, creating without an agent, connecting and deleting require **Integrations**. Creating with `attachment.agentId`, pausing, scheduling or disconnecting only require being able to edit that agent.

Endpoints

MethodEndpointWhat it does
GET/v1/filesList the workspace's files
POST/v1/filesCreate from text, a web page or a document (up to 1 MiB)
POST/v1/files/uploadOpen an upload session for a document (1 to 50 MiB)
GET/v1/files/{fileId}Get metadata, text (content), download or affectedAgents
PATCH/v1/files/{fileId}Change title, description, refresh or replace content
POST/v1/files/{fileId}/reprocessRe-read the page or the original file
POST/v1/files/{fileId}/metadata/suggestionSuggest a title and description with AI without saving
DELETE/v1/files/{fileId}Delete from the workspace and from all agents
GET/v1/files/{fileId}/jobs/{uploadId}Read a processing's state

To connect, pause, schedule or disconnect files of a specific agent, go to Agent files.

The error codes (FILE_JOB_IN_PROGRESS, FILE_NOT_READY, STORAGE_LIMIT_EXCEEDED, QUOTA_EXCEEDED, CONFLICT) are in Errors and the tools for AI assistants are in the Files MCP tools.

Document formats

pdf, doc, docx, xls, xlsx, ppt, pptx, rtf, html, htm, csv, tsv, txt, md, markdown, jpg, jpeg, png, gif, bmp, tif, tiff, webp