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

# Flux-Kontext-Pro - Submit Task

> Flux-Kontext-Pro — Submit Task. GPTProto API reference.

Flux's official format for the submit task API.

<CodeGroup>
  ```bash cURL theme={null}
  curl --location --request POST 'https://gptproto.com/flux/v1/flux-kontext-pro' \
  --header 'Authorization: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "prompt": "ein fantastisches bild",
    "input_image": "base64_encoded_image",
    "input_image_2": "base64_encoded_image",
    "input_image_3": "base64_encoded_image",
    "input_image_4": "base64_encoded_image",
    "seed": 42,
    "aspect_ratio": "21:9",
    "output_format": "jpeg",
    "webhook_url": "https://your-webhook-url.com",
    "webhook_secret": "your_secret",
    "prompt_upsampling": false,
    "safety_tolerance": 2
  }'
  ```

  ```python Python theme={null}
  import requests
  import json

  url = "https://gptproto.com/flux/v1/flux-kontext-pro"
  headers = {
      "Authorization": "YOUR_API_KEY",
      "Content-Type": "application/json"
  }

  data = {
      "prompt": "ein fantastisches bild",
      "input_image": "base64_encoded_image",
      "input_image_2": "base64_encoded_image",
      "input_image_3": "base64_encoded_image",
      "input_image_4": "base64_encoded_image",
      "seed": 42,
      "aspect_ratio": "21:9",
      "output_format": "jpeg",
      "webhook_url": "https://your-webhook-url.com",
      "webhook_secret": "your_secret",
      "prompt_upsampling": False,
      "safety_tolerance": 2
  }

  response = requests.post(url, headers=headers, json=data)
  result = response.json()
  print(json.dumps(result, indent=2))
  ```

  ```javascript JavaScript theme={null}
  const url = "https://gptproto.com/flux/v1/flux-kontext-pro";
  const headers = {
    "Authorization": "YOUR_API_KEY",
    "Content-Type": "application/json"
  };

  const data = {
    prompt: "ein fantastisches bild",
    input_image: "base64_encoded_image",
    input_image_2: "base64_encoded_image",
    input_image_3: "base64_encoded_image",
    input_image_4: "base64_encoded_image",
    seed: 42,
    aspect_ratio: "21:9",
    output_format: "jpeg",
    webhook_url: "https://your-webhook-url.com",
    webhook_secret: "your_secret",
    prompt_upsampling: false,
    safety_tolerance: 2
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(data)
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error("Error:", error));
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "io/ioutil"
      "net/http"
  )

  func main() {
      url := "https://gptproto.com/flux/v1/flux-kontext-pro"

      payload := []byte(`{
    "prompt": "ein fantastisches bild",
    "input_image": "base64_encoded_image",
    "input_image_2": "base64_encoded_image",
    "input_image_3": "base64_encoded_image",
    "input_image_4": "base64_encoded_image",
    "seed": 42,
    "aspect_ratio": "21:9",
    "output_format": "jpeg",
    "webhook_url": "https://your-webhook-url.com",
    "webhook_secret": "your_secret",
    "prompt_upsampling": false,
    "safety_tolerance": 2
  }`)

      req, _ := http.NewRequest("POST", url, bytes.NewBuffer(payload))
      req.Header.Set("Authorization", "YOUR_API_KEY")
      req.Header.Set("Content-Type", "application/json")

      client := &http.Client{}
      resp, err := client.Do(req)
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()

      body, _ := ioutil.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```
</CodeGroup>

<CodeGroup>
  ```json 401 - Invalid signature theme={null}
  {
    "error": {
      "message": "Invalid signature",
      "type": "401"
    }
  }
  ```

  ```json 403 - Insufficient balance theme={null}
  {
    "error": {
      "message": "Insufficient balance",
      "type": "403"
    }
  }
  ```

  ```json 500 - Internal server error theme={null}
  {
    "error": {
      "message": "Internal server error",
      "type": "500"
    }
  }
  ```

  ```json 503 - Content policy violation theme={null}
  {
    "error": {
      "message": "Input may not meet the guidelines. Please adjust and try again.",
      "type": "503"
    }
  }
  ```
</CodeGroup>

## Request Body

| Parameter           | Type    | Required | Default | Description                                                                               |
| ------------------- | ------- | -------- | ------- | ----------------------------------------------------------------------------------------- |
| `prompt`            | string  | ✅ Yes    | -       | The text prompt describing the image to generate                                          |
| `input_image`       | string  | ✅ Yes    | -       | Base64 encoded input image (first image)                                                  |
| `input_image_2`     | string  | ❌ No     | -       | Base64 encoded input image (second image)                                                 |
| `input_image_3`     | string  | ❌ No     | -       | Base64 encoded input image (third image)                                                  |
| `input_image_4`     | string  | ❌ No     | -       | Base64 encoded input image (fourth image)                                                 |
| `seed`              | integer | ❌ No     | -       | Random seed for reproducible generation                                                   |
| `aspect_ratio`      | string  | ❌ No     | `16:9`  | Aspect ratio of the generated image. Options: `16:9`, `9:16`, `1:1`, `4:3`, `3:4`, `21:9` |
| `output_format`     | string  | ❌ No     | `jpeg`  | Output image format. Options: `jpeg`, `png`, `webp`                                       |
| `webhook_url`       | string  | ❌ No     | -       | URL to receive webhook notifications when the task is completed                           |
| `webhook_secret`    | string  | ❌ No     | -       | Secret key for webhook verification                                                       |
| `prompt_upsampling` | boolean | ❌ No     | `false` | Whether to enhance the prompt automatically                                               |
| `safety_tolerance`  | integer | ❌ No     | `2`     | Safety tolerance level for content filtering. Range: `0-6` (0 = strict, 6 = permissive)   |
