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

# Abort Upload

> Abort an in-progress direct-to-cloud upload and clean up its resources

## Overview

Abort an in-progress direct-to-cloud upload. The server invalidates the upload, releases any reserved storage, and discards any checkpointed `part_token`s.

Aborting an already-completed upload returns `409`. Use this endpoint when you can't or don't want to finish an upload — for example, when the source file is no longer available or the client crashed mid-upload.

## Path Parameters

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

## Response

The response body is empty when the abort succeeds.

<RequestExample>
  ```bash cURL theme={"system"}
  curl -X POST https://api.u1.archetypeai.app/v0.5/files/uploads/upl_1mehceg8cn80qsekh46143whrx/abort \
    -H "Authorization: Bearer $ATAI_API_KEY"
  ```

  ```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}/abort",
      headers={"Authorization": f"Bearer {api_key}"},
  )

  if response.ok:
      print(f"Upload aborted: {upload_id}")
  else:
      print(f"Error: {response.status_code} {response.text}")
  ```

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

  const response = await fetch(
    `https://api.u1.archetypeai.app/v0.5/files/uploads/${uploadId}/abort`,
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
      },
    }
  );

  if (response.ok) {
    console.log(`Upload aborted: ${uploadId}`);
  } else {
    console.error(`Error: ${response.status} ${await response.text()}`);
  }
  ```
</RequestExample>

<ResponseExample>
  ```text 200 - Success theme={"system"}
  (empty body)
  ```

  ```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 already 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 and cannot be aborted.",
        "suggestion": "Delete the resulting file via /files/delete/{file_id} if it should not be kept.",
        "error_uid": "err-xxxxxxxx"
      }
    ]
  }
  ```
</ResponseExample>
