# Cancel Upload Group

> Part of the [SpatialGen API documentation](/index.md). [HTML version of this page](/api/direct-upload/cancel/).

Cancel a direct upload group and mark all files as canceled.

## API context

-   API requests use `https://spatialgen.com` with the `/api` path prefix, included once.
-   Authenticate requests to SpatialGen API endpoints with the `X-SPATIALGEN-APPKEY` HTTP header.
-   Use a key from the workspace that owns the requested resources. Follow the roles and scopes specified for each endpoint below.
-   Keep `admin` and `upload` keys on a trusted backend. `readonly` keys may be used in client apps for permitted read operations.
-   Presigned upload URLs have their own authorization. Do not send your SpatialGen API key to those URLs.

See the [API key guide](/guides/get-started.md) for roles, key creation, expiration, revocation, and rotation.

* * *

**DELETE** `/api/videos/uploads/{uploadSessionId}`

Cancel the full direct upload group. This endpoint does not cancel one file at a time. All active files in the group are marked canceled together.

Allowed API Key Roles

`admin`, `upload`

## Route Parameters

-   `uploadSessionId`: string UUID for the upload group

## Request Body

No request body.

## Behavior Notes

-   Cancels the entire upload group.
-   Attempts to abort any active multipart uploads in the group.
-   Marks every file in the group as `canceled`.
-   Recomputes the group state so the upload group is also marked `canceled`.

## Response Shape

-   `sessionId`: string
-   `status`: string
-   `canceledAt`: string or `null`
-   `fileCount`: number
-   `canceledFileCount`: number

## Example Request

cancel-upload.js

```js
fetch('https://spatialgen.com/api/videos/uploads/5ea97a59-95e0-4c8b-a634-b0fa9976f6ff', {
  method: 'DELETE',
  headers: {
    'X-SPATIALGEN-APPKEY': apiKey,
  },
})
```

## Example Response

cancel-response.json

```json
{
  "sessionId": "5ea97a59-95e0-4c8b-a634-b0fa9976f6ff",
  "status": "canceled",
  "canceledAt": "2026-04-29T19:02:14.000Z",
  "fileCount": 5,
  "canceledFileCount": 5
}
```
