Generate a single image

How to generate synchronously a single image - Abyssale REST API

A single image is created by sending data and customisation parameters to the POST /banner-builder/{templateId}/generate endpoint, which will respond synchronously with a payload containing the URL of the generated image

  • Supported template type: Static

  • Generation response type: Synchronous

Properties available for each type of component are available here.

If no parameter is sent, the generated image will correspond to the first format of the template with the default properties.

What type of image file is returned?

Only 2 image filetypes are supported (jpeg & png).

By default, Abyssale automatically determine the filetype from the format background color:

  • If the background color contains transparency (alpha < 100), the generated image will be a PNG.

  • Otherwise, the generated image will be a JPEG.

The default behavior can be overriden by using the image_file_type property (accepted values: png or jpeg).

Note that if you use jpeg for a template that contains transparency, it will be generated using a black opaque colour (as jpeg does not support transparency).

Get the default payload

To ease the creation of your payload, just go to one of your Template and choose Abyssale Rest API in the Generation Methods list. You will find the default associated payload in the console (Feel free to remove unnecessary properties/elements):

Sample request

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

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://production-banners.s3-eu-west-1.amazonaws.com/templates/e0d292f2-ec21-11e9-a539-3c408bf94155/9c872731-da6f-4923-b342-7c4250ac94cc/assets/370af020-5e56-445d-bdf7-02e819658a8a.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/{templateId}/generate

Sample response

{
  "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:

Errors

The Abyssale Image Generation API can return the following error codes :

Last updated