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

# POST /image/generate — AI Image Generation API

> Generate AI images from text prompts via the Verbosec API. Control size, style, and count. Returns image URLs ready for download or embedding.

The Nexus Image Generation endpoint lets you create AI-generated images directly from a text description. You specify what the image should contain and optionally control the visual style, output dimensions, and how many images to produce in a single request. The API returns a list of image URLs hosted on the Verbosec CDN that you can download or embed immediately.

**Endpoint**

```
POST https://api.verbosec.com/v1/image/generate
```

## Request parameters

<ParamField body="prompt" type="string" required>
  A text description of the image you want to generate. The more descriptive and specific your prompt, the more accurately the output will reflect your intent.
</ParamField>

<ParamField body="style" type="string">
  The visual style applied to the generated image. Accepted values are `"photorealistic"`, `"illustration"`, and `"abstract"`. Defaults to `"photorealistic"`.
</ParamField>

<ParamField body="size" type="string">
  The pixel dimensions of the output image. Accepted values are `"512x512"`, `"1024x1024"`, and `"1024x1792"`. Defaults to `"1024x1024"`. Choose `"1024x1792"` for portrait-format images.
</ParamField>

<ParamField body="count" type="integer">
  The number of images to generate in this request. Accepts an integer between `1` and `4` inclusive. Defaults to `1`. Each image consumes tokens separately.
</ParamField>

## Example request

```bash generate-image.sh theme={null}
curl -X POST https://api.verbosec.com/v1/image/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A sunlit mountain lake at dawn with mist rising off the water",
    "style": "photorealistic",
    "size": "1024x1024",
    "count": 2
  }'
```

## Example response

```json response.json theme={null}
{
  "id": "img_xyz789",
  "images": [
    {
      "url": "https://cdn.verbosec.com/images/img_xyz789_1.png",
      "size": "1024x1024"
    },
    {
      "url": "https://cdn.verbosec.com/images/img_xyz789_2.png",
      "size": "1024x1024"
    }
  ],
  "created_at": "2025-01-15T10:31:00Z"
}
```

## Response fields

<ResponseField name="id" type="string">
  A unique identifier for this image generation request.
</ResponseField>

<ResponseField name="images" type="array">
  An array of image objects, one for each image generated. The length of this array matches the `count` value you specified in the request.

  <Expandable title="Image object fields">
    <ResponseField name="images[].url" type="string">
      The CDN URL where the generated image is hosted. Use this URL to download or embed the image.
    </ResponseField>

    <ResponseField name="images[].size" type="string">
      The pixel dimensions of this specific image, reflecting the `size` parameter you passed.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="created_at" type="string">
  An ISO 8601 timestamp indicating when the images were generated.
</ResponseField>

<Note>
  Image URLs are available for **24 hours** after generation. If you need to retain the images beyond that window, download them to your own storage immediately after the request completes.
</Note>

## Error responses

<Accordion title="400 Bad Request — Missing or invalid parameters">
  Returned when the `prompt` field is missing or a parameter value falls outside its accepted range (for example, `count: 5`).

  ```json 400-response.json theme={null}
  {
    "error": {
      "code": "invalid_parameter",
      "message": "The 'count' parameter must be between 1 and 4."
    }
  }
  ```
</Accordion>

<Accordion title="401 Unauthorized">
  Returned when your API key is missing or invalid. See the [Authentication guide](/api-reference/authentication) for help.

  ```json 401-response.json theme={null}
  {
    "error": {
      "code": "unauthorized",
      "message": "Invalid or missing API key."
    }
  }
  ```
</Accordion>

<Accordion title="429 Too Many Requests — Rate limited">
  Returned when you have exceeded your plan's rate limit. Check the `Retry-After` header and wait before resending the request.

  ```json 429-response.json theme={null}
  {
    "error": {
      "code": "rate_limit_exceeded",
      "message": "You have exceeded your plan's rate limit. Please wait before retrying."
    }
  }
  ```
</Accordion>
