Skip to main content
POST
  1. After submission, a task_id will be returned. If you provided a callback_url, when the task status becomes finished or failed, a POST request will be sent to the callback_url.
  2. Regardless of whether callback_url is provided, you can retrieve the response result through the unified Query Task Status endpoint.
Use mai-image-2.7 to create posters, product shots, logos, and other images from a prompt, or to edit and combine reference images. For a faster, lower-cost option with the same parameters, use MAI Image 2.7 Flash.

Models

  • mai-image-2.7 — Microsoft MAI Image 2.7 for text-to-image, image editing, and multi-image composition

Features

  • Text-to-image generation from prompts of up to 32,000 characters.
  • Editing a single reference image, or combining up to 5 reference images into one image.
  • Seven aspect ratios at 1K or 2K, plus custom WIDTHxHEIGHT sizes up to 4,194,304 pixels.
  • Transparent backgrounds for PNG and WebP output.
  • PNG, JPEG, or WebP output.

Input modes

  • Text-to-image — Omit image_urls. The output size comes from size and resolution.
  • Editing / composition — Pass 1 to 5 URLs in image_urls. One image is edited; two or more images are combined into one. Without size, the output follows the aspect ratio of the first reference image at about 1 megapixel. With size, the output uses that size.

Required parameters

  • prompt (string): Description of the image or the requested edit, 1–32,000 characters. Must contain non-whitespace text. Put any exact on-image text in quotes.

Optional parameters

  • image_urls (array of strings): 1 to 5 publicly accessible HTTP(S) reference image URLs in JPEG, PNG, or WebP format. Selects editing / composition mode.
  • size (string): 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, or a custom WIDTHxHEIGHT. Text-to-image defaults to 1:1. See Size.
  • resolution (string): 1K or 2K. Default is 1K. Applies to aspect-ratio sizes.
  • background (string): opaque or transparent. Default is opaque. transparent requires output_format png or webp.
  • output_format (string): png, jpeg, or webp. Default is png.

Size

  • Aspect ratios: 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16. 1K outputs about 1 megapixel (for example, 1:1 is 1024×1024). 2K outputs about 4 megapixels (for example, 16:9 is 2720×1536).
  • Custom WIDTHxHEIGHT sizes need both sides divisible by 16, each side at least 768, and total pixels at most 4,194,304 (for example 2048x2048 or 3072x1344). A custom size is used exactly as given; resolution applies to aspect-ratio sizes.
  • In editing / composition mode without size, the output follows the aspect ratio of the first reference image at about 1 megapixel.

Output

  • Each request returns one image in the format set by output_format (png by default).
  • With background set to transparent, the image has an alpha channel. Use it with output_format png or webp.

Examples

Text To Image

Image Edit

Custom Size

Transparent Background

Notes

  • Each request returns one image.
  • image_urls must be an array, even for one image.
  • Reference images are used at up to about 1 megapixel.

Authorizations

Authorization
string
header
required

All API endpoints require Bearer Token authentication.

Create an API key: sign in to PoYo, open Dashboard → API Key at poyo.ai/dashboard/api-key, and click to create a key.

Add it to the request header:

Body

application/json
model
enum<string>
required

MAI Image 2.7 model identifier.

Available options:
mai-image-2.7
input
object
required

Generate one image. With image_urls, edit or combine the reference images.

callback_url
string<uri>

Optional webhook URL for task completion or failure.

Response

Task submitted successfully

code
enum<integer>
required

Business status code. 200 means success; any other value means the request failed. Always check this field: some validation errors return HTTP 200 with code: 400 in the body.

  • 200: Success
  • 400: Invalid request parameters
  • 401: Missing or invalid API key
  • 402: Insufficient credits
  • 403: Permission denied
  • 404: Resource not found
  • 408: Request timeout
  • 429: Rate limit exceeded
  • 500: Internal server error
  • 502: Upstream service error
  • 503: Service unavailable

See Error Codes for details.

Available options:
200,
400,
401,
402,
403,
404,
408,
429,
500,
502,
503
Example:

200

data
object
required