> ## Documentation Index
> Fetch the complete documentation index at: https://superdoc-caio-pizzol-docs-ai-core-preset.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# images.replaceSource

> Replace the image source while preserving identity and placement.

## Summary

Replace the image source while preserving identity and placement.

* Operation ID: `images.replaceSource`
* API member path: `editor.doc.images.replaceSource(...)`
* Mutates document: `yes`
* Idempotency: `non-idempotent`
* Supports tracked mode: `no`
* Supports dry run: `yes`
* Deterministic target resolution: `yes`

## Expected result

Returns an ImagesMutationResult with the updated image address.

## Input fields

| Field       | Type    | Required | Description |
| ----------- | ------- | -------- | ----------- |
| `imageId`   | string  | yes      |             |
| `resetSize` | boolean | no       |             |
| `src`       | string  | yes      |             |

### Example request

```json theme={null}
{
  "imageId": "example",
  "resetSize": true,
  "src": "example"
}
```

## Output fields

| Field     | Type    | Required | Description |
| --------- | ------- | -------- | ----------- |
| `failure` | object  | no       |             |
| `image`   | object  | no       |             |
| `success` | boolean | no       |             |

### Example response

```json theme={null}
{
  "image": {},
  "success": true
}
```

## Pre-apply throws

* `TARGET_NOT_FOUND`
* `AMBIGUOUS_TARGET`
* `INVALID_TARGET`
* `CAPABILITY_UNAVAILABLE`
* `INVALID_INPUT`

## Non-applied failure codes

* `NO_OP`

## Raw schemas

<Accordion title="Raw input schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "imageId": {
        "type": "string"
      },
      "resetSize": {
        "type": "boolean"
      },
      "src": {
        "type": "string"
      }
    },
    "required": [
      "imageId",
      "src"
    ],
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw output schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "failure": {
        "type": "object"
      },
      "image": {
        "type": "object"
      },
      "success": {
        "type": "boolean"
      }
    },
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw success schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "image": {
        "type": "object"
      },
      "success": {
        "const": true
      }
    },
    "required": [
      "success",
      "image"
    ],
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw failure schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "failure": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      },
      "success": {
        "const": false
      }
    },
    "required": [
      "success",
      "failure"
    ],
    "type": "object"
  }
  ```
</Accordion>
