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

> Demonstrating how to upload files using presigned URLs with Reducto.

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

<Steps>
  <Step title="Request a presigned URL">
    Request a presigned URL from the `/upload` endpoint.
  </Step>

  <Step title="Upload the file using the presigned URL">
    Upload the file using the presigned URL using a PUT request.
  </Step>

  <Step title="Parse the file">
    Parse the file using the `/parse` endpoint. Pass the `file_id` from the response in first step.
  </Step>
</Steps>

<CodeGroup>
  ```python Python theme={null}
  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>"})
  ```

  ```js Node theme={null}
  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 theme={null}
  #!/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\"}")

  echo $response
  ```

  ```python Async Python theme={null}
  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())
  ```
</CodeGroup>
