# Create a presigned upload URL for a mount file

**Documentation:** /reference/api-reference/tool-router/postToolRouterSessionBySessionIdMountsByMountIdUploadUrl

Generates a presigned upload URL for uploading a file to a workbench session mount. The caller should PUT the file content directly to the returned URL.

---

## POST `/api/v3/tool_router/session/{session_id}/mounts/{mount_id}/upload_url`

**Endpoint:** `https://backend.composio.dev/api/v3/tool_router/session/{session_id}/mounts/{mount_id}/upload_url`

**Summary:** Create a presigned upload URL for a mount file

Generates a presigned upload URL for uploading a file to a workbench session mount. The caller should PUT the file content directly to the returned URL.

### Authentication

**ApiKeyAuth** - API Key in `header` header `x-api-key` OR **UserApiKeyAuth** - API Key in `header` header `x-user-api-key`

### Path Parameters

- `session_id` (string (toolRouterSessionId)) *(required)*: The unique identifier of the tool router session
- `mount_id` (string) *(required)*: ID of the storage mount

### Request Body

**Schema:**

- `mount_relative_path` (string) *(required)*: Supports subdirectories (e.g. "data/output.csv", "images/charts/chart.png")
- `mimetype` (string): MIME type of the file being uploaded

**Example:**

```json
{
  "mount_relative_path": "string",
  "mimetype": "string"
}
```

### Responses

#### 201 - Upload URL created successfully

**Response Schema:**

- `upload_url` (string) *(required)*: Presigned upload URL — PUT the file content here
- `mount_relative_path` (string) *(required)*: Relative file path within the mount (e.g. "report.pdf")
- `sandbox_mount_prefix` (string) *(required)*: Absolute mount path inside the sandbox (e.g. /mnt/files)
- `expires_at` (string) *(required)*: ISO 8601 timestamp when the upload URL expires

**Example Response:**

```json
{
  "upload_url": "string",
  "mount_relative_path": "string",
  "sandbox_mount_prefix": "string",
  "expires_at": "string"
}
```

#### 400 - Bad request

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 401 - Unauthorized

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 404 - Session or mount not found

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 500 - Internal server error

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

### Example cURL Request

```bash
curl -X POST "https://backend.composio.dev/api/v3/tool_router/session/string/mounts/string/upload_url" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mount_relative_path": "string",
    "mimetype": "string"
  }'
```