GraphQL AI Image Mutations

The AI Image mutations provide AI-powered image manipulation capabilities through the GraphQL API. All mutations require authentication and return base64 encoded image data.

imagine

Generate images from text prompts, optionally using existing files as reference.

mutation {
  imagine(prompt: "A mountain landscape at sunset", context: "hero image for travel blog", files: ["file-id-1"]) 
}

Arguments:

Argument Type Description
prompt String! Text description of the image to generate (required)
context String Additional context to guide image generation
files [String!] List of file IDs to use as reference

Returns: String — Base64 encoded image data.

Example response:

{
  "data": {
    "imagine": "iVBORw0KGgoAAAANSUhEUgAA..."
  }
}

repaint

Edit an entire image using a text prompt. The AI interprets the prompt and modifies the uploaded image accordingly.

mutation Repaint($file: Upload!) {
  repaint(file: $file, prompt: "Make the sky more dramatic with storm clouds")
}

Arguments:

Argument Type Description
file Upload! The image file to edit (required)
prompt String! Text description of the desired changes (required)

Returns: String — Base64 encoded image data.

inpaint

Edit specific areas of an image using a mask and a text prompt. The mask defines which areas to modify (white areas are edited, black areas are preserved).

mutation Inpaint($file: Upload!, $mask: Upload!) {
  inpaint(file: $file, mask: $mask, prompt: "Replace with a wooden door")
}

Arguments:

Argument Type Description
file Upload! The original image file (required)
mask Upload! Mask image where white areas will be edited and black areas preserved (required)
prompt String! Text description of what to generate in the masked area (required)

Returns: String — Base64 encoded image data.

erase

Remove parts of an image defined by a mask. The AI fills in the erased areas naturally based on the surrounding context.

mutation Erase($file: Upload!, $mask: Upload!) {
  erase(file: $file, mask: $mask)
}

Arguments:

Argument Type Description
file Upload! The original image file (required)
mask Upload! Mask image where black areas are kept and white areas are erased (required)

Returns: String — Base64 encoded image data.

isolate

Remove the background from an image, isolating the foreground subject.

mutation Isolate($file: Upload!) {
  isolate(file: $file)
}

Arguments:

Argument Type Description
file Upload! The image file to remove the background from (required)

Returns: String — Base64 encoded image data with transparent background.

uncrop

Extend an image beyond its original boundaries (outpainting). Specify the number of pixels to add on each side.

mutation Uncrop($file: Upload!) {
  uncrop(file: $file, top: 200, right: 100, bottom: 200, left: 100)
}

Arguments:

Argument Type Description
file Upload! The image file to extend (required)
top Int! Number of pixels to extend at the top (required)
right Int Number of pixels to extend on the right
bottom Int Number of pixels to extend at the bottom
left Int Number of pixels to extend on the left

Returns: String — Base64 encoded image data.

upscale

Upscale an image by a given factor using AI-powered super-resolution.

mutation Upscale($file: Upload!) {
  upscale(file: $file, factor: 2)
}

Arguments:

Argument Type Description
file Upload! The image file to upscale (required)
factor Int! The upscale multiplier (required)

Returns: String — Base64 encoded image data.