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

> ## Agent Instructions
> Start with /introduction/getting-started. Use the Direct Query API (POST /query) with the Newton Fusion model (text, image, and video reasoning) or the Newton Omega encoder (time-series embeddings). ATAI_API_ENDPOINT must include the version path: /v0.5 for most APIs, /v0.6 for the Fine-Tuning Service. Pages whose descriptions are marked (Archived) document the legacy Lens runtime — do not use them for new projects.

# Generate Upload Part URLs

> Request fresh presigned URLs for specific parts of an in-progress upload

## Overview

Generate presigned URLs for specific parts of an in-progress upload. Use this when a presigned URL returned from [Initiate Upload](./initiate-upload) is about to expire and the part has not yet been uploaded.

For each requested part, the response may contain either a freshly generated URL or a previously issued one that is not close to expiration; `expires_at` always reflects the URL actually returned.

The response's `parts` array has the same length and order as the request's `part_numbers`. Duplicate part numbers in the request produce duplicate entries in the response that share a single presigned URL.

<Note>
  Part numbers are 1-based — the first part of an upload is `1`, not `0`.
</Note>

## Path Parameters

<ParamField path="upload_id" type="string" required>
  Upload identifier returned by [Initiate Upload](./initiate-upload)
</ParamField>

## Request Body

<ParamField body="part_numbers" type="array" required>
  1-based part numbers to generate presigned URLs for. Each entry must be in range for the upload (`1 ≤ part_number ≤ num_parts`).
</ParamField>

## Response

<ResponseField name="parts" type="array">
  One descriptor per entry in `part_numbers`, in the same order

  <Expandable title="part properties">
    <ResponseField name="part_number" type="integer">
      1-based part index
    </ResponseField>

    <ResponseField name="url" type="string">
      Presigned URL the client should `PUT` the part bytes to
    </ResponseField>

    <ResponseField name="offset" type="integer">
      Byte offset into the file where this part begins
    </ResponseField>

    <ResponseField name="length" type="integer">
      Length of the part in bytes
    </ResponseField>

    <ResponseField name="expires_at" type="string">
      ISO 8601 timestamp at which the presigned URL expires
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl -X POST https://api.u1.archetypeai.app/v0.5/files/uploads/upl_1mehceg8cn80qsekh46143whrx/parts/urls \
    -H "Authorization: Bearer $ATAI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "part_numbers": [43, 44, 45]
    }'
  ```

  ```python Python theme={"system"}
  import requests
  import os

  api_key = os.environ.get("ATAI_API_KEY")
  upload_id = "upl_1mehceg8cn80qsekh46143whrx"

  response = requests.post(
      f"https://api.u1.archetypeai.app/v0.5/files/uploads/{upload_id}/parts/urls",
      headers={
          "Authorization": f"Bearer {api_key}",
          "Content-Type": "application/json",
      },
      json={"part_numbers": [43, 44, 45]},
  )

  for part in response.json()["parts"]:
      print(f"part {part['part_number']}: expires {part['expires_at']}")
  ```

  ```javascript JavaScript theme={"system"}
  const uploadId = "upl_1mehceg8cn80qsekh46143whrx";

  const response = await fetch(
    `https://api.u1.archetypeai.app/v0.5/files/uploads/${uploadId}/parts/urls`,
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ part_numbers: [43, 44, 45] }),
    }
  );

  const { parts } = await response.json();
  for (const p of parts) {
    console.log(`part ${p.part_number}: expires ${p.expires_at}`);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={"system"}
  {
    "parts": [
      {
        "part_number": 43,
        "url": "https://storage.example.com/upload/upl_1mehceg8cn80qsekh46143whrx/43?X-Amz-Signature=...",
        "offset": 352321536,
        "length": 8388608,
        "expires_at": "2026-04-28T16:18:42Z"
      },
      {
        "part_number": 44,
        "url": "https://storage.example.com/upload/upl_1mehceg8cn80qsekh46143whrx/44?X-Amz-Signature=...",
        "offset": 360710144,
        "length": 8388608,
        "expires_at": "2026-04-28T16:18:42Z"
      },
      {
        "part_number": 45,
        "url": "https://storage.example.com/upload/upl_1mehceg8cn80qsekh46143whrx/45?X-Amz-Signature=...",
        "offset": 369098752,
        "length": 8388608,
        "expires_at": "2026-04-28T16:18:42Z"
      }
    ]
  }
  ```

  ```json 400 - Invalid request theme={"system"}
  {
    "errors": [
      {
        "code": "invalid_upload_parts",
        "message": "Part numbers must be non-empty and within [1, num_parts].",
        "suggestion": "Check the parts/part_numbers array in your request",
        "error_uid": "err-xxxxxxxx"
      }
    ]
  }
  ```

  ```json 401 - Unauthorized theme={"system"}
  {
    "errors": [
      {
        "code": "unauthorized_request",
        "message": "Unauthorized or invalid access.",
        "suggestion": "Provide valid authentication credentials and ensure they have the required permissions.",
        "error_uid": "err-xxxxxxxx"
      }
    ]
  }
  ```

  ```json 404 - Upload not found theme={"system"}
  {
    "errors": [
      {
        "code": "upload_not_found",
        "message": "No upload with the given upload_id was found for the organization.",
        "suggestion": "Verify the upload_id and that the upload has not been completed or aborted.",
        "error_uid": "err-xxxxxxxx"
      }
    ]
  }
  ```

  ```json 409 - Upload already completed theme={"system"}
  {
    "errors": [
      {
        "code": "upload_already_completed",
        "message": "Upload has already been completed; no further URLs can be generated.",
        "suggestion": "Use the file_id returned by /complete to operate on the file.",
        "error_uid": "err-xxxxxxxx"
      }
    ]
  }
  ```
</ResponseExample>
