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

# Edit Image

> <ul><li>Bailian qwen-image series image editing</li></ul>

<RequestExample>
  ```bash cURL theme={null} theme={null}
  curl --request POST \
    --url 'https://api.elkapi.com/v1/images/edits' \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
    "model": "gpt-image-1.5",
    "input": "The weather is great today, perfect for a walk."
  }'
  ```

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

  url = "https://api.elkapi.com/v1/images/edits"
  headers = {
      "Authorization": "Bearer <token>"
  }
  headers["Content-Type"] = "application/json"
  payload = {
      "model": "gpt-image-1.5",
      "input": "The weather is great today, perfect for a walk."
  }

  response = requests.request("POST", url, headers=headers, json=payload)
  print(response.json())
  ```

  ```javascript JavaScript theme={null} theme={null}
  const url = "https://api.elkapi.com/v1/images/edits";

  const headers = {
    "Authorization": "Bearer <token>"
  };
  headers["Content-Type"] = "application/json";
  const payload = {
    "model": "gpt-image-1.5",
    "input": "The weather is great today, perfect for a walk."
  };

  const response = await fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(payload)
  });

  console.log(await response.json());
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null} theme={null}
  {
    "created": 1,
    "data": [
      {
        "url": "https://example.com/image.png",
        "b64_json": "b64_json",
        "revised_prompt": "revised_prompt"
      }
    ]
  }
  ```
</ResponseExample>

## Authorizations

<ParamField header="Authorization" type="string" required>
  All endpoints require Bearer Token authentication.

  Add it to the request headers:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Body

<ParamField body="model" type="string" required default="gpt-image-1.5">
  Example: `gpt-image-1.5`
</ParamField>

<ParamField body="input" type="object" required>
  <ParamField body="input.messages" type="array<object>" required>
    <ParamField body="input.messages.role" type="string" />

    <ParamField body="input.messages.content" type="array<object>">
      <ParamField body="input.messages.content.image" type="string" />

      <ParamField body="input.messages.content.text" type="string" />
    </ParamField>
  </ParamField>
</ParamField>

<ParamField body="parameters" type="object">
  <ParamField body="parameters.n" type="integer" />

  <ParamField body="parameters.negative_prompt" type="string" />

  <ParamField body="parameters.prompt_extend" type="boolean" />

  <ParamField body="parameters.watermark" type="boolean" />

  <ParamField body="parameters.size" type="string" />
</ParamField>

## Response

<ResponseField name="created" type="integer" />

<ResponseField name="data" type="array<object>">
  <ResponseField name="data.url" type="string" />

  <ResponseField name="data.b64_json" type="string" />

  <ResponseField name="data.revised_prompt" type="string" />
</ResponseField>
