Create a file
Add content by sending type and the fields for that type: text, a web page or a base64 document up to 1 MiB. For larger documents, use Upload a file.
With attachment.agentId the file is connected to that agent and activates by itself when its content is ready. Without attachment, it stays in the workspace with no agents.
Example
curl -X POST "https://api.platic.ai/v1/files" \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "text",
"text": "We ship in five business days."
}' await platic.files.createText({ text: "We ship in five business days." }); Request body
From text, connected to an agent:
{
"type": "text",
"title": "Service hours",
"text": "We are open Monday to Friday from 9:00 to 18:00 and on Saturdays from 10:00 to 14:00.",
"attachment": { "agentId": "Xq8mTe2LwP4kZ1aB9cDf" }
} From a web page, without a title (Platica sets one with AI) and checking it every day:
{
"type": "url",
"url": "https://acme.com/policies/returns",
"refresh": { "intervalHours": 24 },
"attachment": { "agentId": "Xq8mTe2LwP4kZ1aB9cDf" }
} From a small document:
{
"type": "file",
"title": "Price list",
"fileName": "prices.pdf",
"contentType": "application/pdf",
"contentBase64": "JVBERi0xLjcKJcfsj6IK..."
} | Field | Type | Description | Required |
|---|---|---|---|
type | string | text, url or file | ✓ |
title | string | 1 to 200 characters. Without it, Platica sets a provisional one and then one with AI (see automatic names). | - |
description | string | Up to 1024 characters: what it is about and when to consult it. Empty or omitted, it is generated with AI. | - |
text | string | With text: the content, up to 1 MiB. | * |
url | string | With url: the page, public, http or https, up to 4096 characters. | * |
refresh | object | null | With url: { "intervalHours": 24 } re-reads it every that many hours (6, 12, 24, 48, 72, 168, 336 or 720). Without it, it does not update by itself. | - |
fileName | string | With file: the name with extension, for example prices.pdf. | * |
contentType | string | With file: the type, for example application/pdf. | * |
contentBase64 | string | With file: the bytes in base64, up to 1 MiB. | * |
attachment | object | { "agentId": "..." } connects the file to that agent. | - |
attachment.activateOnReady | boolean | If you send it, true. The connection always activates when processing finishes; false answers 422. | - |
* Depending on type, only its fields go and all of them are required: sending fields of another type answers 400.
Response
202 Accepted. Processing continues in the background:
{
"status": "success",
"data": {
"accepted": true,
"fileId": "fH3kL9mQ2xR7",
"uploadId": "up_4Tn8Vb2Kc1",
"link": {
"agentId": "Xq8mTe2LwP4kZ1aB9cDf",
"fileId": "fH3kL9mQ2xR7",
"state": "paused",
"attachedAt": "2026-11-01T10:00:00.000Z",
"activateOnReady": true,
"schedule": null
},
"statusUrl": "/v1/agents/Xq8mTe2LwP4kZ1aB9cDf/files/fH3kL9mQ2xR7/jobs/up_4Tn8Vb2Kc1"
}
} Response fields
| Field | Type | Description |
|---|---|---|
accepted | boolean | Always true: the request was accepted. It does not say it is already processed. |
fileId | string | The new file. |
uploadId | string | This processing. |
link | object | null | With attachment: the connection just created, paused, with the fields of List agent files. Without attachment, null. |
statusUrl | string | Where to read the processing: the agent's route with attachment, the file's route without it. |
Afterwards
- Read the processing (or the
statusUrl) every few seconds untilterminalistrue. - With
status: "ready"the content is ready and, if you connected it to an agent, the connection is already active. - With
status: "failed",errorsays why. The connection stays paused; fix the source and replace it or retry.
Errors
| Status | details.code | When |
|---|---|---|
400 | INVALID_INPUT | A field is missing, one of another type is extra or a value is not valid; for example, a text or a base64 over 1 MiB. details.fields names them. |
403 | RESOURCE_NOT_ACCESSIBLE | Without attachment: Integrations is missing. With attachment: you cannot edit that agent. |
404 | AGENT_NOT_FOUND | The agent in attachment does not exist. |
413 | SIZE_LIMIT_EXCEEDED | The request is too large. For documents over 1 MiB, use Upload a file. |
422 | ACTIVATION_POLICY_MISMATCH | You sent attachment.activateOnReady: false. |
422 | INVALID_CONTENT_TYPE | The type is not supported or does not match the document. |
429 | QUOTA_EXCEEDED | There are already 30 open processings in the workspace. Wait a few minutes. |
429 | STORAGE_LIMIT_EXCEEDED | The workspace reached its file or storage limit. |
The ones that apply to all operations are in common errors.
Notes
- In the SDK there is one method per type:
platic.files.createText(...),platic.files.createUrl(...)andplatic.files.createFile(...)(the last one also handles documents over 1 MiB automatically). - If you send the
Idempotency-Keyheader and repeat the same request after a network cut, the API returns the samefileIdanduploadIdwithout duplicating the file.
A file created with attachment lives in the workspace: other agents can use it with Connect a file, and changing it changes it for all of them.