---
title: "Edit image"
method: POST
path: "/images/edits"
tags: ["Images"]
---

# Edit image

`POST /images/edits`

## Request

- Base URL: `https://www.aimagicx.com/api/v1`
- URL: `https://www.aimagicx.com/api/v1/images/edits`
- Auth: HTTP bearer

Edits an existing image based on a text prompt. Supports inpainting and outpainting.

## Request body

- ImageEditRequest
  - `image` string, uri, required: URL of the image to edit
  - `prompt` string, required: Edit instructions
  - `mask` string, uri, nullable: Mask image URL for inpainting
  - `model` string
  - `size` '512x512' | '1024x1024'

## Response `200`

Successful response

- ImageGenerationResponse
  - `created` integer
  - `data` object[]
    - `url` string, uri
    - `revised_prompt` string
    - `width` integer
    - `height` integer
  - `model` string
  - `model_tier` string
  - `usage` Usage
    - `credits_used` integer
    - `credits_breakdown` object
    - `prompt_tokens` integer
    - `completion_tokens` integer
    - `total_tokens` integer

## Other responses

- `400`: Bad request - invalid parameters
- `401`: Unauthorized - invalid or missing API key

---

[API](https://skmtc.dev/aimagicx/apis/ai-magicx-api.md) - [All operations](https://skmtc.dev/aimagicx/apis/ai-magicx-api/llms.txt) - [OpenAPI document](https://skmtc.dev/aimagicx/apis/ai-magicx-api/revisions/08210272abb4?raw)
