Skip to content

docs / quickstart

Quickstart

Five minutes from account to file. You need an account, an API key and any tool that can send an HTTP request.

Steps

  1. Request an invite, then sign in with Google.
  2. Open API keys in the dashboard, create a key and copy it. It is shown once.
  3. Run one of the examples below with POSTIMAGER_API_KEY set. Each one renders a product card and saves product-card.png.
#!/usr/bin/env bash
# Render a product card and download it. Needs only bash, curl, grep and sed.
# POSTIMAGER_API_KEY=rk_... POSTIMAGER_URL=https://postimager.com ./render.sh
set -euo pipefail
BASE="${POSTIMAGER_URL:-https://postimager.com}"

RESPONSE=$(curl -sS -X POST "$BASE/v1/renders?wait=15" \
  -H "Authorization: Bearer $POSTIMAGER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: product-sku-482-v1" \
  -d '{
    "template": "product-card",
    "size": "square",
    "format": "png",
    "variables": {
      "brand_name": "Kiln & Clay",
      "product_name": "Speckled stoneware mug, 350 ml",
      "price": "₹1,250",
      "image_url": "sample:mug"
    }
  }')

if ! echo "$RESPONSE" | grep -q '"status":"completed"'; then
  echo "Not finished yet or failed: $RESPONSE" >&2
  exit 1
fi
URL=$(echo "$RESPONSE" | sed -n 's/.*"download":{"url":"\([^"]*\)".*/\1/p')
curl -sS -o product-card.png "$URL"
echo "Saved product-card.png"

docs/examples/render.sh · executed against a local server by scripts/test-examples.ts

What happened

The request named a template, a size, a format and the template’s fields. With ?wait=60 the server held the request until the file was ready and returned a render object whose output.download.url is a private link valid for 24 hours. The Idempotency-Key header means running the script twice returns the same render instead of making and counting a second one.