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

# Generate an image with FLUX 3

> Generate or edit images with FLUX 3 and retrieve the asynchronous result.



## OpenAPI

````yaml openapi/flux-3-image.json POST /v1/flux-3-image
openapi: 3.1.0
info:
  title: FLUX 3 Image
  version: 1.0.0
servers:
  - url: https://api.bfl.ai
security: []
paths:
  /v1/flux-3-image:
    post:
      summary: Generate an image with FLUX 3
      description: >-
        Generate an image from a prompt. Add up to ten reference images to edit
        an image, restyle it, or combine references into a new composition;
        describe how to use them in `prompt`. There is no `mode` field. Unknown
        fields return `422`.
      operationId: generate_flux_3_image
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageInputs'
            examples:
              Text to image:
                summary: Text to image
                value:
                  prompt: >-
                    Ultra-wide cinematic shot of a fog-drenched coastal highway
                    at dawn, cliffs on one side, turquoise sea on the other, a
                    single vintage car with headlights on, soft golden rim light
                  aspect_ratio: '21:9'
              Edit an image:
                summary: Edit an image
                value:
                  prompt: 'change the color of only one bird in the middle to #e01075'
                  images:
                    - >-
                      https://cdn.sanity.io/images/2gpum2i6/production/4792198dfeba9223bf3ecf020fed2942de7f0bd7-1800x1200.webp
              Multi reference:
                summary: Multi reference
                value:
                  prompt: Turn Image 1 in the Style of Image 2
                  images:
                    - >-
                      https://cdn.sanity.io/images/2gpum2i6/production/ababcf5c9cf86074d71c92d6362ff63545d90661-1800x1201.webp
                    - >-
                      https://cdn.sanity.io/images/2gpum2i6/production/dc642f5b01040c4afc46c1b4f8c4945152932683-1350x1800.webp
              Layout with boxes:
                summary: Layout with boxes
                value:
                  prompt: >-
                    Minimalist graphic illustration featuring a black silhouette
                    of a person <silhouette_1> centered against a solid, vibrant
                    chartreuse background <background_1>. The figure is captured
                    in a dynamic, mid-stride running pose, facing toward the
                    left side of the frame. The image relies entirely on the
                    high-contrast relationship between the two colors, mimicking
                    a digital recreation of a screen-printed or risograph
                    aesthetic, with no discernible light source or shadow.
                    [{"id":"background_1","bbox":[0,0,1000,1000],"desc":"A flat
                    field of neon yellow-green possessing a subtle, tactile
                    paper texture with fine, organic grain and slight variations
                    in color saturation, giving the flat surface a sense of
                    physical
                    depth."},{"id":"silhouette_1","bbox":[150,150,850,850],"desc":"A
                    black silhouette of a person in motion, composed of a dense,
                    stippled texture that resembles physical ink on paper or a
                    low-resolution digital dither. The leading edges, including
                    the front of the head, chest, and forward leg, are
                    relatively solid and opaque. The trailing edges, such as the
                    back, outstretched rear arm, and lifted back leg, dissolve
                    into a spray of coarse, square-shaped pixels and scattered
                    dots. The black ink shows a slight textural irregularity, as
                    if pressed onto a porous surface."}]
                  aspect_ratio: '1:1'
              Edit with boxes:
                summary: Edit with boxes
                value:
                  prompt: >-
                    In <ref_image_0>, change the large tiger <animal_1> and the
                    small glowing butterfly <insect_1> to be pink. Keep the
                    massive fallen log <log_1>, the falling snow <snow_1>, and
                    the dark background trees <trees_1> exactly unchanged.
                    [{"id":"animal_1","from":null,"src_bbox":null,"tgt_bbox":[250,50,850,650],"desc":"Make
                    both
                    pink."},{"id":"insect_1","from":null,"src_bbox":null,"tgt_bbox":[650,680,750,750],"desc":"Make
                    both
                    pink."},{"id":"log_1","from":"ref_image_0","src_bbox":[600,0,1000,1000],"tgt_bbox":[600,0,1000,1000],"desc":"A
                    massive, fallen tree log stretching horizontally across the
                    foreground. The surface features deep, rough-textured bark,
                    weathered cracks, and small pockets of
                    frost."},{"id":"snow_1","from":"ref_image_0","src_bbox":[0,0,1000,1000],"tgt_bbox":[0,0,1000,1000],"desc":"Numerous
                    white snowflakes of varying sizes falling across the scene.
                    Some flakes are sharp and distinct, while others closer to
                    the lens appear as blurred white
                    streaks."},{"id":"trees_1","from":"ref_image_0","src_bbox":[0,0,650,1000],"tgt_bbox":[0,0,650,1000],"desc":"A
                    dense stand of tall, dark, vertical tree trunks receding
                    into the distance. A cool, blue misty light permeates the
                    spaces between the trees, glowing most intensely from the
                    right edge."}]
                  images:
                    - >-
                      https://cdn.sanity.io/images/2gpum2i6/production/b6476b163e11444d6d5490ac1fa1e610d4eab85e-1360x768.webp
              Move with boxes:
                summary: Move with boxes
                value:
                  prompt: >-
                    In <ref_image_0>, move the miniature grey amigurumi knight
                    figure <knight_1> upwards and to the left along the yarn
                    cliff <cliff_1>. Leave the polished steel tapestry needle
                    <needle_1> in its original position in the air. Keep the
                    rest of the image completely unchanged, preserving the
                    blurred yarn backdrop <backdrop_1>, the large knitted dragon
                    <dragon_1>, and the fiery orange thread <fire_1> suspended
                    between them.
                    [{"id":"knight_1","from":"ref_image_0","src_bbox":[500,150,850,350],"tgt_bbox":[194,55,544,255],"desc":"A
                    miniature amigurumi knight figure crocheted from thick grey
                    woolen yarn. It has visible, intricate stitches forming a
                    rounded helmet shape and a cylindrical body, with tiny
                    stubby arms reaching upwards against the
                    cliff."},{"id":"backdrop_1","from":"ref_image_0","src_bbox":[0,0,1000,1000],"tgt_bbox":[0,0,1000,1000],"desc":"A
                    soft, out-of-focus expanse of cream ivory and melange indigo
                    knitted yarn, providing a blurred studio backdrop with
                    tangible fiber fuzz catching the ambient
                    light."},{"id":"cliff_1","from":"ref_image_0","src_bbox":[300,0,1000,450],"tgt_bbox":[300,0,1000,450],"desc":"A
                    steep, uneven cliff face constructed from stacked, thick
                    yarn skeins in rich shades of mustard yellow, terracotta,
                    and melange indigo, featuring visible woven wool textures
                    and loose, stray fiber
                    strands."},{"id":"needle_1","from":"ref_image_0","src_bbox":[420,250,550,450],"tgt_bbox":[420,250,550,450],"desc":"A
                    real, oversized polished steel tapestry needle, gleaming
                    under the studio lighting. It features a blunt tip and an
                    elongated eye, grasped like a weapon in the knight's
                    yarn-stub
                    hand."},{"id":"dragon_1","from":"ref_image_0","src_bbox":[100,600,950,1000],"tgt_bbox":[100,600,950,1000],"desc":"A
                    large, fluffy knitted dragon made of highly textured, fuzzy
                    yarn in terracotta and mustard yellow. It has a rounded
                    snout, large crocheted eyes, and a wide-open mouth, with
                    visible loose fibers creating a soft, tactile
                    surface."},{"id":"fire_1","from":"ref_image_0","src_bbox":[350,400,650,650],"tgt_bbox":[350,400,650,650],"desc":"Curled,
                    sculptural puffs of fiery orange angora thread, suspended in
                    mid-air. The thread is highly textured, fuzzy, and chaotic,
                    bursting from the dragon's mouth and stretching horizontally
                    across the center."}]
                  images:
                    - >-
                      https://cdn.sanity.io/images/2gpum2i6/production/aa7b28af831835fcef86e770262c8c30fa308c2c-1360x768.webp
      responses:
        '200':
          description: >-
            Poll the returned regional `polling_url` with `x-key`. Keep polling
            while `status` is `Pending`, `Reasoning`, or `Generating`. When it
            is `Ready`, download the image from `result.sample`; this signed URL
            expires after **1 hour**. Stop on `Error`, `Request Moderated`,
            `Content Moderated`, or `Task not found`. Polling errors may use
            HTTP `503` with a regular JSON body; inspect `status`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncResponse'
        '400':
          description: Rejected input, including a reference image above 16 megapixels.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '422':
          description: >-
            Validation error, including unknown fields, a blank prompt, invalid
            parameter values, or a reference image below 256 × 256 pixels.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    ImageInputs:
      title: FLUX 3 Image request
      type: object
      additionalProperties: false
      required:
        - prompt
      properties:
        prompt:
          type: string
          minLength: 1
          pattern: \S
          description: >-
            Non-blank text describing the image to generate or the edit to
            apply.


            To place elements, name each one as `<id>` in the text, then end the
            prompt with a JSON list of rows, one per element. Each `bbox` is
            `[top, left, bottom, right]` on a 0 to 1000 grid, so `[0, 0, 500,
            500]` is the top-left quarter of the output:


            ```text

            A black silhouette of a running person <runner_1>

            on a flat chartreuse background <background_1>.

            [
              {"id": "background_1", "bbox": [0, 0, 1000, 1000], "desc": "chartreuse field"},
              {"id": "runner_1", "bbox": [150, 150, 850, 850], "desc": "running silhouette"}
            ]

            ```


            In an edit, rows use `from`, `src_bbox`, and `tgt_bbox` instead of
            `bbox`. There is no separate box field, and an `entities` field
            returns `422`. For full requests, choose **Layout with boxes** or
            **Edit with boxes** in the request examples. [Layout and
            editing](/flux_3/flux3_image_layout) lists every row field.
        images:
          description: >-
            One reference image or a list of 1 to 10 images, each as an HTTP(S)
            URL or a base64 string. A data URI prefix is accepted. Each image
            must be at least 256 × 256 pixels and at most 16 megapixels; each
            base64 payload must be at most 20 MB. Inputs over 16 megapixels are
            rejected with `400`, inputs below 256 × 256 pixels with `422`.
          oneOf:
            - type: string
              minLength: 1
            - type: array
              minItems: 1
              maxItems: 10
              items:
                type: string
                minLength: 1
        aspect_ratio:
          type: string
          enum:
            - auto
            - '21:9'
            - '2:1'
            - '16:9'
            - '3:2'
            - '7:5'
            - '4:3'
            - '5:4'
            - '1:1'
            - '4:5'
            - '3:4'
            - '5:7'
            - '2:3'
            - '9:16'
            - '1:2'
            - '9:21'
          default: auto
          description: >-
            With `auto`, output follows the first reference image's aspect
            ratio, or uses `1:1` when there is no reference image.
        resolution:
          type: string
          enum:
            - 768sq
            - 1k
            - 2k
            - 4k
          default: 1k
          description: >-
            Choose the output size. Check `output_mp` in the submit response for
            the exact size in megapixels. Generating at `4k` can take several
            minutes.
        safety_tolerance:
          type: integer
          minimum: 0
          maximum: 4
          default: 2
          description: Input and output moderation tolerance; `0` is strictest.
        grounding:
          type: boolean
          default: true
          description: >-
            When `true`, the model can research the prompt with web search and
            image search before it generates. Set `false` to turn both off.
    AsyncResponse:
      type: object
      required:
        - id
        - polling_url
      properties:
        id:
          type: string
          description: Task identifier.
        polling_url:
          type: string
          format: uri
          description: >-
            Regional polling URL. Poll this URL with the `x-key` header rather
            than constructing a URL.
        cost:
          description: Cost in credits for this request
          anyOf:
            - type: number
            - type: 'null'
        input_mp:
          description: Input megapixels (2 decimal places)
          anyOf:
            - type: number
            - type: 'null'
        output_mp:
          description: Output megapixels (2 decimal places)
          anyOf:
            - type: number
            - type: 'null'
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    ValidationError:
      type: object
      required:
        - loc
        - msg
        - type
      properties:
        loc:
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
        msg:
          type: string
        type:
          type: string
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-key

````

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