# Recompute the storage breakdown

POST

/v2/workspaces/{workspace\_id}/storage/breakdown

```bash
curl --request POST \
  --url https://api.app.layer.ai/api/v2/workspaces/:workspace_id/storage/breakdown \
  --header 'Authorization: Bearer <token>'
```

```python
import requests


url = "https://api.app.layer.ai/api/v2/workspaces/:workspace_id/storage/breakdown"


headers = {"Authorization": "Bearer <token>"}


response = requests.post(url, headers=headers)


print(response.json())
```

```js
const url = 'https://api.app.layer.ai/api/v2/workspaces/:workspace_id/storage/breakdown';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};


try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main


import (
  "fmt"
  "net/http"
  "io"
)


func main() {


  url := "https://api.app.layer.ai/api/v2/workspaces/:workspace_id/storage/breakdown"


  req, _ := http.NewRequest("POST", url, nil)


  req.Header.Add("Authorization", "Bearer <token>")


  res, _ := http.DefaultClient.Do(req)


  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)


  fmt.Println(res)
  fmt.Println(string(body))


}
```

```php
<?php


$curl = curl_init();


curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.app.layer.ai/api/v2/workspaces/:workspace_id/storage/breakdown",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>"
  ],
]);


$response = curl_exec($curl);
$err = curl_error($curl);


curl_close($curl);


if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

```java
OkHttpClient client = new OkHttpClient();


Request request = new Request.Builder()
  .url("https://api.app.layer.ai/api/v2/workspaces/:workspace_id/storage/breakdown")
  .post(null)
  .addHeader("Authorization", "Bearer <token>")
  .build();


Response response = client.newCall(request).execute();
```

```ruby
require 'uri'
require 'net/http'


url = URI("https://api.app.layer.ai/api/v2/workspaces/:workspace_id/storage/breakdown")


http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true


request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'


response = http.request(request)
puts response.read_body
```

```csharp
var client = new RestClient("https://api.app.layer.ai/api/v2/workspaces/:workspace_id/storage/breakdown");
var request = new RestRequest("", Method.Post);
request.AddHeader("Authorization", "Bearer <token>");
var response = client.Execute(request);
```

* Layer API

> **Unchanged from v1.** This endpoint’s documented request and response schemas are identical in v1 and v2 — change the `/v1` prefix to `/v2`. Schema equality is not a promise about behavior, so keep your usual smoke tests.

Ask for the workspace’s storage breakdown to be computed afresh. Answers at once with the breakdown as it stands and `is_breakdown_computing` true; read the storage again to see the new one. A request while a breakdown is computing, or before `breakdown_recompute_available_at` (15 minutes after the last was computed), is ignored and answers with the breakdown as it stands. Requires settings admin.

## Authorizations

* **[bearerAuth](/docs/v2/rest-api#bearerauth)**
* **[oauth2](/docs/v2/rest-api#oauth2)**
* **[serviceAccount](/docs/v2/rest-api#serviceaccount)**  
workspace:write

## Parameters 

### Path Parameters

**workspace\_id**

required

_Workspace ID_

ID of the workspace that owns the resource.

string format: uuid

ID of the workspace that owns the resource.

### Header Parameters

**Idempotency-Key**

string

<= 255 characters

Opaque key making a retry of this request return the first result. A 2xx response is replayed for 24 hours with `Idempotent-Replayed: true`. A 4xx releases the key. A 5xx, or a request still running, holds the key for 120 seconds, during which a retry gets 409; after that a retry executes again. The key covers the method, path, query, and byte-identical body it was first used with; reusing it for a different request is rejected with 422\. Protection is best effort: if the key store is unavailable, or a record is lost early, a retry can execute again even after an earlier 409\. See the Idempotency section of the API description.

## Responses 

### 202

Successful Response

_WorkspaceStorageOutput_object

**used\_bytes**

required

_Used Bytes_

Bytes the workspace stores now: a live count.

integer

**quota\_bytes**

required

_Quota Bytes_

The most the workspace may store; null when it has no limit.

integer

nullable

**breakdown**

required

Any of:

**StorageBreakdownOutput**

_StorageBreakdownOutput_object

**total\_files**

required

_Total Files_

Stored files when the breakdown was computed.

integer

**total\_bytes**

required

_Total Bytes_

Bytes those files hold.

integer

**by\_origin**

required

_By Origin_

Generated and uploaded files.

Array<object>

_StorageSliceOutput_object

**key**

required

_Key_

What the slice is: an origin (`generated`, `uploaded`), a content category (`image`, `video`, …), an age (`under_30_days`, `30_to_90_days`, `90_to_365_days`, `over_1_year`), a project id (`none` for files in no project) or a member’s principal id. Null for the slice that totals everything not listed.

string

nullable

**label**

required

_Label_

What to call the slice.

string

**files**

required

_Files_

Files in the slice.

integer

**bytes**

required

_Bytes_

Bytes those files hold.

integer

**by\_category**

required

_By Category_

Files by content category, most bytes first.

Array<object>

_StorageSliceOutput_object

**key**

required

_Key_

What the slice is: an origin (`generated`, `uploaded`), a content category (`image`, `video`, …), an age (`under_30_days`, `30_to_90_days`, `90_to_365_days`, `over_1_year`), a project id (`none` for files in no project) or a member’s principal id. Null for the slice that totals everything not listed.

string

nullable

**label**

required

_Label_

What to call the slice.

string

**files**

required

_Files_

Files in the slice.

integer

**bytes**

required

_Bytes_

Bytes those files hold.

integer

**by\_age**

required

_By Age_

Files by age, youngest first.

Array<object>

_StorageSliceOutput_object

**key**

required

_Key_

What the slice is: an origin (`generated`, `uploaded`), a content category (`image`, `video`, …), an age (`under_30_days`, `30_to_90_days`, `90_to_365_days`, `over_1_year`), a project id (`none` for files in no project) or a member’s principal id. Null for the slice that totals everything not listed.

string

nullable

**label**

required

_Label_

What to call the slice.

string

**files**

required

_Files_

Files in the slice.

integer

**bytes**

required

_Bytes_

Bytes those files hold.

integer

**by\_project**

required

_By Project_

The projects holding the most, then the rest together, then files in no project. A file in several projects counts in each.

Array<object>

_StorageSliceOutput_object

**key**

required

_Key_

What the slice is: an origin (`generated`, `uploaded`), a content category (`image`, `video`, …), an age (`under_30_days`, `30_to_90_days`, `90_to_365_days`, `over_1_year`), a project id (`none` for files in no project) or a member’s principal id. Null for the slice that totals everything not listed.

string

nullable

**label**

required

_Label_

What to call the slice.

string

**files**

required

_Files_

Files in the slice.

integer

**bytes**

required

_Bytes_

Bytes those files hold.

integer

**by\_member**

required

_By Member_

The members who created the most, then everyone else together.

Array<object>

_StorageSliceOutput_object

**key**

required

_Key_

What the slice is: an origin (`generated`, `uploaded`), a content category (`image`, `video`, …), an age (`under_30_days`, `30_to_90_days`, `90_to_365_days`, `over_1_year`), a project id (`none` for files in no project) or a member’s principal id. Null for the slice that totals everything not listed.

string

nullable

**label**

required

_Label_

What to call the slice.

string

**files**

required

_Files_

Files in the slice.

integer

**bytes**

required

_Bytes_

Bytes those files hold.

integer

**largest\_files**

required

_Largest Files_

The largest stored files, largest first.

Array<object>

_StoredFileOutput_object

**file\_id**

required

_File ID_

ID of the file.

string format: uuid

**name**

required

_Name_

The file’s name.

string

**content\_type**

required

_Content Type_

The file’s MIME type.

string

**content\_category**

required

_FileContentCategory_

What kind of asset the file is.

string

Allowed values: image video mesh audio pose safetensors playable spine font world pbr\_materials landing\_page other

**origin**

required

_StoredFileOrigin_

Whether a generation produced the file or a person uploaded it.

string

Allowed values: generated uploaded

**size\_bytes**

required

_Size Bytes_

Bytes the file holds.

integer

**created\_at**

required

_Created At_

When the file was created.

string format: date-time

**created\_by\_name**

required

_Created By Name_

Who created the file, when known.

string

nullable

**deleted\_at**

required

_Deleted At_

When the file was deleted; set in the trash only.

string format: date-time

nullable

**deleted\_by\_name**

required

_Deleted By Name_

Who deleted the file; null for an automatic delete.

string

nullable

**null**

null

**breakdown\_computed\_at**

required

_Breakdown Computed At_

When the breakdown was computed. It trails `used_bytes`, which is live.

string format: date-time

nullable

**is\_breakdown\_computing**

required

_Is Breakdown Computing_

Whether a fresh breakdown is being computed.

boolean

**breakdown\_recompute\_available\_at**

required

_Breakdown Recompute Available At_

When a fresh breakdown can next be asked for: 15 minutes after the last was computed. Null when it can be now.

string format: date-time

nullable

##### Example

```json
{
  "breakdown": {
    "largest_files": [
      {
        "content_category": "image",
        "origin": "generated"
      }
    ]
  }
}
```

### 401

Unauthenticated — missing or invalid Bearer token.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description.",
  "error_code": "ERROR_CODE",
  "field": "tileability"
}
```

### 403

Forbidden — insufficient permissions, or the access token lacks the scope the operation requires.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description.",
  "error_code": "ERROR_CODE",
  "field": "tileability"
}
```

### 404

Resource not found.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description.",
  "error_code": "ERROR_CODE",
  "field": "tileability"
}
```

### 409

The outcome of the request with this `Idempotency-Key` is not known yet: it is still running, or it failed without a stored response. Retry after the number of seconds in `Retry-After`.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description.",
  "error_code": "ERROR_CODE",
  "field": "tileability"
}
```

### 422

Invalid input parameters, or an `Idempotency-Key` reused for a different request.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description.",
  "error_code": "ERROR_CODE",
  "field": "tileability"
}
```

### 429

Rate limited — retry after the number of seconds in `Retry-After`.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description.",
  "error_code": "ERROR_CODE",
  "field": "tileability"
}
```

### 500

Internal server error.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

**error\_code**

required

Machine-readable error code: the last path segment of `type`.

string

**field**

The request field the error is about, by its name in the body (on a tool run, in `input`), on the errors that name one: so far the value a Layer tool fixes on an `INFERENCE_TOOL_PIN_MISMATCH`, and the scale factor on an `INFERENCE_TOOL_UPSCALE_COPIES_SOURCE`. Absent otherwise, even when `detail` names a field.

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description.",
  "error_code": "ERROR_CODE",
  "field": "tileability"
}
```
