> ## Documentation Index
> Fetch the complete documentation index at: https://docs.samsa.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Image Editing

> Edit an existing image with a prompt — with or without a mask — reusing your trained models.

Magic Edit takes a source image and a prompt and returns an edited image. Supply
the source three ways — an `image_id` already in your organization's context, an
`https` `url`, or inline `base64` + `mime_type`. Add a `mask` to run in **PRO**
(mask-based inpaint) mode, and reuse your trained `style`/`object`/`person`/
`setting` models and color palettes for on-brand results.

## Asynchronous pattern

Like generation, editing is asynchronous: `POST /images/edits` returns
**`202 Accepted`** with a job `id`; poll
[`GET /images/edits/{id}`](/api-reference/edits/get-edit) until `completed`, then
read the edited images (presigned URLs valid **24 hours**). A `webhook_url` gives
you a push callback instead — see [Webhooks](/guides/webhooks).

## Engines and credits

The default engine is `nano_banana_pro`; `gemini` and `kontext` are also available.
Supplying a `mask` runs the edit in **PRO** (mask-based) mode, supported by the
`nano_banana_pro` and `gemini` engines. Supplying trained models
(`style_id`/`object_ids`/`person_ids`/`setting_ids`) or a `color_palette_id` forces
`nano_banana_pro`. Each output is billed from your organization's pool at the app's
rates; an exhausted pool returns `402`. See [Pricing](/guides/pricing).
