# replaceAssetFile mutation


`replaceAssetFile` is a GraphQL mutation of the Chameleoon MAX API. Send it as `POST https://max-api.chameleoon.sk/api/v1/graphql` with your API key, see [Chameleoon MAX](/chameleoon-max).

Replaces the asset's image with a new upload. Call it to change a logo or stamp without changing
its reference. The old image is deleted.

- Requires the `company.write` permission, and for a company's asset also the company in your
  API key's legal-entity scope.
- The upload follows the same rules and errors as in [`createAsset`](/chameleoon-max/mutation/create-asset).

## Arguments

- `input`: [`ReplaceAssetFileInput!`](/chameleoon-max/type/replace-asset-file-input) · required

## Returns

[`Asset!`](/chameleoon-max/type/asset)

## Example

**Mutation**

```graphql
mutation replaceAssetFile($input: ReplaceAssetFileInput!) {
  replaceAssetFile(input: $input) {
    id
    scope
    legalEntityId
    code
    reference
    name
    kind
    contentType
    width
    height
    sizeBytes
    isPublic
    publicUrl
    createdAt
    updatedAt
  }
}
```

**Variables**

```json
{
  "input": {
    "id": "00000000-0000-4000-8000-000000000001",
    "fileId": "00000000-0000-4000-8000-000000000001"
  }
}
```

**Response**

```json
{
  "data": {
    "replaceAssetFile": {
      "id": "00000000-0000-4000-8000-000000000001",
      "scope": "TENANT",
      "legalEntityId": "00000000-0000-4000-8000-000000000001",
      "code": "example",
      "reference": "example",
      "name": "example",
      "kind": "LOGO",
      "contentType": "example",
      "width": 1,
      "height": 1,
      "sizeBytes": 1,
      "isPublic": true,
      "publicUrl": "example",
      "createdAt": "2026-01-01T00:00:00Z",
      "updatedAt": "2026-01-01T00:00:00Z"
    }
  }
}
```

Values are illustrative: replace IDs and codes with your own before you send the call.
