# Edit Image

`POST /v1/images/edits`

Edit an image you generated earlier, guided by a prompt.

Every `image_url` must be an image your own account generated. Uploads and external URLs are rejected before you are charged.

Base URL: `https://api.spicyapi.com`

## Authorizations

- `Authorization` (string, header, required): Bearer authentication header of the form `Bearer <token>`, where `<token>` is your SpicyAPI key (`sk-spicy-…`). Create one in the dashboard under API Keys.

## Body (application/json)

- `model` (string, required): An image-edit model id, e.g. `spicy-image-edit-1`.
- `prompt` (string, required): The change to make.
- `image_url` (string, optional): A single source image. Use this or `image_urls`.
- `image_urls` (string[], optional): Up to 3 source images, all owned by your account.
- `negative_prompt` (string, optional): What to avoid.
- `size` (string, optional): Output size as `width*height`.
- `seed` (integer, optional): Reproducibility seed.

## Request

```bash
curl --request POST \
  --url https://api.spicyapi.com/v1/images/edits \
  --header 'Authorization: Bearer $SPICYAPI_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "spicy-image-edit-1",
    "prompt": "change the background to a hotel suite",
    "image_url": "https://cdn.spicyapi.com/outputs/a1b2/req_8f2a91c4-0.png"
  }'
```

## Response: 200 application/json

Successful Response

- `id` (string, required): Request id.
- `object` (string, required): Always `image.edit`.
- `data` (Image · object[], required): The edited image.
  - `url` (string, required): Durable CDN URL.
- `cost_usd` (number, required): What this request cost, in US dollars, already debited from your balance.

```json
{
  "id": "req_31c7de05",
  "object": "image.edit",
  "data": [
    { "url": "https://cdn.spicyapi.com/outputs/a1b2/req_31c7de05-0.png" }
  ],
  "cost_usd": 0.15
}
```
