Go icon

Go

GoGo

Generate an image from a template with a single POST request, using only the Go standard library. 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.

Go (net/http)
package main
 
import (
	"bytes"
	"fmt"
	"io"
	"net/http"
	"os"
)
 
func main() {
	designID := os.Getenv("IMEJIS_DESIGN_ID")
	apiKey := os.Getenv("IMEJIS_API_KEY")
	body := []byte(`{"headline.text":"Hello from Go"}`)
 
	req, _ := http.NewRequest("POST", "https://render.imejis.io/v1/"+designID, bytes.NewBuffer(body))
	req.Header.Set("dma-api-key", apiKey)
	req.Header.Set("Content-Type", "application/json")
 
	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
 
	image, _ := io.ReadAll(res.Body)
	os.WriteFile("output.jpg", image, 0644)
	fmt.Println("status", res.StatusCode, "bytes", len(image))
}

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.