Generate Event Ticket

Generate an event ticket image with QR code, event name, date, venue, and seat information.

Who this is for

Event platforms and ticketing services use this recipe to generate branded, scannable tickets at scale. Define a dark canvas with a gradient accent bar, render the event name, date, venue, and seat details alongside a QR code — ready for mobile wallets, email delivery, or print-at-home.

Request
curl -X POST https://api.iterationlayer.com/image-generation/v1/render \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dimensions": { "width": 900, "height": 400 },
    "layers": [
      {
        "index": 0,
        "type": "solid-color",
        "hex_color": "#1E1B4B"
      },
      {
        "index": 1,
        "type": "gradient",
        "gradient_type": "linear",
        "angle_in_degrees": 90.0,
        "colors": [
          { "hex_color": "#7C3AED", "position": 0.0 },
          { "hex_color": "#EC4899", "position": 100.0 }
        ],
        "position": { "x": 0.0, "y": 0.0 },
        "dimensions": { "width": 900, "height": 8 }
      },
      {
        "index": 2,
        "type": "text",
        "text": "React Summit 2026",
        "font_name": "Inter",
        "font_size_in_px": 36,
        "text_color": "#FFFFFF",
        "font_weight": "Bold",
        "position": { "x": 40.0, "y": 40.0 },
        "dimensions": { "width": 560, "height": 50 }
      },
      {
        "index": 3,
        "type": "text",
        "text": "June 15, 2026 — Moscone Center, San Francisco",
        "font_name": "Inter",
        "font_size_in_px": 18,
        "text_color": "#A5B4FC",
        "position": { "x": 40.0, "y": 110.0 },
        "dimensions": { "width": 560, "height": 30 }
      },
      {
        "index": 4,
        "type": "text",
        "text": "Section B · Row 12 · Seat 7",
        "font_name": "Inter",
        "font_size_in_px": 22,
        "text_color": "#E0E7FF",
        "font_weight": "Bold",
        "position": { "x": 40.0, "y": 180.0 },
        "dimensions": { "width": 560, "height": 40 }
      },
      {
        "index": 5,
        "type": "qr-code",
        "value": "TKT-2026-RS-04821",
        "position": { "x": 660.0, "y": 60.0 },
        "dimensions": { "width": 180, "height": 180 },
        "fg_hex_color": "#FFFFFF",
        "bg_hex_color": "#1E1B4B"
      },
      {
        "index": 6,
        "type": "text",
        "text": "Presented by ReactConf Inc.",
        "font_name": "Inter",
        "font_size_in_px": 14,
        "text_color": "#6366F1",
        "position": { "x": 40.0, "y": 340.0 },
        "dimensions": { "width": 400, "height": 30 }
      }
    ],
    "output_format": "png"
  }'
Response
{
  "success": true,
  "data": {
    "buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
    "mime_type": "image/png"
  }
}
Request
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });

const result = await client.generateImage({
  dimensions: { width_in_px: 900, height_in_px: 400 },
  output_format: "png",
  layers: [
    {
      index: 0,
      type: "solid-color",
      hex_color: "#1E1B4B",
    },
    {
      index: 1,
      type: "gradient",
      gradient_type: "linear",
      angle_in_degrees: 90.0,
      colors: [
        { hex_color: "#7C3AED", position: 0.0 },
        { hex_color: "#EC4899", position: 100.0 },
      ],
      position: { x_in_px: 0, y_in_px: 0 },
      dimensions: { width_in_px: 900, height_in_px: 8 },
    },
    {
      index: 2,
      type: "text",
      text: "React Summit 2026",
      font_name: "Inter",
      font_size_in_px: 36,
      text_color: "#FFFFFF",
      font_weight: "Bold",
      position: { x_in_px: 40, y_in_px: 40 },
      dimensions: { width_in_px: 560, height_in_px: 50 },
    },
    {
      index: 3,
      type: "text",
      text: "June 15, 2026 — Moscone Center, San Francisco",
      font_name: "Inter",
      font_size_in_px: 18,
      text_color: "#A5B4FC",
      position: { x_in_px: 40, y_in_px: 110 },
      dimensions: { width_in_px: 560, height_in_px: 30 },
    },
    {
      index: 4,
      type: "text",
      text: "Section B · Row 12 · Seat 7",
      font_name: "Inter",
      font_size_in_px: 22,
      text_color: "#E0E7FF",
      font_weight: "Bold",
      position: { x_in_px: 40, y_in_px: 180 },
      dimensions: { width_in_px: 560, height_in_px: 40 },
    },
    {
      index: 5,
      type: "qr-code",
      value: "TKT-2026-RS-04821",
      position: { x_in_px: 660, y_in_px: 60 },
      dimensions: { width_in_px: 180, height_in_px: 180 },
      fg_hex_color: "#FFFFFF",
      bg_hex_color: "#1E1B4B",
    },
    {
      index: 6,
      type: "text",
      text: "Presented by ReactConf Inc.",
      font_name: "Inter",
      font_size_in_px: 14,
      text_color: "#6366F1",
      position: { x_in_px: 40, y_in_px: 340 },
      dimensions: { width_in_px: 400, height_in_px: 30 },
    },
  ],
});

const imageBuffer = Buffer.from(result.data.buffer, "base64");
Response
{
  "success": true,
  "data": {
    "buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
    "mime_type": "image/png"
  }
}
Request
import base64

from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.generate_image(
    dimensions={"width_in_px": 900, "height_in_px": 400},
    output_format="png",
    layers=[
        {
            "index": 0,
            "type": "solid-color",
            "hex_color": "#1E1B4B",
        },
        {
            "index": 1,
            "type": "gradient",
            "gradient_type": "linear",
            "angle_in_degrees": 90.0,
            "colors": [
                {"hex_color": "#7C3AED", "position": 0.0},
                {"hex_color": "#EC4899", "position": 100.0},
            ],
            "position": {"x_in_px": 0, "y_in_px": 0},
            "dimensions": {"width_in_px": 900, "height_in_px": 8},
        },
        {
            "index": 2,
            "type": "text",
            "text": "React Summit 2026",
            "font_name": "Inter",
            "font_size_in_px": 36,
            "text_color": "#FFFFFF",
            "font_weight": "Bold",
            "position": {"x_in_px": 40, "y_in_px": 40},
            "dimensions": {"width_in_px": 560, "height_in_px": 50},
        },
        {
            "index": 3,
            "type": "text",
            "text": "June 15, 2026 — Moscone Center, San Francisco",
            "font_name": "Inter",
            "font_size_in_px": 18,
            "text_color": "#A5B4FC",
            "position": {"x_in_px": 40, "y_in_px": 110},
            "dimensions": {"width_in_px": 560, "height_in_px": 30},
        },
        {
            "index": 4,
            "type": "text",
            "text": "Section B · Row 12 · Seat 7",
            "font_name": "Inter",
            "font_size_in_px": 22,
            "text_color": "#E0E7FF",
            "font_weight": "Bold",
            "position": {"x_in_px": 40, "y_in_px": 180},
            "dimensions": {"width_in_px": 560, "height_in_px": 40},
        },
        {
            "index": 5,
            "type": "qr-code",
            "value": "TKT-2026-RS-04821",
            "position": {"x_in_px": 660, "y_in_px": 60},
            "dimensions": {"width_in_px": 180, "height_in_px": 180},
            "fg_hex_color": "#FFFFFF",
            "bg_hex_color": "#1E1B4B",
        },
        {
            "index": 6,
            "type": "text",
            "text": "Presented by ReactConf Inc.",
            "font_name": "Inter",
            "font_size_in_px": 14,
            "text_color": "#6366F1",
            "position": {"x_in_px": 40, "y_in_px": 340},
            "dimensions": {"width_in_px": 400, "height_in_px": 30},
        },
    ],
)

with open("result.png", "wb") as f:
    f.write(base64.b64decode(result["data"]["buffer"]))
Response
{
  "success": true,
  "data": {
    "buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
    "mime_type": "image/png"
  }
}
Request
package main

import (
    "encoding/base64"
    "os"

    il "github.com/iterationlayer/sdk-go"
)

func main() {
    client := il.NewClient("YOUR_API_KEY")

    result, err := client.GenerateImage(il.GenerateImageRequest{
        Dimensions:   il.Dimensions{WidthInPx: 900, HeightInPx: 400},
        OutputFormat: "png",
        Layers: []il.Layer{
            il.NewSolidColorBackgroundLayer(0, "#1E1B4B"),
            il.NewGradientLayer(1, "linear", []il.GradientColor{
                {HexColor: "#7C3AED", Position: 0.0},
                {HexColor: "#EC4899", Position: 100.0},
            }, il.Position{XInPx: 0, YInPx: 0}, il.Dimensions{WidthInPx: 900, HeightInPx: 8}),
            il.NewTextLayer(2, "React Summit 2026", "Inter", 36, "#FFFFFF",
                il.Position{XInPx: 40, YInPx: 40},
                il.Dimensions{WidthInPx: 560, HeightInPx: 50}),
            il.NewTextLayer(3, "June 15, 2026 — Moscone Center, San Francisco", "Inter", 18, "#A5B4FC",
                il.Position{XInPx: 40, YInPx: 110},
                il.Dimensions{WidthInPx: 560, HeightInPx: 30}),
            il.NewTextLayer(4, "Section B · Row 12 · Seat 7", "Inter", 22, "#E0E7FF",
                il.Position{XInPx: 40, YInPx: 180},
                il.Dimensions{WidthInPx: 560, HeightInPx: 40}),
            il.NewQRCodeLayer(5, "TKT-2026-RS-04821", "#FFFFFF", "#1E1B4B",
                il.Position{XInPx: 660, YInPx: 60},
                il.Dimensions{WidthInPx: 180, HeightInPx: 180}),
            il.NewTextLayer(6, "Presented by ReactConf Inc.", "Inter", 14, "#6366F1",
                il.Position{XInPx: 40, YInPx: 340},
                il.Dimensions{WidthInPx: 400, HeightInPx: 30}),
        },
    })
    if err != nil {
        panic(err)
    }

    decoded, _ := base64.StdEncoding.DecodeString(result.Data.Buffer)
    os.WriteFile("result.png", decoded, 0644)
}
Response
{
  "success": true,
  "data": {
    "buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
    "mime_type": "image/png"
  }
}

Related Recipes

Start building in minutes

Free trial credits included. No credit card required.