# Generate single image

### Asset Generation Endpoint

`POST /banner-builder/{designId}/generate`

### Generation Characteristics

* Supported Design Type: **Static**
* Response: **Synchronous**
* Generates a single asset based on provided customization parameters

### Output File Types

Supported formats:

* JPEG
* PNG
* WEBP
* AVIF
* Web PDF

You can override the default file type using the `image_file_type` parameter:

* Specify `png`, `jpeg`, `webp`, `avif` or  `pdf`

### Additional information

#### File Type Determination

By default, the file type is automatically selected based on background transparency:

* Transparent background → PNG
* Opaque background → JPEG

#### Important Transparency Consideration

* When generating a JPEG with transparent elements, those areas will be filled with black
* JPEG does not support transparency

### Sample request

Do not forget to replace `{YOUR-API-KEY}` and `{designId}`

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST -H "x-api-key:{YOUR-API-KEY}" -H "Content-Type: application/json"  \
-d '{
  "template_format_name": "main-crisp",
  "elements": {
    "image": {
      "image_url": "https://mycompany.com/image.jpeg",
      "fitting_type": "cover",
      "alignment": "middle center"
    },
    "text_title": {
      "payload": "Send best wishes to your lovelies with little easter gifts!",
      "color": "#FFFFFF",
      "font_size": 48,
      "font": "61566327-33c5-11ea-9877-92672c1b8195",
      "font_weight": 700,
      "line_height": 120,
      "alignment": "top left"
    }
  }
}' \
https://api.abyssale.com/banner-builder/{designId}/generate
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
const axios = require('axios');

const payload = {
  "template_format_name": "main-crisp",
  "elements": {
    "image": {
      "image_url": "https://mycompany.com/image.jpeg",
      "fitting_type": "cover",
      "alignment": "middle center"
    },
    "text_title": {
      "payload": "Send best wishes to your lovelies with little easter gifts!",
      "color": "#FFFFFF",
      "font_size": 48,
      "font": "61566327-33c5-11ea-9877-92672c1b8195",
      "font_weight": 700,
      "line_height": 120,
      "alignment": "top left"
    }
  }
}

axios.post("https://api.abyssale.com/banner-builder/{designId}/generate", payload, {
    headers: {"x-api-key": "{YOUR-API-KEY}", "Content-Type": "application/json", "timeout": 30000}
  }).then(response => {
    console.log(response.data)
})
```

{% endtab %}

{% tab title="Python" %}

```python
import json
import requests

image_generation_payload = {
  "template_format_name": "main-crisp",
  "elements": {
    "image": {
      "image_url": "https://mycompany.com/image.jpeg",
      "fitting_type": "cover",
      "alignment": "middle center"
    },
    "text_title": {
      "payload": "Send best wishes to your lovelies with little easter gifts!",
      "color": "#FFFFFF",
      "font_size": 48,
      "font": "61566327-33c5-11ea-9877-92672c1b8195",
      "font_weight": 700,
      "line_height": 120,
      "alignment": "top left"
    }
  }
}

r = requests.post("https://api.abyssale.com/banner-builder/{designId}/generate",
  headers={"x-api-key": "YOUR-API-KEY", "Content-Type": "application/json"},
  data=json.dumps(image_generation_payload),
  timeout=30
)
r.json()
```

{% endtab %}
{% endtabs %}

### Sample response

```json
{
  "id": "5978e8d9-ab34-4735-a2cb-fe95c2c56251",
  "version": 1,
  "sharing_id": "5fcec999-2bfb-4dd7-ba38-2d9e16c49149",
  "file": {
    "type": "jpeg",
    "url": "https://production-banners.s3.eu-west-1.amazonaws.com/demo/996739f4-b563-428a-a6e8-dd3cb8bd03d4.jpeg",
    "cdn_url": "https://cdn.abyssale.com/demo/996739f4-b563-428a-a6e8-dd3cb8bd03d4.jpeg",
    "filename": "996739f4-b563-428a-a6e8-dd3cb8bd03d4.jpeg"
  },
  "format": {
    "id": "Facebook Feed",
    "width": 1200,
    "height": 628
  },
  "template": {
    "id": "46d22c62-d134-44d3-a040-138e4ea9ea08",
    "name": "Abyssale demo - FB Feed",
    "created_at": 1602256303,
    "updated_at": 1602685407
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.abyssale.com/rest-api/generation/synchronous-generation/generate-single-image.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
