# Create presigned URL for request file upload to S3

**Documentation:** /reference/api-reference/files/postFilesUploadRequest

Generates a presigned URL for uploading a file to S3. This endpoint handles deduplication by checking if a file with the same MD5 hash already exists.

---

## POST `/api/v3/files/upload/request`

**Endpoint:** `https://backend.composio.dev/api/v3/files/upload/request`

**Summary:** Create presigned URL for request file upload to S3

Generates a presigned URL for uploading a file to S3. This endpoint handles deduplication by checking if a file with the same MD5 hash already exists.

### Authentication

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

### Request Body

**Schema:**

- `toolkit_slug` (string) *(required)*: Slug of the app where this file belongs to. Example: "gmail", "slack", "github"
- `tool_slug` (string) *(required)*: Slug of the action where this file belongs to. Example: "GMAIL_SEND_EMAIL", "SLACK_UPLOAD_FILE"
- `filename` (string) *(required)*: Name of the original file. Example: "quarterly_report.pdf"
- `mimetype` (string) *(required)*: Mime type of the original file. Example: "application/pdf", "image/png"
- `md5` (string) *(required)*: MD5 hash of the file for deduplication and integrity verification. Example: "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6"

**Example:**

```json
{
  "toolkit_slug": "string",
  "tool_slug": "string",
  "filename": "string",
  "mimetype": "string",
  "md5": "string"
}
```

### Responses

#### 200 - Successfully created upload URL for request file

**Response Schema:**

- `id` (string) *(required)*: ID of the request file. Example: "req_file_9mZn4qR8sXwT"
- `key` (string) *(required)*: Object storage upload location. Example: "projects/prj_xyz789/requests/slack/SLACK_UPLOAD_FILE/document_9mZn4q.docx"
- `new_presigned_url` (string) *(required)*: Presigned URL for upload. Example: "https://storage.composio.dev/projects/prj_xyz789/requests/slack/document_9mZn4q.docx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=3600..."
- `newPresignedUrl` (string) *(required)*: [DEPRECATED] Use new_presigned_url instead. Presigned URL for upload. Example: "https://storage.composio.dev/projects/prj_xyz789/requests/slack/document_9mZn4q.docx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=3600..."
- `type` (enum: "new") *(required)*: [DEPRECATED] Indicates this is a new file that needs to be uploaded
- `metadata` (object) *(required)*
  - `storage_backend` (enum: "s3" | "azure_blob_storage") *(required)*: Storage backend used for the file. If this is azure, use `x-ms-blob-type` header to set the blob type to `BlockBlob` while uploading the file

**Example Response:**

```json
{
  "id": "string",
  "key": "string",
  "new_presigned_url": "string",
  "newPresignedUrl": "string",
  "type": "new",
  "metadata": {
    "storage_backend": "s3"
  }
}
```

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

#### 403 - Forbidden

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

#### 410 - Gone

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

#### 429 - Too Many Requests

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

#### 501 - Not Implemented

**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/files/upload/request" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "toolkit_slug": "string",
    "tool_slug": "string",
    "filename": "string",
    "mimetype": "string",
    "md5": "string"
  }'
```