Skip to content
Browse the docs

API reference · Images

Edit an image

POSThttps://api.useunbound.ai/v1/images/edits

Send one image and editing instructions. The price for the selected output resolution is held before the job runs. The response contains the finished image.

Headers

  • Authorizationstringrequired

    Bearer <key>, with a key from Settings → API.

  • Idempotency-Keystring

    A unique key up to 200 characters. Retrying with the same key returns the same images and is charged once.

Body

multipart/form-data

  • modelstringrequired

    An image-editing model from GET /v1/models.

  • promptstringrequired

    How to change the image.

  • imagestringrequired

    One PNG, JPEG or WebP file, up to 1 MiB.

  • ninteger

    Number of images, up to the model limit.

    Minimum 1

  • sizestring

    OpenAI-style size such as 1024x1024. Mapped to the nearest aspect ratio and resolution.

  • aspect_ratiostring

    Unbound field, for example 16:9. Takes precedence over size.

  • resolutionstring

    Unbound field, for example 2k. Takes precedence over size.

  • qualitystring

    Only for models that declare quality levels.

  • seedinteger

    Only for models that support a seed.

  • negative_promptstring

    Only for models that support it.

  • response_formatstringdefault "b64_json"

    Base64 in the response, or signed links that expire after one hour.

    One ofb64_jsonurl

Response

The edited images.

  • createdintegerrequired

  • dataobject[]required

    • b64_jsonstring

      Base64 image data, when response_format is b64_json.

    • mime_typestring

      Sent with b64_json.

    • urlstring

      A signed link, when response_format is url.

Errors

  • 400The request is malformed, or a parameter is not supported by the model.
  • 401The API key is missing, revoked or expired.
  • 402Not enough credit, or the key reached its spending limit. Nothing was charged.
  • 403The key does not have the scope this endpoint needs.
  • 404The model does not exist or is not available through the API.
  • 409The edit was cancelled.
  • 413The image or request is too large.
  • 429Too many requests for this key. Retry after the number of seconds in the Retry-After header.
  • 502The upstream provider failed. The hold was released; you were not charged.

All errors use the envelope described in the introduction. None of them result in a charge.