> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vidgo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MAI Image 2.7 Flash Edit

> The MAI Image 2.7 Flash Edit API quickly edits one image or merges up to 5 reference images into one 1K or 2K result, with custom sizes and transparent backgrounds.

> [!TIP]
>
> 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 result through the unified [Query Task Status](https://docs.vidgo.ai/api-manual/task-management/status.md) endpoint.

MAI Image 2.7 Flash Edit changes an image from text instructions, or combines several reference images into one new image. MAI Image 2.7 Flash is the faster, lower-cost tier of Microsoft's MAI Image 2.7, suited to drafts and high-volume work.

For prompt-only generation, use [MAI Image 2.7 Flash Text to Image](https://docs.vidgo.ai/api-manual/image-series/microsoft-mai-image-2-7-flash-text-to-image.md). MAI Image 2.7 Flash and MAI Image 2.7 accept the same parameters; see [MAI Image 2.7 Text to Image](https://docs.vidgo.ai/api-manual/image-series/microsoft-mai-image-2-7-text-to-image.md).

## Models

* **microsoft/mai-image-2.7-flash/edit** — Image edit with MAI Image 2.7 Flash, 1–5 reference images, one image per request.

## Features

* Edit one image, or combine up to 5 reference images (JPEG, PNG or WebP).
* When `size` is omitted, the output keeps the first reference image's aspect ratio at about 1 megapixel.
* Aspect-ratio presets at `1K` or `2K`, or custom sizes up to 4,194,304 pixels.
* Transparent backgrounds; PNG, JPEG or WebP output.

## Required parameters

* `prompt` (string): Instructions for the edit. 1–32,000 characters of text.
* `image_urls` (string\[]): 1–5 reference images (JPEG, PNG or WebP) as publicly accessible HTTP(S) URLs. One image is edited; several images are combined.

## Optional parameters

* `size` (string): Aspect-ratio preset or custom `WIDTHxHEIGHT`. When omitted, the output follows the first reference image's aspect ratio at about 1 megapixel. See [Size](#size).
* `resolution` (string): `1K` or `2K`. Default `1K`. Applies to aspect-ratio presets only.
* `background` (string): `opaque` or `transparent`. Default `opaque`. `transparent` requires `output_format` `png` or `webp`.
* `output_format` (string): `png`, `jpeg` or `webp`. Default `png`.

## Size

* Presets: `1:1`, `4:3`, `3:4`, `3:2`, `2:3`, `16:9`, `9:16`. They use the selected `resolution`: `1K` is about 1 megapixel (`1:1` is 1024x1024), `2K` is about 4 megapixels (`16:9` is 2720x1536).
* Custom `WIDTHxHEIGHT` (use `x` or `X`, for example `3072x1344`): both sides must be multiples of 16, each side at least 768 pixels, and total pixels at most 4,194,304. The image is rendered at exactly this size; other custom values return 400. `resolution` applies to presets.

## Examples

* **Edit one image**: new background, size follows the reference image.
* **Combine images**: two references merged at `4:3`, `2K`.
* **Transparent cutout**: `background: transparent`, PNG.

## Notes

* Each request returns exactly one image. `input` accepts the fields listed above; other fields return 400. Put `model` and `callback_url` at the request root, next to `input`.
* `background: transparent` with `output_format: jpeg` returns 400.
* `image_urls` takes 1–5 valid HTTP(S) URLs; other values return 400. Reference images larger than about 1 megapixel are downscaled before generation.
* Credits are billed by tokens: prompt text tokens, reference image tokens (by pixel count, about 1 megapixel at most per image) and output image tokens (output width × height / 1024). The price follows the output size, so `2K` and larger custom sizes cost more. The maximum for the request is reserved at submission; when the task finishes you are charged for the actual output size, up to that maximum, and the rest is refunded. A failed task is refunded in full. See the [pricing page](https://vidgo.ai/apis/api-pricing) for current rates.


## OpenAPI

````yaml api-manual/image-series/microsoft-mai-image-2-7-flash-edit.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - MAI Image 2.7 Flash Edit
  description: >-
    The MAI Image 2.7 Flash Edit API quickly edits one image or merges up to 5
    reference images into one 1K or 2K result, with custom sizes and transparent
    backgrounds.
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
    description: Production server
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - MAI Image 2.7 Flash Edit
      summary: Submit MAI Image 2.7 Flash Edit Task
      operationId: submitMAIImage27FlashEditTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              single-edit:
                summary: Edit one image
                value:
                  model: microsoft/mai-image-2.7-flash/edit
                  input:
                    prompt: >-
                      Replace the background with a sunlit marble kitchen
                      counter and keep the product unchanged.
                    image_urls:
                      - https://cdn.vidgo.ai/temp/reference-product.png
              combine:
                summary: Combine reference images at 2K
                value:
                  model: microsoft/mai-image-2.7-flash/edit
                  input:
                    prompt: >-
                      Put the label from the second image on the bottle from the
                      first image, studio lighting.
                    image_urls:
                      - https://cdn.vidgo.ai/temp/reference-product.png
                      - https://cdn.vidgo.ai/temp/reference-label.png
                    size: '4:3'
                    resolution: 2K
              transparent:
                summary: Transparent cutout
                value:
                  model: microsoft/mai-image-2.7-flash/edit
                  input:
                    prompt: Remove the background and keep only the product.
                    image_urls:
                      - https://cdn.vidgo.ai/temp/reference-product.png
                    background: transparent
                    output_format: png
      responses:
        '200':
          description: >-
            Task submission result. A task ID identifies asynchronous work;
            generation may still be running.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SubmitRequest:
      type: object
      required:
        - model
        - input
      additionalProperties: false
      properties:
        model:
          type: string
          example: microsoft/mai-image-2.7-flash/edit
        callback_url:
          type: string
          format: uri
          description: Optional webhook URL for completion or failure notifications.
          example: https://your-domain.com/callback
        input:
          type: object
          required:
            - prompt
            - image_urls
          additionalProperties: false
          properties:
            prompt:
              type: string
              minLength: 1
              maxLength: 32000
              description: >-
                Prompt describing the image or the requested edit. Put exact
                on-image text in quotes.


                Include at least one non-whitespace character.
            image_urls:
              type: array
              minItems: 1
              maxItems: 5
              items:
                type: string
                format: uri
                description: Use a publicly accessible HTTP(S) download URL.
              description: >-
                Required 1–5 reference images (JPEG, PNG or WebP). One image is
                edited; several images are combined.
            size:
              type: string
              description: >-
                Aspect-ratio preset or custom WIDTHxHEIGHT.


                Presets: `1:1`, `4:3`, `3:4`, `3:2`, `2:3`, `16:9`, `9:16`.


                Custom sizes need both sides divisible by 16, each side at least
                768, and at most 4194304 total pixels.


                When omitted, the output follows the aspect ratio of the first
                reference image at about 1 megapixel.
            resolution:
              type: string
              enum:
                - 1K
                - 2K
              default: 1K
              description: >-
                Output resolution tier for aspect-ratio presets. 1K is about 1
                megapixel; 2K is about 4 megapixels. Ignored for custom sizes.
            background:
              type: string
              enum:
                - opaque
                - transparent
              default: opaque
              description: >-
                Background type. transparent outputs an image with an alpha
                channel and requires output_format png or webp.
            output_format:
              type: string
              enum:
                - png
                - jpeg
                - webp
              default: png
              description: Output image format.
    SubmitResponse:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          example: 200
        data:
          type: object
          required:
            - task_id
            - status
            - created_time
          properties:
            task_id:
              type: string
              example: task-example-001
            status:
              type: string
              example: not_started
            created_time:
              type: string
              format: date-time
              example: '2026-11-19T10:30:00'
    ErrorResponse:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          description: Error message. See [Error Codes](/api-manual/error-codes).
          example: prompt is required
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'Use `Authorization: Bearer VIDGO_API_KEY`.'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.