> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Managing Uploads

[Back to API List](https://koreai.mintlify.site/agent-platform/v1/apis.md)

## 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**

```json theme={null}
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](https://koreai.mintlify.site/agent-platform/v1/agents/agentic-apps/settings/app-configurations).

## Delete File

Deletes an uploaded file.

| Method | DELETE |
| :- | :- |
| Endpoint | `/apps/<AppID>/environments/<EnvName>/attachments/<fileId>` |
| 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. |
| fileId | Unique identifier of the file to be deleted. |

### Request Parameters

| Fields | Description | Mandatory |
| :- | :- | :- |
| sessionId | Unique Identifier of the session | No |
| sessionReference | Reference associated with the session | No |

#### 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"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.