# Upload image

`images_upload`

Stores an image file and answers with the address it is served at, which is the address to write in an email. It takes a PNG, JPEG, GIF or WebP file of 5 MB at most, sent as Base64, and reads the kind from the file itself. The same file twice answers with the image that is there.

Needs the scope: `images:write`

## Arguments

- `name` (string, required): The name of the file, such as `logo.png`. The image is listed and found by it. What kind of image it is, is read from the file itself, never from the name. Up to 255 characters.
- `content` (string, required): The file itself, encoded as Base64 with no `data:` prefix: a PNG, JPEG, GIF or WebP image of 5 MB at most.

## Returns

The answer comes back under `structuredContent`, with the same JSON as text in `content`. A call the API refuses comes back with `isError` set, and the code and the message under `structuredContent.error`. [MCP](https://opensend.sh/docs/mcp) shows how to connect a client.

- `object` ("image"): Always `image`.
- `id` (string): The id of the image.
- `url` (string | null): The address the image is served at. Emails link it in place of `source` when the image was copied, and it is the address to write in an email when the image was uploaded. `null` until the image is `ready`.
- `source` (string): Where the image came from: the address it was copied from, as it is written in your emails, or the name of the file that was uploaded.
- `origin` (string): How the image got here: `address` when it was copied from an address, `upload` when it was sent as a file. One of: `address`, `upload`.
- `status` (string): `pending` while it waits to be copied, `ready` once it is served, `failed` when it could not be copied. An uploaded image is `ready` at once. One of: `pending`, `ready`, `failed`.
- `type` (string | null): The media type of the image: `image/png`, `image/jpeg`, `image/gif` or `image/webp`. `null` until it is `ready`. One of: `image/png`, `image/jpeg`, `image/gif`, `image/webp`.
- `size` (integer | null): The size of the image in bytes, or `null` until it is `ready`.
- `reason` (string | null): Why the last try to copy it did not work, in words, or `null`.
- `createdAt` (string): When the image was first seen.
- `updatedAt` (string): When it was last copied or tried.

## Example

MCP:

```json
{
  "name": "images_upload",
  "arguments": {
    "name": "logo.png",
    "content": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="
  }
}
```

Answer, under structuredContent:

```json
{
  "object": "image",
  "id": "img_261f571bfbf7fc13ed2a7294",
  "url": "https://api.opensend.sh/v1/files/img_261f571bfbf7fc13ed2a7294.png",
  "source": "logo.png",
  "origin": "upload",
  "status": "ready",
  "type": "image/png",
  "size": 70,
  "reason": null,
  "createdAt": "2026-11-27T09:30:00.000Z",
  "updatedAt": "2026-11-27T09:30:00.000Z"
}
```
