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

# Image Generate API Overview

> Comprehensive guide to the Image Generate API

<Warning>
  The resources (image, video, voice) generated by our API are valid for 7 days.
  Please save the relevant resources as soon as possible to prevent expiration.
</Warning>

## API Endpoints

### Image Generate Operations

* [Text to Image / Image to Image](/ai-tools-suite/image-generate/create-by-source-prompt) - Create images from text prompts or transform existing images (V4)
* [Generate 4K or Variations](/ai-tools-suite/image-generate/create-by-button) - Upscale images to 4K or generate variations from existing results
* [Get Image Result](/ai-tools-suite/image-generate/get-result) - Retrieve image generation results by ID

## Getting Started

### Basic Workflow

1. **Create Image**:
   * Prepare your text prompt describing the desired image
   * Optionally provide a source image for image-to-image transformation
   * Call the [Create By Source Prompt API](/ai-tools-suite/image-generate/create-by-source-prompt) with your parameters

2. **Check Results**:
   * Use the [Get Image Result API](/ai-tools-suite/image-generate/get-result) to check the status
   * Download the result URL when the status is "Completed" (image\_status = 3)

3. **Upscale or Generate Variations** (Optional):
   * Get available buttons from the [Get Image Result API](/ai-tools-suite/image-generate/get-result) response (`buttons` field)
   * Call the [Generate 4K or Variations API](/ai-tools-suite/image-generate/create-by-button) with the desired operation

### Response Code Description

<Note>
  Please note that if the value of the response code is not equal to 1000, the request
  has failed or encountered an error.
</Note>

| Code | Description                                            |
| ---- | ------------------------------------------------------ |
| 1000 | Success                                                |
| 1003 | Parameter error or Parameter cannot be empty           |
| 1008 | The content you get does not exist                     |
| 1009 | You do not have permission to operate                  |
| 1010 | You cannot operate this content                        |
| 1101 | Invalid authorization or The request token has expired |
| 1102 | Authorization cannot be empty                          |
| 1108 | Image generate error, please try again later           |
| 1200 | The account has been banned                            |

## Image Status Codes

When checking results, the `image_status` field indicates the current state:

| Status | Description                                               |
| ------ | --------------------------------------------------------- |
| 1      | In Queue - Your request is waiting to be processed        |
| 2      | Processing - Image is currently being generated           |
| 3      | Success - Image completed, result URL is available        |
| 4      | Failed - Image generation failed, please check your input |

## Best Practices

### Prompt Tips

* **Be Descriptive**: Use detailed prompts with specific adjectives, styles, and compositions
* **Source Image**: For image-to-image, provide a clear high-quality source image
* **Aspect Ratio**: Choose the appropriate `scale` parameter based on your use case (1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3)

### API Usage Tips

* **Webhook**: Use the `webhookurl` parameter to receive notifications when processing is complete
* **Batch Generation**: Use `batch_quantity` (1-4) to generate multiple images in a single request
* **4K Upscale**: Use buttons U1-U4 to upscale specific images to 4K resolution
* **Variations**: Use buttons V1-V4 to generate variations of specific images
* **Result Cleanup**: Save generated images promptly as they expire after 7 days

## Support

For additional help and examples, check out our:

* [Authentication Guide](/authentication/usage)
* [Webhook Documentation](/ai-tools-suite/webhook)
