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

# Flux Kontext Max API Documentation

> Use the Flux Kontext Max API for context-aware image generation and editing with stronger control over complex prompts and visual consistency.



## OpenAPI

````yaml openapi/en/flux.json POST /bfl/v1/flux-kontext-max
openapi: 3.1.0
info:
  title: Flux API DOCS
  version: 1.0.0
  description: >-
    TTAPI Flux API service, currently integrating the most advanced video large
    model Sora2.
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /bfl/v1/flux-kontext-max:
    post:
      description: >-
        This endpoint follows BFL official format with parameters synchronized
        to BFL official documentation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KontextMaxRequest'
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  schemas:
    KontextMaxRequest:
      type: object
      description: >-
        Generate or edit images using the Flux Kontext Max model based on text
        prompts. <a
        href="https://docs.bfl.ai/api/tasks/edit-or-create-an-image-with-flux-kontext-max"
        target="_self">Official documentation</a>
      properties:
        prompt:
          type: string
          description: >-
            Image description. Note: Flux supports multilingual understanding,
            but English performs best in testing.
        input_image:
          type: string
          description: Reference image 1, URL or base64
        input_image_2:
          type: string
          description: Reference image 2, URL or base64
        input_image_3:
          type: string
          description: Reference image 3, URL or base64
        input_image_4:
          type: string
          description: Reference image 4, URL or base64
        aspect_ratio:
          type: string
          example: '21:9'
          description: Aspect ratio
          enum:
            - '21:9'
            - '9:21'
        seed:
          type: string
          description: Random seed
        output_format:
          type: string
          description: Output format
          example: jpeg
          enum:
            - jpeg
            - png
        prompt_upsampling:
          type: boolean
          description: Whether to enable prompt upsampling. true - yes, false - no
          example: 'false'
          enum:
            - 'false'
            - 'true'
        safety_tolerance:
          type: integer
          description: >-
            Safety tolerance level for input and output adjustment. Range: 0-6,
            where 0 is strictest and 6 is most permissive. Default: 2
          example: '2'
        webhook_url:
          type: string
          description: Asynchronous callback URL
      required:
        - prompt
  responses:
    SuccessResponse:
      description: Request successful
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: SUCCESS
              message:
                type: string
                example: success
              data:
                type: object
                example:
                  jobId: jobId
            required:
              - status
              - message
              - data
    400Response:
      description: Parameter error
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: '"prompt" cannot be empty.'
              data:
                type: object
            required:
              - status
              - message
    401Response:
      description: Authorization failed
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: Wrong TT-API-KEY or email is not activated.
            required:
              - status
              - message
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        You can obtain your API key from the <a
        href='https://dashboard.ttapi.io' target='_blank'>TTAPI Dashboard</a>.

````