---
title: "POST /v1/images/edits"
method: POST
path: "/v1/images/edits"
---

# POST /v1/images/edits

`POST /v1/images/edits`

## Request

- Base URL: `https://api.nano-gpt.com/api`
- URL: `https://api.nano-gpt.com/api/v1/images/edits`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`
  - none

Edit images with JSON inputs. Multipart uploads require normal authentication before conversion; accountless x402 applies to JSON edit requests only when the unauthenticated quote request includes x-x402: true.

## Headers

- `x-x402` 'true'

## Request body

- object
  - `model` string
  - `prompt` string, required
  - `imageDataUrl` string
  - `imageDataUrls` string[]
  - `maskDataUrl` string
  - `size` string
  - `n` integer

## Response `200`

Image edit response

- OpenAIImageGenerationsResponse
  - `created` integer: Unix timestamp of when the image was created
  - `data` union[]: List of generated images. Each entry contains either a hosted URL (data[i].url) or base64-encoded bytes (data[i].b64_json), never both.
    - union
      - object
        - `url` string, uri, required: Time-limited, signed download URL (presigned URL) to the generated image. It will expire after a short period (currently ~1 hour). If you need long-term access, download the image and store it yourself.
      - object
        - `b64_json` string, required: Base64 encoded image data
  - `cost` number: Cost of the generation
  - `paymentSource` string: Payment source used
  - `remainingBalance` number: Remaining balance after the generation

## Other responses

- `400`: Bad Request - invalid image edit request
- `401`: Unauthorized - Invalid or missing API key
- `402`: Payment Required - authenticated insufficient balance or opted-in accountless x402 quote for JSON edit requests

## Changes

- **2026-11-03** `cc8b07d75689`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/nano-gpt/apis/nanogpt-api/changes/v1/images/edits/post.md)

---

[API](https://skmtc.dev/nano-gpt/apis/nanogpt-api.md) - [All operations](https://skmtc.dev/nano-gpt/apis/nanogpt-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nano-gpt/apis/nanogpt-api/revisions/cc8b07d75689?raw)
