Skip to content

Upload API

Uploads a file as an attachment to a session.

Method POST
Endpoint /apps/<AppID>/environments/<EnvName>/attachments/upload
Content-type multipart/form-data
Authorization Header x-api-key: <API-KEY>

Path Parameters

Fields Description
AppID Unique Identifier for the app.
EnvName Name of the environment to be used for the agent.

Request Parameters (form-data)

Fields Description Mandatory
File The actual file to be uploaded. Yes
userReference User reference Yes
uploadType Specifies the context of the upload. Set this to ‘runtime’. Yes

Sample Request

Example Curl Command

curl --location 'http://&lt;agentplatformdomain>/api/v2/apps/{appId}/environments/{envName}/attachments/upload' \
--header 'x-api-key: your-x-api-key \
--form 'file=@"/path/to/file/file.pdf"' \
--form 'userReference="your-session-reference”' \
--form 'uploadType="runtime"'

Response

Each uploaded file is assigned a unique file ID, which is returned in response along with other details of the file, such as name, path, size, extension, etc.

Sample response

{
  "fileId": "f-a84242a9-9d9f-4590-8622-59cd93c7f7c3",
  "fileName": "myfile.pdf",
  "filePath": "AppFileSystem/f-a84242a9-9d9f-4590-8622-59cd93c7f7c3.pdf",
  "fileSize": 62996,
  "mimeType": "application/pdf",
  "extension": "pdf",
  "uploadedAt": "2025-04-23T12:05:45.782Z"
}

Note

  • Currently, only files in PDF format are supported.
  • Users can upload a maximum of two files, with each file size limited to 5 MB.
  • Content within images embedded in PDFs is not processed for contextual understanding.