images-inpaint

Repaint a masked region with Ideogram 3.0, by asset id or by uploaded bytes

Repaint the masked region of a source image from a text prompt with Ideogram 3.0. For each of the source image and the mask, supply either an AssetIdentifier reference (image_asset_identifier / mask_asset_identifier) or the raw image bytes directly (image / mask, multipart requests only). If both a reference and bytes are supplied for the same input, the reference wins and the bytes are ignored.

Optional style controls: a style preset or style reference images. Supply style references as a saved style (style_reference_collection_id), as style_reference_asset_identifiers references (images already stored with Ideogram), or as raw style_reference_images bytes (multipart requests only). If more than one form is supplied, the collection wins over the identifiers, and the identifiers win over the bytes.

The output matches the size of the source image (snapped to the nearest resolution the model renders). By default the request blocks until the images are ready and returns them in data. Set async to true to return immediately after the request is accepted, then poll for completion and results with GET /v1/generations/{generation_id} using the returned generation_id.

Supplying a webhook_url makes the request asynchronous whatever async says: the response returns as soon as the request is accepted, and the finished result is POSTed to that URL.

post/v2/images/inpaint/ideogram-v3

Request body

promptstring required

The prompt describing the repainted result.

imagestring binary

The source image to repaint (max size 25MB), as raw bytes; only JPEG, PNG, and WEBP formats are supported. Multipart requests only; ignored if image_asset_identifier is also supplied.

maskstring binary

A black-and-white mask the same size as the source image, as raw bytes. Black marks the region to repaint; only JPEG, PNG, and WEBP formats are supported. Multipart requests only; ignored if mask_asset_identifier is also supplied.

magic_prompt'AUTO' | 'ON' | 'OFF'

Determine if MagicPrompt should be used in generating the request or not.

num_imagesinteger

The number of images to generate.

seedinteger

Random seed. Set for reproducible generation.

rendering_speed'TURBO' | 'DEFAULT' | 'QUALITY'

The rendering speed to use.

style_type'AUTO' | 'GENERAL' | 'REALISTIC' | 'DESIGN' | 'CUSTOM' | 'FICTION' | 'STYLIZED'

The style type to generate with.

style_preset'80S_ILLUSTRATION' | '90S_NOSTALGIA' | 'ABSTRACT_ORGANIC' | 'ANALOG_NOSTALGIA' | 'ART_BRUT' | 'ART_DECO' | 'ART_POSTER' | 'AURA' | 'AVANT_GARDE' | 'BAUHAUS' | 'BLUEPRINT' | 'BLURRY_MOTION' | 'BRIGHT_ART' | 'C4D_CARTOON' | 'CHILDRENS_BOOK' | 'COLLAGE' | 'COLORING_BOOK_I' | 'COLORING_BOOK_II' | 'CUBISM' | 'DARK_AURA' | 'DOODLE' | 'DOUBLE_EXPOSURE' | 'DRAMATIC_CINEMA' | 'EDITORIAL' | 'EMOTIONAL_MINIMAL' | 'ETHEREAL_PARTY' | 'EXPIRED_FILM' | 'FLAT_ART' | 'FLAT_VECTOR' | 'FOREST_REVERIE' | 'GEO_MINIMALIST' | 'GLASS_PRISM' | 'GOLDEN_HOUR' | 'GRAFFITI_I' | 'GRAFFITI_II' | 'HALFTONE_PRINT' | 'HIGH_CONTRAST' | 'HIPPIE_ERA' | 'ICONIC' | 'JAPANDI_FUSION' | 'JAZZY' | 'LONG_EXPOSURE' | 'MAGAZINE_EDITORIAL' | 'MINIMAL_ILLUSTRATION' | 'MIXED_MEDIA' | 'MONOCHROME' | 'NIGHTLIFE' | 'OIL_PAINTING' | 'OLD_CARTOONS' | 'PAINT_GESTURE' | 'POP_ART' | 'RETRO_ETCHING' | 'RIVIERA_POP' | 'SPOTLIGHT_80S' | 'STYLIZED_RED' | 'SURREAL_COLLAGE' | 'TRAVEL_POSTER' | 'VINTAGE_GEO' | 'VINTAGE_POSTER' | 'WATERCOLOR' | 'WEIRD' | 'WOODBLOCK_PRINT'

A predefined style preset that applies a specific artistic style to the generated image.

style_reference_collection_idstring

A saved style to apply, by its URL-safe base64 collection id. Takes priority over style_reference_asset_identifiers and style_reference_images if more than one is supplied.

style_reference_collection_version_idstring

Optional URL-safe base64 version id pinning a specific version of the style_reference_collection_id collection. Ignored without it.

style_reference_imagesstring[]

Images to use as style references (max 10, max size 25MB per image), as raw bytes; only JPEG, PNG, and WEBP formats are supported. Multipart requests only; ignored if a style reference collection or asset identifiers are also supplied.

enable_copyright_detectionboolean nullable

Optional. Opt this request into post-generation copyright detection. Adds detection latency; flagged images come back with is_image_safe: false.

asyncboolean

When false (the default), the request blocks until the repainted images are ready and returns them in data. When true, the request returns as soon as it is accepted; poll for completion and results with GET /v1/generations/{generation_id} using the returned generation_id.

webhook_urlstring uri

HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a JSON POST to this URL once all images for the request have finished generating. The body mirrors the synchronous generate response: request_id, created, and a data array containing every generated image (url, prompt, resolution, seed, is_image_safe). Each delivery is signed with Ed25519 and verifiable against the public keys at https://api.ideogram.ai/v1/.well-known/jwks.json. Must be HTTPS; private and loopback hosts and the cloud metadata service are rejected.

privateboolean nullable

When true or omitted, the output is kept private to your account. Set to false to publish the output to the public feed. Enterprise accounts always generate privately.

target_collection_idstring

A collection you can write to, by its URL-safe base64 collection id. The output images are added to it when the request completes.

Example request

{
  "image_asset_identifier": {
    "asset_type": "RESPONSE",
    "asset_id": "7uS_VESkRI6O3-sVgHQp_A"
  },
  "mask_asset_identifier": {
    "asset_type": "RESPONSE",
    "asset_id": "7uS_VESkRI6O3-sVgHQp_A"
  },
  "magic_prompt": "ON",
  "seed": 12345,
  "style_type": "GENERAL",
  "style_preset": "BRIGHT_ART",
  "style_reference_asset_identifiers": [
    {
      "asset_type": "RESPONSE",
      "asset_id": "7uS_VESkRI6O3-sVgHQp_A"
    }
  ],
  "webhook_url": "https://api.example.com/webhooks/ideogram"
}

Response

The repainted images (synchronous requests), or an acknowledgement to poll with GET /v1/generations/{generation_id} (async requests).

generation_idstring required

URL-safe base64 ID of the accepted generation. Accepted by the GET /v1/generations/{generation_id} polling endpoint.

seedinteger required

Random seed. Set for reproducible generation.

widthinteger required

The output width in pixels this request resolved to.

heightinteger required

The output height in pixels this request resolved to.

Example response

{
  "data": [
    {
      "seed": 12345,
      "prompt": "prompt",
      "resolution": "1024x1024",
      "url": "https://openapi-generator.tech",
      "is_image_safe": true
    },
    {
      "seed": 12345,
      "prompt": "prompt",
      "resolution": "1024x1024",
      "url": "https://openapi-generator.tech",
      "is_image_safe": true
    }
  ],
  "seed": 12345,
  "generation_id": "generation_id",
  "width": 0,
  "height": 6
}

Changes

Changed in 3 of the 16 revisions of this API.7

    • added the new optional request property webhook_url (media type: multipart/form-data)

      new-optional-request-property

    • added the new optional request property webhook_url (media type: application/json)

      new-optional-request-property

    • added the new optional request property private (media type: multipart/form-data)

      new-optional-request-property

    • added the new optional request property private (media type: application/json)

      new-optional-request-property

    • added the new optional request property target_collection_id (media type: multipart/form-data)

      new-optional-request-property

    • added the new optional request property target_collection_id (media type: application/json)

      new-optional-request-property

    • endpoint added

      endpoint-added