> This page is for version v1.3 (default).
> For other versions, use one of these documentation indexes:
> - v1.3 (default): https://docs.twelvelabs.io/v1.3/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.twelvelabs.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.twelvelabs.io/_mcp/server.

# Enable storage accounting for an asset

PUT https://api.twelvelabs.io/v1.3/assets/{asset_id}/storage-accounting
Content-Type: application/json

This method enables storage accounting for the specified asset. Storage accounting makes an asset count toward your Managed Intelligence allowance.

**When to use this method**: Call it once for each asset that you uploaded before your plan moved to the new billing (a pre-migration asset). Enable storage accounting before you do either of the following:

* Add the asset to a knowledge store.
* Index the asset in an index for which Marengo is enabled.

An asset that you upload after your plan moves already counts toward your Managed Intelligence allowance. You do not need to call this method for it.

**Before you call this method**: The asset must have the `ready` status and a recorded size. To check, use the [`GET`](/v1.3/api-reference/manage-assets/retrieve) method of the `/assets/{asset_id}` endpoint and read the `status` and `size` fields.

**After you call this method**:

* The asset counts toward your Managed Intelligence allowance from the moment of the call.
* Enabling storage accounting is permanent. You cannot turn it off.
* If storage accounting is already on, the method returns the same response and changes nothing.

Reference: https://docs.twelvelabs.io/api-reference/manage-assets/enable-storage-accounting

## Authentication

- `x-api-key` header (required) — Your API key. You can find your API key on the API Keys page.

## Request

### Path parameters

- `asset_id` (string, required) — The unique identifier of the asset for which to enable storage accounting.

### Body (application/json)

This endpoint expects an object.

- `enabled` (boolean, required) — Enables storage accounting for the asset. The only accepted value is `true`.

## Response

### 200

Storage accounting has been successfully enabled for the asset.

- `asset_id` (string, required) — The unique identifier of the asset.
- `storage_accounting` (boolean, required) — Indicates whether the platform counts the asset toward your Managed Intelligence allowance.
- `bytes` (long, required) — The number of stored bytes that the platform counts for the asset.

## Errors

### 400 Bad Request Error

The request has failed.

- `code` (string, optional) — A string representing the code associated with the error. See the [Error codes](/v1.3/api-reference/error-codes) page for details.
- `message` (string, optional) — A human-readable string describing the error, intended to be suitable for display in a user interface.

### 404 Not Found Error

The specified asset does not exist.

- `code` (string, required) — A string representing the code associated with the error. See the [Error codes](/v1.3/api-reference/error-codes) page for details.
- `message` (string, required) — A human-readable string describing the error, intended to be suitable for display in a user interface.

### 409 Conflict Error

The platform cannot enable storage accounting for this asset because the asset has not reached the `ready` status or has no recorded size.

- `code` (string, required) — A string representing the code associated with the error. See the [Error codes](/v1.3/api-reference/error-codes) page for details.
- `message` (string, required) — A human-readable string describing the error, intended to be suitable for display in a user interface.

### 422 Unprocessable Entity Error

The platform cannot enable storage accounting for this asset. Either your plan has not moved to the new billing, or the asset does not fit in your Managed Intelligence allowance.

- `code` (string, required) — A string representing the code associated with the error. See the [Error codes](/v1.3/api-reference/error-codes) page for details.
- `message` (string, required) — A human-readable string describing the error, intended to be suitable for display in a user interface.

## Examples

**Request**

```json
{
  "enabled": true
}
```

**Response**

```json
{
  "asset_id": "6298d673f1090f1100476d4c",
  "storage_accounting": true,
  "bytes": 104857600
}
```

**SDK Code**

```python assets_enable_storage_accounting_example
import requests

url = "https://api.twelvelabs.io/v1.3/assets/6298d673f1090f1100476d4c/storage-accounting"

payload = { "enabled": True }
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript assets_enable_storage_accounting_example
const url = 'https://api.twelvelabs.io/v1.3/assets/6298d673f1090f1100476d4c/storage-accounting';
const options = {
  method: 'PUT',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"enabled":true}'
};

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

```go assets_enable_storage_accounting_example
package main

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

func main() {

	url := "https://api.twelvelabs.io/v1.3/assets/6298d673f1090f1100476d4c/storage-accounting"

	payload := strings.NewReader("{\n  \"enabled\": true\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

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

url = URI("https://api.twelvelabs.io/v1.3/assets/6298d673f1090f1100476d4c/storage-accounting")

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

request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"enabled\": true\n}"

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

```java assets_enable_storage_accounting_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.twelvelabs.io/v1.3/assets/6298d673f1090f1100476d4c/storage-accounting")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"enabled\": true\n}")
  .asString();
```

```php assets_enable_storage_accounting_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.twelvelabs.io/v1.3/assets/6298d673f1090f1100476d4c/storage-accounting', [
  'body' => '{
  "enabled": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp assets_enable_storage_accounting_example
using RestSharp;

var client = new RestClient("https://api.twelvelabs.io/v1.3/assets/6298d673f1090f1100476d4c/storage-accounting");
var request = new RestRequest(Method.PUT);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"enabled\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift assets_enable_storage_accounting_example
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["enabled": true] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/assets/6298d673f1090f1100476d4c/storage-accounting")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```