Skip to main content
POST
Create image from text - Nano Banana 2.1

Authorizations

x-magnific-api-key
string
header
required

Your Magnific API key. Required for authentication. Learn how to obtain an API key

Body

application/json
prompt
string
required

Text description of the image to generate, or of the edit to apply to the reference images. Refer to the references by their caption ("Image 1", "Image 2", ...).

Required string length: 2 - 12000
Example:

"Place the product from Image 1 on a marble kitchen counter, soft morning light"

webhook_url
string<uri>

Optional callback URL that will receive asynchronous notifications whenever the task changes status. The payload sent to this URL is the same as the corresponding GET endpoint response, but without the data field.

Example:

"https://www.example.com/webhook"

reference_images
object[]

Optional reference images for editing, composition, style or character and product consistency.

Image requirements:

  • Maximum 14 images
  • Supported formats: PNG, JPEG, WebP
  • Public HTTPS URL or base64-encoded string
Maximum array length: 14
Example:
aspect_ratio
enum<string>
default:1:1

Aspect ratio for the generated image.

Available ratios:

  • auto: Let the model choose. With reference images it follows their ratio, including ratios outside this list; without them it picks the ratio that best fits the prompt.
  • 1:1: Square (default)
  • 2:3, 3:2: Portrait/Landscape
  • 3:4, 4:3: Standard
  • 4:5, 5:4: Photo print
  • 9:16, 16:9: Social stories/Widescreen
  • 21:9: Ultra-wide cinematic
  • 1:4, 4:1, 1:8, 8:1: Banners, strips and vertical panels. At 1K they render 512x2064, 2064x512, 352x2928 and 2928x352 pixels.
Available options:
auto,
1:1,
2:3,
3:2,
3:4,
4:3,
4:5,
5:4,
9:16,
16:9,
21:9,
1:4,
4:1,
1:8,
8:1
Example:

"1:1"

resolution
enum<string>
default:1K

Output resolution. It sets the price of the generation.

Available resolutions:

  • 1K: About 1 megapixel, 1024x1024 at 1:1 (default)
  • 2K: About 4 megapixels, 2048x2048 at 1:1
  • 4K: About 16 megapixels, 4096x4096 at 1:1
Available options:
1K,
2K,
4K
Example:

"1K"

thinking_level
enum<string>

How much the model reasons about the prompt before drawing. Higher levels help with complex compositions and many constraints, at the cost of a longer generation time. It does not affect the price. When omitted, the model uses medium.

Available options:
minimal,
medium,
high
Example:

"medium"

use_google_search_tool
boolean
default:false

Ground the generation on Google Search results, useful for prompts about current events, real places or recent products. It does not affect the price.

Response

OK - The request has succeeded and the Nano Banana 2.1 process has started.

data
object
required
Example: