> ## 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.

# create.image

> Insert a new image at the target position.

## Summary

Insert a new image at the target position.

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

## Expected result

Returns a CreateImageResult with the new image address.

## Input fields

| Field         | Type                                                                                                                                      | Required | Description                                                                                                                               |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `alt`         | string                                                                                                                                    | no       |                                                                                                                                           |
| `at`          | object(kind="documentStart") \| object(kind="documentEnd") \| object(kind="before") \| object(kind="after") \| object(kind="inParagraph") | no       | One of: object(kind="documentStart"), object(kind="documentEnd"), object(kind="before"), object(kind="after"), object(kind="inParagraph") |
| `in`          | StoryLocator                                                                                                                              | no       | StoryLocator                                                                                                                              |
| `size`        | object                                                                                                                                    | no       |                                                                                                                                           |
| `size.height` | number                                                                                                                                    | no       |                                                                                                                                           |
| `size.width`  | number                                                                                                                                    | no       |                                                                                                                                           |
| `src`         | string                                                                                                                                    | yes      |                                                                                                                                           |
| `title`       | string                                                                                                                                    | no       |                                                                                                                                           |

### Example request

```json theme={null}
{
  "alt": "example",
  "in": {
    "kind": "story",
    "storyType": "body"
  },
  "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`
* `INVALID_TARGET`
* `CAPABILITY_UNAVAILABLE`
* `INVALID_INPUT`
* `STORY_NOT_FOUND`
* `STORY_MISMATCH`
* `STORY_NOT_SUPPORTED`
* `CROSS_STORY_PLAN`
* `MATERIALIZATION_FAILED`

## Non-applied failure codes

* `INVALID_TARGET`
* `INVALID_INPUT`

## Raw schemas

<Accordion title="Raw input schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "alt": {
        "type": "string"
      },
      "at": {
        "oneOf": [
          {
            "additionalProperties": false,
            "properties": {
              "kind": {
                "const": "documentStart"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "kind": {
                "const": "documentEnd"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "kind": {
                "const": "before"
              },
              "target": {
                "$ref": "#/$defs/BlockNodeAddress"
              }
            },
            "required": [
              "kind",
              "target"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "kind": {
                "const": "after"
              },
              "target": {
                "$ref": "#/$defs/BlockNodeAddress"
              }
            },
            "required": [
              "kind",
              "target"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "kind": {
                "const": "inParagraph"
              },
              "offset": {
                "type": "integer"
              },
              "target": {
                "$ref": "#/$defs/BlockNodeAddress"
              }
            },
            "required": [
              "kind",
              "target"
            ],
            "type": "object"
          }
        ]
      },
      "in": {
        "$ref": "#/$defs/StoryLocator"
      },
      "size": {
        "additionalProperties": false,
        "properties": {
          "height": {
            "type": "number"
          },
          "width": {
            "type": "number"
          }
        },
        "type": "object"
      },
      "src": {
        "type": "string"
      },
      "title": {
        "type": "string"
      }
    },
    "required": [
      "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": {
            "enum": [
              "INVALID_TARGET",
              "INVALID_INPUT"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      },
      "success": {
        "const": false
      }
    },
    "required": [
      "success",
      "failure"
    ],
    "type": "object"
  }
  ```
</Accordion>
