# Generate Multi-Format images

### Asynchronous Asset Generation Endpoint

`POST /async/banner-builder/{design_id}/generate`

### Generation Characteristics

* Supported Design Type: **Static**
* Response: **Asynchronous**
* Enables batch generation of multiple assets
* Retrieval methods:
  * Webhooks
  * Polling

### Output File Types

Supported formats:

* JPEG
* PNG
* WEBP
* AVIF
* Web PDF

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

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

### Additional information

#### Retrieval Mechanism

* Initial request returns a `generation_request_id`
* You can track generation status and retrieve results using:
  * [Webhook notifications](/rest-api/generation/asynchronous-generation.md#webhook-configuration)
  * [Periodic API polling](/rest-api/generation/asynchronous-generation.md#polling-configuration)

#### Key Differences from Synchronous Generation

* All formats of a design can be generated by removing the `template_format_names` property.
* Supports bulk asset creation
* Allows handling of complex or time-consuming generation tasks
* Provides flexibility in result retrieval

#### **The `callback_url` request parameter and the asynchronous mechanism**

As this method is asynchronous you should provide a `callback_url`. [Check how the asynchronous generation works](/rest-api/generation/asynchronous-generation.md#notification-mechanism)

### Sample request <a href="#sample-request" id="sample-request"></a>

​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 '{
  "callback_url": "https://webhook.mycompany.com/images",
  "template_format_names": ["facebook-feed", "instagram-post", "iab-medium"],
  "elements": {
    "primary_text": {
        "payload": "New branding available.",
        "color": "#FF0000"
    }
  }
}' \
https://api.abyssale.com/async/banner-builder/{design_id}/generate
```

{% endtab %}

{% tab title="Javascript" %}

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

const payload = {
  "callback_url": "https://webhook.mycompany.com/images",
  "template_format_names": ["facebook-feed", "instagram-post", "iab-medium"],
  "elements": {
    "primary_text": {
        "payload": "New branding available.",
        "color": "#FF0000"
    }
  }
}

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

{% endtab %}

{% tab title="Python" %}

```python
import json
import requests

image_generation_payload = {
  "callback_url": "https://webhook.mycompany.com/images",
  "template_format_names": ["facebook-feed", "instagram-post", "iab-medium"],
  "elements": {
    "primary_text": {
        "payload": "New branding available.",
        "color": "#FF0000"
    }
  }
}

# Do not forget to replace {YOUR-API-KEY} and {template_id}
r = requests.post("https://api.abyssale.com/async/banner-builder/{design_id}/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 <a href="#sample-response" id="sample-response"></a>

```
{
  "generation_request_id": "df75afa8-5a77-4e03-aeef-6d1b6dd0580a"
}
```


---

# 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/asynchronous-generation/generate-multi-format-images.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.
