Skip to main content
Back to API List

Upload API

Uploads a file as an attachment to a session.
MethodPOST
Endpoint/apps/<AppID>/environments/<EnvName>/attachments/upload
Content-typemultipart/form-data
Authorization Headerx-api-key: <API-KEY>

Path Parameters

FieldsDescription
AppIDUnique Identifier for the app.
EnvNameName of the environment to be used for the agent.

Request Parameters (form-data)

FieldsDescriptionMandatory
FileThe actual file to be uploaded.Yes
userReferenceUser referenceYes
uploadTypeSpecifies the context of the upload. Set this to ‘runtime’.Yes
Sample Request Example Curl Command
curl --location 'http://{host}/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"
}
Refer to this to learn more about supported file types and file size limits.

Delete File

Deletes an uploaded file.
MethodDELETE
Endpoint/apps/<AppID>/environments/<EnvName>/attachments/<fileId>
Content-typemultipart/form-data
Authorization Headerx-api-key: <API-KEY>

Path Parameters

FieldsDescription
AppIDUnique Identifier for the app.
EnvNameName of the environment to be used for the agent.
fileIdUnique identifier of the file to be deleted.

Request Parameters

FieldsDescriptionMandatory
sessionIdUnique Identifier of the sessionNo
sessionReferenceReference associated with the sessionNo

Sample Request

{
  // Provide session ID or reference to uniquely identify the session. 
  "sessionId": "string", // Enum: "sessionId" | "sessionReference" 
  "sessionReference": "string" 
}

Sample Response

{
  "message": "file deleted successfully",
  "success": "true",
  "fileId": "f-a84242a9-9d9f-4590-8622-59cd93c7f7c3"
}