# Synchronous generation

### Endpoint

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

### Key Characteristics

* Immediate asset creation
* Single asset generation
* Supports on **static design**
* Instant response with asset URL

### Generation Process

1. Send design ID and customization parameters
2. Receive immediate response
3. Asset generated and URL provided

### Diagram

<figure><img src="/files/Ni3u9wtpUjeCsE9WSUhB" alt=""><figcaption></figcaption></figure>

### API Documentation

{% openapi src="/files/0SWKw14BhWglHZiDdm6e" path="/banner-builder/{templateId}/generate" method="post" %}
[api.yaml](https://3568284716-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHvY8mOYKzvcoxVpCu4FE%2Fuploads%2Fl3JBKAVLulvhrNPtgnPy%2Fapi.yaml?alt=media\&token=81dddadd-2b10-4f3c-9267-158c43dd3a3e)
{% endopenapi %}

You can find all layers properties in this [section](/rest-api/generation/element-properties.md)

### 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",
  "file": {
    "type": "jpeg",
    "url": "https://production-banners.s3.eu-west-1.amazonaws.com/demo/996739f4-b563-428a-a6e8-ec3cb8bd03d4.jpeg",
    "cdn_url": "https://cdn.abyssale.com/demo/996739f4-b563-428a-a6e8-ec3cb8bd03d4.jpeg",
    "filename": "996739f4-b563-428a-a6e8-ec3cb8bd03d4.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
  }
}
```

### What are the 2 image URLs?

As you can see in the sample response, 2 image urls are returned:

* A link (the `url` property) pointing directly to the Abyssale object storage service (S3).
  * Example: <https://production-banners.s3.eu-west-1.amazonaws.com/demo/996739f4-b563-428a-a6e8-ec3cb8bd03d4.jpeg>
  * [Hotlinking](https://simple.wikipedia.org/wiki/Hotlinking) is allowed (a fair usage policy applies) but is not recommended as those URLs are **not** designed to have low latency and high transfer speeds features.
* A CDN link (the `cdn_url` property):
  * Example (not reachable): <https://cdn.abyssale.com/demo/996739f4-b563-428a-a6e8-ec3cb8bd03d4.jpeg>
  * Those URL are designed for high-speed & low-latency performance. A limited bandwidth applies to all plans (see the [pricing table](https://www.abyssale.com/pricing/)).

### Progress your design generation journey by diving deeper into configuration

* [**Generate single image**](/rest-api/generation/synchronous-generation/generate-single-image.md)


---

# 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.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.
