---
title: "Presigned URL Upload method"
description: "Demonstrating how to upload files using presigned URLs with Reducto."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.reducto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Presigned URL Upload method

This is useful if direct uploads exceed the maximum 100MB limit. With this method, you can upload files up to 5GB.

1. **Request a presigned URL**

   Request a presigned URL from the `/upload` endpoint.
2. **Upload the file using the presigned URL**

   Upload the file using the presigned URL using a PUT request.
3. **Parse the file**

   Parse the file using the `/parse` endpoint. Pass the `file_id` from the response in first step.

**Python**

```python
import requests

upload_form = requests.post("https://platform.reducto.ai/upload",
                            headers={"Authorization": "Bearer <auth token>"}).json()

requests.put(upload_form["presigned_url"], data=open("./local.pdf", "rb"))

response = requests.post("https://platform.reducto.ai/parse",
                         json={"input": upload_form["file_id"]},
                         headers={"Authorization": "Bearer <auth token>"})
```

**Node**

```js
const fetch = require("node-fetch");
const fs = require("fs");

const uploadForm = await fetch("https://platform.reducto.ai/upload", {
  method: "POST",
  headers: {
    Authorization: "Bearer <auth token>",
  },
}).then((res) => res.json());

await fetch(uploadForm.presigned_url, {
  method: "PUT",
  body: fs.readFileSync("./local.pdf"),
});

const response = await fetch("https://platform.reducto.ai/parse", {
  method: "POST",
  headers: {
    Authorization:
    "Bearer <auth token>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ input: uploadForm.file_id }),
}).then((res) => res.json());
```

**Bash**

```bash
#!/bin/bash

# Step 1: Get the presigned URL and file_id for uploading
upload_form=$(curl -s -X POST "https://platform.reducto.ai/upload"  -H "Authorization: Bearer $REDUCTO_API_TOKEN")
presigned_url=$(echo $upload_form | jq -r '.presigned_url')
file_id=$(echo $upload_form | jq -r '.file_id')

# Step 2: Upload the file using the presigned URL
curl --request PUT --upload-file local.pdf $presigned_url

echo "File uploaded!"

# Step 3: Send the parse request
response=$(curl -s -X POST "https://platform.api.reducto.ai/parse" \
     -H "Authorization: Bearer $REDUCTO_API_TOKEN" \
     -H "Content-Type: application/json" \
     -d "{\"input\":\"$file_id\",\"settings\":{\"model\":\"r-1\"}}")

echo $response
```

**Async Python**

```python
import asyncio
import aiohttp

async with aiohttp.ClientSession() as session:
  async with session.post(
    "https://platform.reducto.ai/upload",
    headers={"Authorization": f"Bearer {api_key}"}
  ) as response:
    if response.status != 200:
      raise Exception(
        f"Reducto upload http request failed - {response.status}"
      )

      response_data = await response.json()
      presigned_url = response_data["presigned_url"]


      async with session.put(
        presigned_url,  
        data=power_point_bytes,
        headers={'Content-Type': ''}

      ) as response:
        if response.status != 200:
          raise Exception(
            f"Reducto upload http request failed - {response.status}"
          )
          async with session.post(
            "https://platform.reducto.ai/parse",
            json={"input": response_data["file_id"]},
            headers={"Authorization": f"Bearer {api_key}"}
          ) as response:
            if response.status != 200:
              raise Exception(
                f"Reducto parse http request failed - {response.status}"
              )
              print(await response.json())
```

Source: https://docs.reducto.ai/recipes/presigned-url-upload-method/index.mdx
