# Edit

> Change materials or objects, masked or across the whole image. $0.099 per edit.

Source: https://developers.mnml.ai/docs/models/edit

- **Price:** $0.099 (per edit)
- **Endpoint:** POST /v2/edits (kind: edit)
- **Account:** Any account (Free and topped-up)

## Run it

Send it to [POST /v2/edits](https://developers.mnml.ai/docs/edits). It answers `202` with a job; poll [GET /v2/jobs/{id}](https://developers.mnml.ai/docs/jobs) for the result. A job that fails is refunded.

**curl**

```bash
curl -X POST https://api.mnml.ai/v2/edits \
  -H "Authorization: Bearer $MNML_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "job_id": "10482",
    "prompt": "Replace the cladding with dark brick",
    "region": {
      "box": {
        "x": 0.12,
        "y": 0.3,
        "width": 0.5,
        "height": 0.45
      }
    }
  }'
```

**TypeScript**

```ts
const res = await fetch("https://api.mnml.ai/v2/edits", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MNML_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "job_id": "10482",
    "prompt": "Replace the cladding with dark brick",
    "region": {
      "box": {
        "x": 0.12,
        "y": 0.3,
        "width": 0.5,
        "height": 0.45
      }
    }
  }),
});

const data = await res.json();
```

**Python**

```python
import os, requests

res = requests.post(
    "https://api.mnml.ai/v2/edits",
    headers={"Authorization": f"Bearer {os.environ['MNML_API_KEY']}"},
    json={
      "job_id": "10482",
      "prompt": "Replace the cladding with dark brick",
      "region": {
        "box": {
          "x": 0.12,
          "y": 0.3,
          "width": 0.5,
          "height": 0.45
        }
      }
    },
)

data = res.json()
```

## Fields

- `prompt`, required: what to change, in plain words.
- `region` or `mask`, optional: the area to change. Leave both out to edit the whole image.
- `engine`, optional: whose edit runs, [v4.6-ultra](https://developers.mnml.ai/docs/models/v4-6-ultra) by default. The price is the same on every engine; each engine page says where its edits run.
- `mode` and `references`, optional: what the image shows, and images to follow, on engines that take references on an edit.
- One source: `image` (a link, base64, or the file itself as multipart), or `job_id` to work on a finished job’s output without downloading it.
- `webhook_url`, optional: where to send this job’s settle event.

## Price

$0.099 per edit, whichever engine made the image.

| Top-up | Covers about |
| --- | --- |
| $10 | 101 images |
| $25 | 252 images |
| $50 | 505 images |
| $100 | 1,010 images |

## Related

- [Edit an image](https://developers.mnml.ai/docs/edits): every field of the call.
- [Sending the image](https://developers.mnml.ai/docs/renders#image): a file, a link or base64, for a source or a mask.
- [Pricing](https://developers.mnml.ai/docs/pricing): the wallet and every price.
