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

# Delete files

> Delete one file or up to 100 files per request from Blob Storage with DELETE /v1/objects, with per-file results for batches.

<ParamField header="Authorization" type="string" placeholder="API Key" required>
  The API key for your account. You can find this in your [account settings](https://squarecloud.app/en/account/security).
</ParamField>

Delete removes one file, or up to **100 files** in a single request. A delete is immediate and final: the file stops being served and its space is freed from your quota. Requires the `blob:write` scope. Deleting doesn't need an active plan, so you can always clean up.

* **One id** (`object`, or `objects` with a single entry): answers `200` when deleted, `404 OBJECT_NOT_FOUND` when the file doesn't exist.
* **Two or more ids** (`objects`): always answers `200` with the result of each file, so one missing file doesn't fail the rest. Repeated ids count once.

An id that is malformed or belongs to another account fails the whole request with `400 INVALID_OBJECT`, before anything is deleted. To find the ids, use [Object List](/en/blob-reference/endpoint/list).

## Parameters

<ParamField body="object" type="string" placeholder="pub/3155597145698959364/images/logo.png">
  The id of the file to delete. Send `object` or `objects`.
</ParamField>

<ParamField body="objects" type="string[]">
  Up to 100 ids to delete in one request.
</ParamField>

## Rate limits

<Note>1000 files per 10 seconds, counted per file: a batch of 100 counts as 100. Past that the account is blocked for a short period (`RATE_LIMITED`, 429).</Note>

## Response

<ResponseField name="status" type="string">
  "success" if successful, "error" if not.
</ResponseField>

<ResponseField name="response" type="object">
  Present only for batches (two or more ids).

  <Expandable title="Toggle object">
    <ResponseField name="deleted" type="string[]">
      The ids that were deleted.
    </ResponseField>

    <ResponseField name="not_found" type="string[]">
      The ids that didn't exist.
    </ResponseField>

    <ResponseField name="failed" type="object[]">
      The ids that could not be deleted, each as `{ "id", "code" }`. Retry them.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash One file theme={"system"}
  curl --request DELETE \
    --url 'https://blob.squarecloud.app/v1/objects' \
    --header 'Authorization: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{ "object": "pub/3155597145698959364/images/logo_mugws5c0-9f86d081884c7d659a2feaa0c55ad015.png" }'
  ```

  ```bash Batch theme={"system"}
  curl --request DELETE \
    --url 'https://blob.squarecloud.app/v1/objects' \
    --header 'Authorization: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
      "objects": [
        "pub/3155597145698959364/images/logo_mugws5c0-9f86d081884c7d659a2feaa0c55ad015.png",
        "prv/3155597145698959364/images/draft_mugws5c0-1b4f0e9851971998e732078544c96b36.png",
        "pub/3155597145698959364/images/old.png"
      ]
    }'
  ```

  ```javascript JavaScript theme={"system"}
  const response = await fetch('https://blob.squarecloud.app/v1/objects', {
    method: 'DELETE',
    headers: {
      Authorization: 'YOUR_API_KEY',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ objects: ids.slice(0, 100) }),
  });
  ```
</RequestExample>

<ResponseExample>
  ```json One file theme={"system"}
  {
    "status": "success"
  }
  ```

  ```json Batch theme={"system"}
  {
    "status": "success",
    "response": {
      "deleted": [
        "pub/3155597145698959364/images/logo_mugws5c0-9f86d081884c7d659a2feaa0c55ad015.png",
        "prv/3155597145698959364/images/draft_mugws5c0-1b4f0e9851971998e732078544c96b36.png"
      ],
      "not_found": ["pub/3155597145698959364/images/old.png"],
      "failed": []
    }
  }
  ```
</ResponseExample>

## Errors

| Code | HTTP | When |
| - | - | - |
| `INVALID_BODY` | 400 | The body is missing or is not a JSON object. |
| `INVALID_OBJECT` | 400 | No id was sent, or an id is malformed or not yours. |
| `TOO_MANY_OBJECTS` | 400 | More than 100 ids. |
| `OBJECT_NOT_FOUND` | 404 | The file doesn't exist (single file). |
| `RATE_LIMITED` | 429 | More than 1000 files deleted in 10 seconds. |
| `DELETE_FAILED` | 500 | Storage failed and the file may still exist. Retry. |

## Related

* Blob SDK: [`blob.delete()`](/en/sdks/blob/objects)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.