---
title: "Python"
description: "Generate images with the Imejis.io API in Python using requests. A tested example that POSTs dynamic field overrides to a design and saves the rendered image."
url: "https://www.imejis.io/apis/python"
published: "2026-07-25"
---

# Python

## Python

Generate an image from a template with a single POST request. Imejis returns the finished image directly in the response, so there are no webhooks and nothing to poll.

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, for example `headline.text`.

```python showLineNumbers title="Python (requests)"
import os
import requests

design_id = os.environ["IMEJIS_DESIGN_ID"]
api_key = os.environ["IMEJIS_API_KEY"]

response = requests.post(
    f"https://render.imejis.io/v1/{design_id}",
    headers={"dma-api-key": api_key, "Content-Type": "application/json"},
    json={"headline.text": "Hello from Python"},
)
response.raise_for_status()
with open("output.jpg", "wb") as f:
    f.write(response.content)
print("status", response.status_code, "bytes", len(response.content))
```

**Override any field.** Each dynamic component exposes keys like `headline.text`, `title.color`, or `image.image`. Send only the ones you want to change. You can find a design's overridable fields in its Share / API panel.

The response is the raw image (`image/jpeg` by default). Save it to disk, stream it, or return it straight from your own endpoint.
