Python
Generate images from a template with the requests library. Imejis returns the finished image directly in the response, so there is nothing to poll and no webhook to receive.
Set two environment variables first: IMEJIS_API_KEY (from your dashboard) and IMEJIS_DESIGN_ID (any design's id). Then send the fields you want to change as component.property pairs: headline.text, title.color, image.image. Only the fields you send change; everything else keeps its designed value, and a design's overridable fields are listed in its Share / API panel.
Every block below is a copy-paste runnable program, and every one of them is executed in Docker against a real render service before it ships.
Generate a single imageGenerate a single image
One POST, one image. The response body is the rendered image itself, with nothing to poll and no webhook to receive.
import os
import requests
API_KEY = os.environ["IMEJIS_API_KEY"]
DESIGN_ID = os.environ["IMEJIS_DESIGN_ID"]
BASE = os.environ.get("IMEJIS_RENDER_URL", "https://render.imejis.io")
HEADERS = {"dma-api-key": API_KEY, "Content-Type": "application/json"}
# Render one image. The response body IS the image — no polling, no webhook.
response = requests.post(
f"{BASE}/v1/{DESIGN_ID}",
headers=HEADERS,
json={
"headline.text": "Hello from Python",
"subtitle.text": "Rendered in one request",
},
)
response.raise_for_status()
with open("output.jpg", "wb") as f:
f.write(response.content)
print("single:", response.status_code, len(response.content), "bytes")Every output format png jpeg webp and pdfEvery output format: PNG, JPEG, WebP and PDF
Pick the output with ?format=. PNG and WebP keep transparency, JPEG is the smallest lossy option, and PDF is a single print-ready page. ?quality= applies to JPEG only.
import os
import requests
API_KEY = os.environ["IMEJIS_API_KEY"]
DESIGN_ID = os.environ["IMEJIS_DESIGN_ID"]
BASE = os.environ.get("IMEJIS_RENDER_URL", "https://render.imejis.io")
HEADERS = {"dma-api-key": API_KEY, "Content-Type": "application/json"}
# Every output format, with JPEG quality. PNG/WebP keep transparency; PDF is a
# single print-ready page. `quality` only affects JPEG.
for fmt, ext in (("png", "png"), ("jpeg", "jpg"), ("webp", "webp"), ("pdf", "pdf")):
params = {"format": fmt}
if fmt == "jpeg":
params["quality"] = 85
response = requests.post(
f"{BASE}/v1/{DESIGN_ID}",
headers=HEADERS,
params=params,
json={"headline.text": f"Format: {fmt}"},
)
response.raise_for_status()
with open(f"output.{ext}", "wb") as f:
f.write(response.content)
print(f"formats: {fmt}", response.headers["content-type"], len(response.content))Render multiple sizes from one templateRender multiple sizes from one template
A multi-size design carries several canvases: an OG image, a square post, a vertical story. ?variation=<id> picks which one you get back; omit it for the base size.
import os
import requests
API_KEY = os.environ["IMEJIS_API_KEY"]
DESIGN_ID = os.environ["IMEJIS_DESIGN_ID"]
BASE = os.environ.get("IMEJIS_RENDER_URL", "https://render.imejis.io")
HEADERS = {"dma-api-key": API_KEY, "Content-Type": "application/json"}
# One template, many sizes. `?variation=<id>` picks the size; omit it for the
# base. The ids come from the design's Share / API panel.
response = requests.post(
f"{BASE}/v1/{DESIGN_ID}",
headers=HEADERS,
params={"format": "png", "variation": os.environ.get("IMEJIS_VARIATION_ID", "story")},
json={"headline.text": "Story size"},
)
response.raise_for_status()
print("variation:", response.status_code, len(response.content), "bytes")An image url for img tags email and thumbnailsAn image URL for <img> tags, email and thumbnails
The same render as a plain GET URL, with the field values in the query string. Drop it into an <img src>, an HTML email, or a Slack message and it renders fresh every time it is fetched.
import os
import requests
API_KEY = os.environ["IMEJIS_API_KEY"]
DESIGN_ID = os.environ["IMEJIS_DESIGN_ID"]
BASE = os.environ.get("IMEJIS_RENDER_URL", "https://render.imejis.io")
HEADERS = {"dma-api-key": API_KEY, "Content-Type": "application/json"}
# The same render as a plain GET URL — drop it straight into an <img> tag, an
# email, or a Slack message. Field overrides ride the query string.
params = {
"dma-api-key": API_KEY,
"format": "png",
"headline.text": "Hello from a URL",
"subtitle.text": "No request body needed",
}
url = requests.Request("GET", f"{BASE}/v1/{DESIGN_ID}", params=params).prepare().url
print("get:", url)
response = requests.get(url)
response.raise_for_status()
print("get:", response.status_code, len(response.content), "bytes")Hosted delivery get a public image url backHosted delivery: get a public image URL back
?delivery=hosted stores the render and returns a public URL instead of raw bytes, which is what an email, a webhook payload, or a dashboard needs: a link rather than a file.
import os
import requests
API_KEY = os.environ["IMEJIS_API_KEY"]
DESIGN_ID = os.environ["IMEJIS_DESIGN_ID"]
BASE = os.environ.get("IMEJIS_RENDER_URL", "https://render.imejis.io")
HEADERS = {"dma-api-key": API_KEY, "Content-Type": "application/json"}
# delivery=hosted stores the render and returns a PUBLIC URL instead of bytes —
# for an <img src>, an email, or a webhook payload.
response = requests.post(
f"{BASE}/v1/{DESIGN_ID}",
headers=HEADERS,
params={"delivery": "hosted", "format": "png"},
json={"headline.text": "Hosted delivery"},
)
response.raise_for_status()
hosted = response.json()
print("hosted:", hosted["url"], hosted["file"]["size"], "bytes")Signed delivery a private expiring image urlSigned delivery: a private, expiring image URL
?delivery=signed stores the render privately and returns a time-limited signed URL. ?expiresIn= is minutes.
import os
import requests
API_KEY = os.environ["IMEJIS_API_KEY"]
DESIGN_ID = os.environ["IMEJIS_DESIGN_ID"]
BASE = os.environ.get("IMEJIS_RENDER_URL", "https://render.imejis.io")
HEADERS = {"dma-api-key": API_KEY, "Content-Type": "application/json"}
# delivery=signed stores it privately and returns a time-limited signed URL.
# `expiresIn` is minutes (default 60, max 7 days).
response = requests.post(
f"{BASE}/v1/{DESIGN_ID}",
headers=HEADERS,
params={"delivery": "signed", "format": "png", "expiresIn": 30},
json={"headline.text": "Signed delivery"},
)
response.raise_for_status()
signed = response.json()
print("signed:", signed["expiresAt"], signed["url"][:80] + "...")Bulk image generation in one callBulk image generation in one call
POST /bulk to render many images in a single request: several sizes, several data variants, a mix of designs, or the ordered slides of a carousel. results preserves input order, so results[i] is items[i].
import os
import requests
API_KEY = os.environ["IMEJIS_API_KEY"]
DESIGN_ID = os.environ["IMEJIS_DESIGN_ID"]
BASE = os.environ.get("IMEJIS_RENDER_URL", "https://render.imejis.io")
HEADERS = {"dma-api-key": API_KEY, "Content-Type": "application/json"}
# Many images in ONE call. `results` keeps input order, so results[i] is
# items[i] — for a carousel the array IS the slide order. Each item is one
# metered render, and a failed item does not abort the rest.
response = requests.post(
f"{BASE}/bulk",
headers=HEADERS,
json={
"delivery": "hosted",
"format": "png",
"items": [
{"designId": DESIGN_ID, "overrides": {"headline.text": "Slide 1"}},
{
"designId": DESIGN_ID,
"variation": os.environ.get("IMEJIS_VARIATION_ID", "story"),
"format": "jpeg",
"quality": 80,
"overrides": {"headline.text": "Slide 2"},
},
{"designId": DESIGN_ID, "format": "pdf", "overrides": {"headline.text": "Slide 3"}},
],
},
)
response.raise_for_status()
bulk = response.json()
print("bulk:", bulk["summary"])
for item in bulk["results"]:
print(" ", item["index"], item.get("format"), item.get("url", item.get("error")))Bulk from a list of rowsBulk from a list of rows
Send data instead of items and every row becomes one render, with no item list to build. That is the shape to reach for when the input is a spreadsheet, a database query, or a CSV.
import os
import requests
API_KEY = os.environ["IMEJIS_API_KEY"]
DESIGN_ID = os.environ["IMEJIS_DESIGN_ID"]
BASE = os.environ.get("IMEJIS_RENDER_URL", "https://render.imejis.io")
HEADERS = {"dma-api-key": API_KEY, "Content-Type": "application/json"}
# The same design over a LIST OF ROWS — one render per row, no items[] to build.
# `variations: ["master", "story"]` instead of `data` renders every SIZE.
response = requests.post(
f"{BASE}/bulk",
headers=HEADERS,
json={
"designId": DESIGN_ID,
"delivery": "signed",
"expiresIn": 15,
"format": "png",
"data": [
{"headline.text": "Ada Lovelace", "subtitle.text": "Mathematician"},
{"headline.text": "Alan Turing", "subtitle.text": "Computer scientist"},
{"headline.text": "Grace Hopper", "subtitle.text": "Rear admiral"},
],
},
)
response.raise_for_status()
rows = response.json()
print("bulk-data:", rows["summary"])The response is the raw image (`image/jpeg` by default). Choose the format with `?format=png|jpeg|webp|pdf` (default jpeg) and set JPEG quality with `?quality=1-100`. Store the result and get a URL back with `?delivery=hosted` (or `?delivery=signed&expiresIn=60`), and render a specific size of a multi-size design with `?variation=<id>`.
| Parameter | Values | Default | What it does |
|---|---|---|---|
?format= | png · jpeg · webp · pdf | jpeg | Output image format. |
?quality= | 1–100 | none | Compression quality for lossy output; ignored for other formats. (JPEG only) |
?delivery= | stream · hosted · signed | stream | stream = raw image bytes (default); hosted = store + return a public URL; signed = store + return a time-limited URL. |
?expiresIn= | minutes | 60 | Signed-URL lifetime in minutes (default 60, max 10080 = 7 days). (delivery=signed only) |
?variation= | <size id> | master | Which multi-dimension SIZE to render. Omit or use "master" for the base size; an unknown id falls back to the master. (multi-size designs only) |
- PNG (
?format=png): Lossless, supports transparency. Largest file. - JPEG (
?format=jpeg): Smaller, lossy, no transparency. Quality adjustable. - WebP (
?format=webp): Smallest, supports transparency. Modern browsers. - PDF (
?format=pdf): Vector page, for print and documents.
See the delivery modes and generate images with the API guides.
Behind a web framework the same call becomes a route: see Django, Flask or FastAPI. requests.post blocks until the render finishes, so give it a timeout and keep it off the request path of a page that has to answer fast. Each call is one render, and 100 a month are free; pricing has the paid tiers.