PHP
PhpPHP
Generate an image from a template with a single POST request, using PHP's built-in cURL extension. Imejis returns the finished image directly, 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.
PHP (cURL)
<?php
$designId = getenv("IMEJIS_DESIGN_ID");
$apiKey = getenv("IMEJIS_API_KEY");
$payload = json_encode(["headline.text" => "Hello from PHP"]);
$ch = curl_init("https://render.imejis.io/v1/$designId");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["dma-api-key: $apiKey", "Content-Type: application/json"],
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
]);
$image = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
file_put_contents("output.jpg", $image);
echo "status $status bytes " . strlen($image) . "\n";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.