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

# Edit an image

`POST /v1/images/edits`

## Request

- Base URL: `https://api.sandbase.ai`
- URL: `https://api.sandbase.ai/v1/images/edits`
- Auth: HTTP bearer

Edit one or more uploaded images through the synchronous OpenAI Images-compatible multipart endpoint. Supported public model names are gpt-image-2, gpt-image-2.5-flare, and gpt-image-2.5-sunburst. Repeating the image field is supported. Additional compatible multipart fields are forwarded unchanged. Streaming and asynchronous mode are not supported on this endpoint.

## Response `200`

Edited images and authoritative token usage

- ImagesResponse
  - `created` integer
  - `data` union[], required
    - union
      - object
        - `b64_json` string, required: Base64-encoded image data.
        - `url` string, uri
        - `revised_prompt` string
      - object
        - `b64_json` string: Base64-encoded image data.
        - `url` string, uri, required
        - `revised_prompt` string
  - `usage` object, required
    - `input_tokens` integer, required
    - `output_tokens` integer, required
    - `total_tokens` integer, required
    - `input_tokens_details` object, required
      - `text_tokens` integer, required
      - `image_tokens` integer, required
      - `cached_text_tokens` integer
      - `cached_image_tokens` integer
      - `cached_tokens` integer

## Other responses

- `400`: Invalid multipart body, unsupported model, streaming request, or provider request
- `401`: Missing or invalid API key
- `402`: Organization or API Key spending limit reached
- `403`: Organization is disabled, or the API key scope does not authorize this endpoint
- `404`: Routed image-edit model is unavailable
- `429`: Rate limit exceeded
- `500`: Request persistence or response processing failed
- `502`: Provider returned an invalid native response
- `503`: No provider route succeeded

---

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