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

# Enhance

> Improve image quality and detail

<Note>
  **Important**: The original job must be created in draft mode. This means the original job's prompt must include the parameters: `--v 7 --draft`
</Note>

## Headers

| Header      | Type   | Required | Description  |
| ----------- | ------ | -------- | ------------ |
| `x-api-key` | string | Yes      | Your API key |

## Request Body

| Parameter  | Type    | Required | Description                                    |
| ---------- | ------- | -------- | ---------------------------------------------- |
| `jobId`    | string  | Yes      | ID of the original image generation task       |
| `imageNo`  | integer | Yes      | Image number to enhance (0/1/2/3)              |
| `callback` | string  | No       | Callback URL for task completion notifications |

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.legnext.ai/api/v1/enhance" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "jobId": "c6821434-5e41-408f-b42b-2562306b109c",
      "imageNo": 0,
      "callback": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d"
    }'
  ```

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

  url = "https://api.legnext.ai/api/v1/enhance"
  headers = {
      "x-api-key": "YOUR_API_KEY",
      "Content-Type": "application/json"
  }
  data = {
      "jobId": "c6821434-5e41-408f-b42b-2562306b109c",
      "imageNo": 0,
      "callback": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d"
  }

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

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.legnext.ai/api/v1/enhance', {
    method: 'POST',
    headers: {
      'x-api-key': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      jobId: 'c6821434-5e41-408f-b42b-2562306b109c',
      imageNo: 0,
      callback: 'https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d'
    })
  });

  const result = await response.json();
  console.log(result);
  ```
</CodeGroup>

## Response

Returns a task object containing the task information.

```json theme={null}
{
    "job_id": "06eb333e-bd6b-4eb4-a5e9-7db1f091b728",
    "model": "midjourney",
    "task_type": "enhance",
    "status": "pending",
    "config": {
        "service_mode": "public",
        "webhook_config": {
            "endpoint": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d",
            "secret": ""
        }
    },
    "input": null,
    "output": {
        "image_url": "",
        "image_urls": null,
        "seed": ""
    },
    "meta": {
        "created_at": "",
        "started_at": "",
        "ended_at": "",
        "usage": {
            "type": "point",
            "frozen": 80,
            "consume": 0
        }
    },
    "detail": null,
    "logs": [],
    "error": {
        "code": 0,
        "raw_message": "",
        "message": "",
        "detail": null
    }
}
```

<Note>
  This is the initial success response. Use the `job_id` to check the task status via the [Get Task](/api-reference/task-management/get-task) endpoint to retrieve the completed result with image URLs.
</Note>


## OpenAPI

````yaml POST /v1/enhance
openapi: 3.0.3
info:
  title: Legnext AI API
  description: >
    Comprehensive API for professional image and video generation and
    manipulation using Midjourney AI models.


    ## Authentication

    All API requests require an API key passed in the `x-api-key` header.


    ## Base URL

    `https://api.legnext.ai/api`


    ## Rate Limiting

    API requests are rate limited based on your subscription plan.


    ## Webhook Support

    Most endpoints support optional callbacks. When a callback URL is provided,
    the API will POST the completed job result to that URL.
  version: 1.0.0
  contact:
    name: Legnext Support
    email: support@legnext.ai
    url: https://legnext.ai
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.legnext.ai/api
    description: Production server
security:
  - ApiKeyAuth: []
tags:
  - name: Image Generation
    description: Text to image, image editing, and manipulation endpoints
  - name: Video Generation
    description: Video creation and enhancement endpoints
  - name: Image Enhancement
    description: AI-powered image upscaling and enhancement using Topaz Labs
  - name: Task Management
    description: Job status tracking and retrieval
  - name: Account
    description: Account information and active tasks management
paths:
  /v1/enhance:
    post:
      tags:
        - Image Generation
      summary: Enhance
      description: >-
        Improve image quality, clarity, and detail at current resolution.
        Requires original image created with `--v7 --draft`
      operationId: enhanceImage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EnhanceRequest'
      responses:
        '200':
          description: Enhance task created successfully
      security:
        - ApiKeyAuth: []
components:
  schemas:
    EnhanceRequest:
      type: object
      required:
        - jobId
        - imageNo
      properties:
        jobId:
          type: string
          format: uuid
          description: ID of the draft mode image to enhance
        imageNo:
          type: integer
          minimum: 0
          maximum: 3
          example: 0
          description: Image number to enhance (0, 1, 2, or 3)
        callback:
          type: string
          format: uri
          description: Callback URL for task completion notifications
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication

````