Send files from another application
An external application can put files into AgentData the same way a user does in Documents → Folders & automation. A file sent this way behaves exactly like an uploaded one: the folder's Images and Tabular settings decide what happens next (extraction, or staging for Excel/CSV), and its retention and the tenant Trash apply.
Every call runs as a real user in one project, and that user is recorded as the file's uploader.
Get access
Recommended — the user signs in. Your application sends the user to AgentData's sign-in page (OAuth 2.1 with PKCE). The user signs in with their own account — email and password, Google, or Microsoft (when the workspace uses Microsoft sign-in) — and approves the permissions. Your application then receives a token that acts as that user, in one project.
- Register your application once:
POST /oauth/registerwithclient_nameand yourredirect_uris. - Send the user to
/oauth/authorizewithresponse_type=code,client_id,redirect_uri, a PKCEcode_challenge(S256),scope=files:read files:write, and optionallyproject=<project id>(otherwise the user's default project is used). - Exchange the returned code at
POST /oauth/token(grant_type=authorization_code, with yourcode_verifier). Use the refresh token to get new access tokens; the project stays the same.
The user must have access to the project, and the token can never do more than the user can. Every file is recorded under that user.
Alternative — a personal key. For a server-to-server integration, a user can create a project-bound API key in Conversation → Query → Connect (MCP) with files:read and files:write (keys with documents:write also work). Keep keys and tokens on your application's server side — never in browser code or a board widget.
Set it up in the Agent designer
An administrator can give an app its own, limited access with a File (external app) node in Agents:
- Drag File (external app) onto the canvas and select it.
- Choose the folder the app sends files to, what it may do (upload, process, read status and results) and the app's sign-in return address.
- Click Create File object. AgentData registers the app and shows its App ID, the app secret (shown once — store it on the app's server), the sign-in and token addresses, and a ready-to-use snippet.
People signing in through that app can reach only that folder (and its sub-folders) and only the chosen actions; the app can't ask for more. Activity lists every file received, who sent it and when. Revoke app stops it immediately — every token issued to it stops working. Connect the File node's output to a Document node to extract what arrives.
Find a folder
GET /api/files/v1/folders
Authorization: Bearer <key>
Each folder has an id, name, path, system (stored in AgentData) or external, writable, images, tabular, files and last_scanned. Every project has one root system folder.
Upload a file
POST /api/files/v1/folders/{folder_id}/files?name=hours.xlsx
Authorization: Bearer <key>
Idempotency-Key: <a unique id for this file, e.g. your item or attachment id>
<the raw file bytes>
- Accepted: PDF, PNG, JPEG, Excel (
.xlsx,.xlsm) and CSV, up to the configured size limit. - The answer gives the stored
path, thekindand — for spreadsheets in a folder with Tabular on — the staging runs it started (staged). - Retries are safe: sending the same
Idempotency-Keyagain returns the first answer (replayed: true) and never stores a second copy. Reusing a key for different content is refused (409). - Writable folders: system folders, and external folders whose connection allows AgentData to write (Connectors → Test shows Read / Write / Delete). SharePoint needs
Sites.ReadWrite.Alland Google Drive thedrivescope for that; on-prem connector folders can't receive files.
Follow files
GET /api/files/v1/folders/{folder_id}/files
POST /api/files/v1/folders/{folder_id}/scan
The file list shows each file's name, path, template (once identified), and when AgentData first discovered it (uploaded) and first saw its current version (changed). Scan re-reads the folder and stages new spreadsheets when Tabular is on.
Choose templates and folder settings
GET /api/files/v1/templates
PUT /api/files/v1/folders/{folder_id}/settings
templates lists image extraction templates and tabular (staging) templates. settings changes a folder like its card in Documents — send only what changes:
{ "images": true, "tabular": true, "image_template_id": "…", "tabular_template_id": 12,
"scanning": { "mode": "auto", "minutes": 10 } }
Scanning mode is manual, auto (every N minutes, 5 or more) or hourly (every N hours). Changing tabular settings needs a tenant administrator. Automatic image scanning needs an image template.
Process one file and read its result
POST /api/files/v1/folders/{folder_id}/files/process { "path": "inbox/hours.xlsx", "template_id": null }
GET /api/files/v1/folders/{folder_id}/files/status?path=inbox/hours.xlsx
GET /api/files/v1/folders/{folder_id}/files/result?path=inbox/hours.xlsx
- A spreadsheet is staged right away (with the given tabular template, or matched by header). Its status shows the staging run and counts; its result lists the error rows with their descriptions.
- A PDF or image is read first and then extracted with the given or the folder's image template; extraction starts automatically once reading has finished. Poll
status(reading, thenextraction), then fetchresultfor the extracted data. Document processing must be enabled for the tenant.
Use the file tools from an AI assistant (MCP)
The same operations are MCP tools on AgentData's MCP server, for assistants such as Claude or ChatGPT signed in with files:read / files:write: list_folders, list_files, file_templates, upload_file, request_upload_link, set_folder_settings, process_file, file_status, file_result.
upload_file takes small files (about 1 MB) as base64. For larger files, request_upload_link returns a short-lived, single-use URL: PUT the raw file bytes to it — no Authorization header is needed, and re-using the link never stores a second copy.
Errors
| Status | Meaning |
|---|---|
| 401 | Missing or invalid key or token, not bound to a user and project, or an expired upload link |
| 403 | The key lacks the needed permission, or the project isn't accessible |
| 409 | The folder can't receive files, or the Idempotency-Key was used for different content |
| 413 | The file is larger than allowed |
| 422 | Unsupported or empty file, or an invalid file name |