# Add image

`opensend images add`

Copies the image at an address and answers with where the copy is served. Emails then link the copy in place of that address. The same address twice answers with the copy that is there, and an image that failed is tried again.

Needs the scope: `images:write`

## Flags

- `--url` (string, required): The public `https://` address of the image: a PNG, JPEG, GIF or WebP file of 5 MB at most. Up to 2,048 characters.

## Returns

The command prints the answer: as JSON when its output goes to a file or another program, and as a table or a list of fields in a terminal. When the API refuses, the error goes to the error stream and the command ends with a code that names the failure. [Output and scripts](https://opensend.sh/docs/scripting) lists the codes.

- `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

CLI:

```bash
opensend images add --url https://cdn.example.com/logo.png
```

Answer:

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