# Add Image From URL

Uploads a public image URL into the email-editor library and returns a URL ready for an email image block. The source must be publicly reachable, not private or login-protected. Accepts JPEG, PNG, GIF or WebP up to 5 MB; never overwrites.

## Input schema:

```json
{
  "type": "object",
  "properties": {
    "fileName": {
      "type": "string",
      "description": "Name for the file, extension optional; sanitised, extension set from the bytes, a taken name is numbered, never overwritten -- see storedAs",
      "minLength": 1,
      "maxLength": 250
    },
    "sourceUrl": {
      "type": "string",
      "description": "Public http(s) URL the server fetches the image from; reachable from the internet, no login, no private host",
      "minLength": 12,
      "maxLength": 2000
    },
    "folder": {
      "type": [
        "null",
        "string"
      ],
      "description": "Folder of the library to store it in, as list-email-editor-image-folders lists it; omit for the library's root",
      "default": null,
      "maxLength": 250
    },
    "accountId": {
      "type": [
        "null",
        "integer"
      ],
      "description": "User ID of the account; omit for the account the access token works in",
      "default": null,
      "minimum": 1
    }
  },
  "required": [
    "fileName",
    "sourceUrl"
  ],
  "additionalProperties": false
}
```

## Output schema:

```json
{
  "type": "object",
  "required": [
    "accountId",
    "uploaded",
    "storedAs",
    "image",
    "folders",
    "html"
  ],
  "properties": {
    "accountId": {
      "type": "integer"
    },
    "uploaded": {
      "type": "boolean"
    },
    "storedAs": {
      "type": [
        "string",
        "null"
      ]
    },
    "image": {
      "type": [
        "object",
        "null"
      ],
      "required": [
        "url",
        "path",
        "fileName",
        "mimeType",
        "sizeBytes",
        "uploadedAt",
        "width",
        "height"
      ],
      "properties": {
        "url": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "fileName": {
          "type": "string"
        },
        "mimeType": {
          "type": "string"
        },
        "sizeBytes": {
          "type": "integer"
        },
        "uploadedAt": {
          "type": "string"
        },
        "width": {
          "type": [
            "integer",
            "null"
          ]
        },
        "height": {
          "type": [
            "integer",
            "null"
          ]
        }
      }
    },
    "folders": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "html": {
      "type": "string"
    }
  }
}
```

