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

# Edit image

`POST /images/edits`

## Request

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

Edit an image through the Dench gateway.

## Request body

- object
  - `prompt` string, required: Image prompt.
  - `size` string: e.g. 1024x1024, 1536x1024, auto.
  - `quality` 'auto' | 'low' | 'medium' | 'high'
  - `format` 'png' | 'jpeg' | 'webp'
  - `output_compression` integer
  - `background` 'auto' | 'opaque' | 'transparent'
  - `savePath` string: Workspace path to write the image.
  - `input_images_base64` string[], required: Base64-encoded source images (1-8).
  - `mask_base64` string: Optional base64 mask image.

## Response `200`

Successful response

- object: Generated or edited image, saved to the workspace.
  - `ok` boolean, required
  - `model` string, required
  - `endpoint` 'generations' | 'edits', required
  - `prompt` string, required
  - `revisedPrompt` string
  - `quality` string
  - `requestedSize` string
  - `format` string
  - `mimeType` string
  - `estimatedCostUsd` number
  - `b64_json` string, required: Base64-encoded image bytes.
  - `storageId` string
  - `path` string, required: Workspace path where the image was saved.
  - `signedUrl` string, nullable, required
  - `contentHash` string
  - `sizeBytes` number
  - `usage` object
    - `inputTokens` number
    - `outputTokens` number
    - `totalTokens` number

## Other responses

- `400`: Invalid request
- `401`: Missing or invalid authentication
- `404`: Operation or resource not found
- `500`: Server error

---

[API](https://skmtc.dev/dench/apis/dench-api.md) - [All operations](https://skmtc.dev/dench/apis/dench-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dench/apis/dench-api/revisions/4a145b38f19c?raw)
