## Abort multipart upload

`POST /v1/storage/objects/multipart/abort`

Aborts an incomplete multipart upload session and frees the uploaded parts. For a first upload, the `PENDING` record is deleted. During replacement, the existing object and its previous content are preserved; only the session fields are cleared. Session state is cleared only after a successful abort or a storage response confirming that the exact `uploadId` is already absent. On a timeout, 5xx, throttling, or unknown abort error, the server retains the session for retry and returns `502 STORAGE_BUCKET_ERROR`. If finalization owns the session, abort returns `409 STORAGE_KEY_CONFLICT`: retry complete with the same `parts`; a journalled response finishes locally, while an unconfirmed outcome requires operator reconciliation. Aborted parts cannot be recovered.

## Request fields (body)

The request body is JSON.

| Parameter | Type | Required | Default | Description |
|----------|-----|:-----:|-----------|---------|
| `objectId` | string | yes | — | Object identifier obtained from the `/multipart/create` response |

## Examples

### curl — personal key

```bash
curl -X POST https://vibecode.bitrix24.com/v1/storage/objects/multipart/abort \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"objectId": "cmpfg012a01aco510mrr6u632"}'
```

### curl — OAuth application

```bash
curl -X POST https://vibecode.bitrix24.com/v1/storage/objects/multipart/abort \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"objectId": "cmpfg012a01aco510mrr6u632"}'
```

### JavaScript — personal key

```javascript
const res = await fetch(
  'https://vibecode.bitrix24.com/v1/storage/objects/multipart/abort',
  {
    method: 'POST',
    headers: {
      'X-Api-Key': 'YOUR_API_KEY',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ objectId: 'cmpfg012a01aco510mrr6u632' }),
  }
)
const { aborted } = await res.json()
console.log('Aborted:', aborted) // true
```

### JavaScript — OAuth application

```javascript
const res = await fetch(
  'https://vibecode.bitrix24.com/v1/storage/objects/multipart/abort',
  {
    method: 'POST',
    headers: {
      'X-Api-Key': 'YOUR_APP_KEY',
      'Authorization': 'Bearer USER_SESSION_TOKEN',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ objectId: 'cmpfg012a01aco510mrr6u632' }),
  }
)
const { aborted } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `aborted` | boolean | `true` on successful abort |

## Response example

```json
{
  "aborted": true
}
```

## Error response example

404 — the object was not found or the session is already finalized:

```json
{
  "success": false,
  "error": {
    "code": "STORAGE_OBJECT_NOT_FOUND",
    "message": "StorageObject cmpfg012a01aco510mrr6u632 not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 403 | `STORAGE_SCOPE_REQUIRED` | The API key lacks the `vibe:storage` scope |
| 401 | `STORAGE_NO_AUTH_CONTEXT` | The request was made without authorization |
| 400 | `STORAGE_INVALID_PATH` | The caller identifier contains invalid path characters |
| 400 | `STORAGE_OBJECT_ID_REQUIRED` | The `objectId` field was not provided |
| 404 | `STORAGE_OBJECT_NOT_FOUND` | The object with the given `objectId` was not found, does not belong to the current caller, or the session is already finalized |
| 409 | `STORAGE_KEY_CONFLICT` | If the address is briefly busy before finalization, retry abort after it is released. If finalization owns the session, retry complete with the same `parts`: a journalled response finishes locally, while an unconfirmed provider outcome requires operator reconciliation |
| 502 | `STORAGE_BUCKET_ERROR` | The provider abort was not confirmed, so the session was retained. Retry the same abort operation |
| 503 | `STORAGE_FEATURE_DISABLED` | Storage is disabled for the portal |
| 503 | `STORAGE_STS_UNAVAILABLE` | The temporary credentials issuance service is unavailable |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

**Incomplete sessions are processed automatically after 24 hours.** For a first upload, the `PENDING` row is deleted, while a replacement preserves the existing object and its previous content, but only after the provider abort is confirmed. If `/abort` returns `502 STORAGE_BUCKET_ERROR`, retry it: the cleanup obligation and `uploadId` were retained.

## See also

- [Upload](/docs/storage/upload)
- [Create multipart upload](/docs/storage/upload/multipart-create)
- [Complete multipart upload](/docs/storage/upload/multipart-complete)
- [Storage](/docs/storage)
