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

# Create image

{% hint style="info" %}
**Before getting started:** You will need to [create your API key](/api/create-api-key.md).
{% endhint %}

## Create and return a new image URL

<mark style="color:green;">`POST`</mark> `https://mtmx.io/v1/image`

#### Headers

| Name                                            | Type   | Description           |
| ----------------------------------------------- | ------ | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | `Bearer YOUR-API-KEY` |

#### Request Body

| Name                                   | Type    | Description                                                                                                  |
| -------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------ |
| html<mark style="color:red;">\*</mark> | String  | The HTML you want to render for creating an image.                                                           |
| content                                | Object  | Updates values when using Handlebars templating syntax. [Learn more](/api/template-syntax.md).               |
| type                                   | String  | Defines whether to render JPEG or PNG image. Accepted values are `png` and `jpeg`. Default value is `png`.   |
| quality                                | Number  | Defines the quality of JPG images. Not applicable to PNG images. Default value `80`.                         |
| selector                               | String  | Target a specific HTML element to perform the screenshot. Default value is `body`.                           |
| transparent                            | Boolean | Hides default white background and allows capturing screenshots with transparency. Default value is `false`. |

{% tabs %}
{% tab title="200: OK Export created successfully" %}

```javascript
{
    "success": true,
    "url": "https://cdn.mattermix.com/v1/image/62029ad452390ccfd9abcc4f-1644951564719.png"
    "id": "620bfdd2501f2b5c901e2800"
}
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized request" %}

```javascript
{
    "success": false,
    "statusCode": 401,
    "message": "Please provide a valid API key."
}
```

{% endtab %}

{% tab title="402: Payment Required Inactive or cancelled subscription" %}

```javascript
{
    "success": false,
    "statusCode": 402,
    "message": "Active subscription not found."
}
```

{% endtab %}

{% tab title="500: Internal Server Error Internal server error" %}

```javascript
{
    "success": false,
    "statusCode": 500,
    "message": "Server error."
}
```

{% endtab %}

{% tab title="429: Too Many Requests API limit reached" %}

```javascript
{
    "success": false,
    "statusCode": 429,
    "message": "You have reached your monthly export limit set in your account."
}
```

{% endtab %}
{% endtabs %}
