When your agent needs to work with files (submitting a PDF to a form, importing a spreadsheet, or uploading an image) you upload them first and then reference them by fileId in your tasks.
Files can be uploaded in two modes:
Upload to an Environment (Persistent)
Include environmentId in the form data to attach the file permanently to an environment. Any session using that environment can access the file at any time.
Response:
Upload Without an Environment (Orphan)
Omit environmentId to upload a standalone file. It is automatically deleted after 1 hour unless promoted to an environment.
An orphan file is automatically promoted to an environment when you pass its fileId in a session or task that also includes an environmentId. Once the session runs, the file is persisted to that environment and won’t expire.
Upload Response Fields
Uploading Multiple Files
Repeat the files field to upload several files in one request:
Using Files in a Session
Reference uploaded files by fileId when starting a task. Pass them in the files array alongside environmentId to use the environment’s browser profile and persist orphan files at the same time.
With /start/run-task
With /start/start-session
Include files inside the task object:
With /start/send-message
Include files in the message object when sending a newTask action:
Complete Example
Upload an orphan file, then run a task with an environment; the file gets persisted automatically:
Managing Environment Files
List or delete files attached to an environment using the Environments API:
Endpoint Reference