---
title: "Update file"
description: "Updates a file's name, title, description and security level."
---

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

# Update file

Needs the file:write scope.

## Call

- Tool: `update_asset`
- Scope: `file:write`
- Writes, and may change or remove what is there.
- Acts on a store.

## Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `store` | `string` | No | The store to act on. |
| `asset` | `object` | Yes |  |
| `attachment` | `object` | No | The binding the caller saw holding the file; one holding another refuses. |
| `locator` | `string` | No | A link's URL; only a link held elsewhere takes one. |
| `security` | `"basic" or "full" or null` | No | The protection a stored PDF or spreadsheet is delivered with, refused for one no mark can be written into; null takes it off. |
| `name` | `string` | No |  |
| `title` | `string or null` | No |  |
| `description` | `string or null` | No |  |
| `metadata` | `object` | No |  |
| `enforcement` | `"public" or "external" or "signed"` | No | How the file is served: `public` to anyone with its link, `signed` (a stored file's default) only through links that expire, `external` for a link held elsewhere (a link's default). |
| `mime` | `string or null` | No | A link's type; a stored file's is the one it was stored with. |
| `ext` | `string or null` | No |  |
| `redacted` | `boolean` | No |  |

```json
{
  "type": "object",
  "properties": {
    "store": {
      "type": "string",
      "description": "The store to act on."
    },
    "asset": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      "required": [
        "id"
      ],
      "additionalProperties": false
    },
    "attachment": {
      "description": "The binding the caller saw holding the file; one holding another refuses.",
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      "required": [
        "id"
      ],
      "additionalProperties": false
    },
    "locator": {
      "description": "A link's URL; only a link held elsewhere takes one.",
      "type": "string",
      "minLength": 1,
      "maxLength": 100000
    },
    "security": {
      "description": "The protection a stored PDF or spreadsheet is delivered with, refused for one no mark can be written into; null takes it off.",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "basic",
            "full"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "pattern": "^[a-z0-9][a-z0-9-]*$"
    },
    "title": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        {
          "type": "null"
        }
      ]
    },
    "description": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 2000
        },
        {
          "type": "null"
        }
      ]
    },
    "metadata": {
      "type": "object",
      "properties": {
        "transcript": {
          "type": "object",
          "properties": {
            "language": {
              "type": "string",
              "minLength": 1,
              "maxLength": 35
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": {
        "anyOf": [
          {
            "type": "boolean"
          },
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {},
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "string"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "boolean"
                            },
                            {
                              "type": "string"
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "array",
                          "items": {
                            "anyOf": [
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "string"
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "enforcement": {
      "description": "How the file is served: `public` to anyone with its link, `signed` (a stored file's default) only through links that expire, `external` for a link held elsewhere (a link's default).",
      "type": "string",
      "enum": [
        "public",
        "external",
        "signed"
      ]
    },
    "mime": {
      "description": "A link's type; a stored file's is the one it was stored with.",
      "anyOf": [
        {
          "type": "string",
          "maxLength": 128,
          "pattern": "^\\s*(?:[a-zA-Z0-9][a-zA-Z0-9!#$&^_.+-]*\\/[a-zA-Z0-9][a-zA-Z0-9!#$&^_.+-]*(?:([\\t ]*;)(?:([\\t ]*)([!#$%&'*+.^_`|~0-9A-Za-z-]+)(=(?:[!#$%&'*+.^_`|~0-9A-Za-z-]+|\"(?:[\\t \\x21\\x23-\\x5b\\x5d-\\x7e]|\\\\[\\t\\x20-\\x7e])*\")))?)*)?\\s*$"
        },
        {
          "type": "null"
        }
      ]
    },
    "ext": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 16
        },
        {
          "type": "null"
        }
      ]
    },
    "redacted": {
      "type": "boolean"
    }
  },
  "required": [
    "asset"
  ],
  "additionalProperties": false
}
```

## Answer

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `transforms` | `array of object` | Yes |  |
| `deliveries` | `object` | Yes |  |
| `uses` | `object` | Yes |  |
| `children` | `object` | Yes |  |
| `id` | `string` | Yes |  |
| `locator` | `string or null` | Yes |  |
| `origin` | `string` | Yes |  |
| `custodian` | `string` | Yes |  |
| `enforcement` | `string` | Yes |  |
| `mime` | `string or null` | Yes |  |
| `bytes` | `number or null` | Yes | The file's size in bytes; null when it is charged nothing. |
| `quota_bytes` | `number` | Yes | The file's size in bytes; zero when it is charged nothing. |
| `name` | `string` | Yes |  |
| `title` | `string or null` | Yes |  |
| `ext` | `string or null` | Yes |  |
| `status` | `string` | Yes |  |
| `optimized` | `boolean` | Yes |  |
| `parent_id` | `string or null` | Yes |  |
| `redacted` | `boolean` | Yes |  |
| `security` | `string or null` | Yes |  |
| `description` | `string or null` | Yes |  |
| `processed_at` | `string or null` | Yes |  |
| `metadata` | `object` | Yes |  |
| `created_at` | `string or null` | Yes |  |

The answer's full shape is on [its API reference page](/merchant-api/reference/update-asset).

## Errors

A refused call is a tool error. Its `structuredContent` holds a `code` and its `context`, except for `client-fault`. This tool may answer:

- `invalid`: an argument is malformed; `context.path` names it.
- `invalid` at `["store"]`: `store` is missing while the connection reaches more than one store, or names a store it doesn't reach.
- `not_found`: nothing matches a reference given.
- `conflict`: the call clashes with the current state; `context` names the field and, where it helps, its current value, and for a `from`, `live`, `expect` or version that no longer matches, the argument (`path`) and what it takes (`reason`).
- `not_permitted`: this connection may not make this call. When `context.reason` is `limit`, too many calls: `retry_after` says when to try again.
- `internal` or `unavailable`: the call failed inside Sherpo, and the write may have landed. This write takes no idempotency key, so read the state back before trying again.
- `client-fault`: the server failed around the call. `core_answer` `ok` means the write landed, so don't send it again. When `reached_core` is false, nothing happened and the call may be made again. Otherwise, this write takes no idempotency key, so read the state back before trying again.
- HTTP 403 with `insufficient_scope`: the connection lacks the scope this tool needs.
- HTTP 401 with `invalid_token`: the access token expired or the connection ended. Refresh the token, and connect again if the refresh fails or the new token is refused too.

Any other code may come back too, such as a `conflict` when the state changed under the call. When the answer was already streaming, a 401 or 403 comes back as a tool error with only its text. See [Errors](/merchant-mcp/errors) for every code and its context.

Source: https://docs.sherpo.io/merchant-mcp/tools/update_asset/index.mdx
