> For the complete documentation index, see [llms.txt](https://docs.htmlcsstoimg.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.htmlcsstoimg.com/html-to-image-api/generating-an-image.md).

# Generating an Image

Using the HTML CSS to Image API, you can generate an image from a URL or using HTML + CSS.

<mark style="color:green;">`POST`</mark> `https://api.htmlcsstoimg.com/api/v1/generateImage`

Captures an image from a Web URL or generates an image from HTML & CSS

#### Headers

| Name                                             | Type   | Description                                                    |
| ------------------------------------------------ | ------ | -------------------------------------------------------------- |
| CLIENT-API-KEY<mark style="color:red;">\*</mark> | String | API Key for your account. Will be available on your dashboard. |

#### Request Body

| Name               | Type    | Description                                                                               |
| ------------------ | ------- | ----------------------------------------------------------------------------------------- |
| html\_content      | String  | HTML Content to be used for image generation                                              |
| css\_content       | String  | CSS Content to be used for image generation                                               |
| font               | String  | Google Font Name that needs to be imported when generating image from HTML & CSS          |
| url                | String  | URL of the Webpage whose screenshot is to be captured                                     |
| viewPortWidth      | Number  | Height of View Port. Default value is 1080                                                |
| viewPortHeight     | Number  | Height of View Port. Default value is 720                                                 |
| quality            | Number  | Quality of the image should be in the range 30-100. Default value is 30.                  |
| generate\_img\_url | Boolean | Whether the output should return the image or the Image URL. Default value is true.       |
| full\_page         | Boolean | Whether to capture full-page screenshot of the URL. Default value is false.               |
| wait\_till         | Number  | Number of seconds to wait before capturing a screenshot from the URL. Default value is 0. |

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}
{% endtabs %}
