{"id":91,"date":"2026-10-15T21:33:03","date_gmt":"2026-10-15T21:33:03","guid":{"rendered":"https:\/\/blog.skndan.com\/jsontoimg\/?p=91"},"modified":"2026-11-17T13:33:06","modified_gmt":"2026-11-17T13:33:06","slug":"getting-started-with-jsontoimg","status":"publish","type":"post","link":"https:\/\/blog.skndan.com\/jsontoimg\/2026\/10\/15\/getting-started-with-jsontoimg\/","title":{"rendered":"Image Generation API Tutorial: Your First Render Call"},"content":{"rendered":"<p>This is the first successful POST \/api\/v1\/render \u2014 not a second homepage. Create an API key, send a template id and optional layer overrides, wait up to 60 seconds, download the file. 25 images are free; no card.<\/p>\n<h2>Overview<\/h2>\n<p>Every product team needs generated images at some point: Open Graph cards for blog posts, product banners for thousands of SKUs, certificates, ad creatives for A\/B tests, personalized email headers. You have three options \u2014 design them by hand in Figma or Canva (doesn\u2019t scale past a few images), run a headless browser like Puppeteer (high maintenance and expensive), or use a purpose-built image generation API.<\/p>\n<p>jsontoimg is the third option, stripped to its core job: <strong>JSON in, image out<\/strong>. You design a template once, send JSON data, and get back a rendered PNG, JPG, WebP, AVIF, or PDF, at any volume.<\/p>\n<p>This tutorial gets you from zero to your first rendered image in about five minutes. By the end you\u2019ll have:<\/p>\n<ul>\n<li>A simple template defined in JSON<\/li>\n<li>Your first API call with <code>curl<\/code><\/li>\n<li>Working examples in Node.js and Python<\/li>\n<li>A batch job generating multiple images in one request<\/li>\n<\/ul>\n<p>No prior image-generation experience needed. If you know what a POST request is, you\u2019re ready.<\/p>\n<h2>What \u201cJSON to Image\u201d Actually Means<\/h2>\n<p>The core idea is a three-part pipeline:<\/p>\n<pre><code>Design a template (once)\n  \u2192 Send JSON data (every time)\n  \u2192 Get an image back (instantly)\n<\/code><\/pre>\n<p>A <strong>template<\/strong> is a design with placeholders \u2014 dynamic text, images, and colors you control through the API. Your <strong>data<\/strong> is plain JSON that fills those placeholders. The <strong>render<\/strong> is the image that comes out.<\/p>\n<p>The power is in the separation: you design the visual once, then any system that can send JSON \u2014 a CMS, a database, a spreadsheet, a webhook \u2014 can produce branded images without touching a design tool. This is the same pattern every serious template-based image API uses: Bannerbear sends a <code>modifications<\/code> array against a template (<a href=\"https:\/\/www.bannerbear.com\/examples\">Bannerbear API Quick Start<\/a>), Placid sends <code>layers<\/code> against a <code>template_uuid<\/code> (<a href=\"https:\/\/placid.app\/docs\/2.0\/rest\/images\">Placid REST API docs<\/a>), and Pixelixe describes it as \u201cone JSON request, one rendered output, unlimited reuse\u201d (<a href=\"https:\/\/pixelixe.com\/developers\/json-to-image-api\">Pixelixe JSON to Image API<\/a>). jsontoimg follows the same convention, so if you\u2019ve used any of them, the mental model transfers immediately.<\/p>\n<h2>Before You Start<\/h2>\n<p>You need two things:<\/p>\n<ol>\n<li><strong>A jsontoimg account and API key<\/strong> \u2014 grab your key from the dashboard. It\u2019s a bearer token; keep it server-side and never in client code.<\/li>\n<li><strong>A way to make HTTP requests<\/strong> \u2014 <code>curl<\/code> works for testing. For real integrations, Node.js 18+ (native <code>fetch<\/code>) or Python 3 with <code>requests<\/code> are covered below.<\/li>\n<\/ol>\n<h2>Step 1: Design Your First Template<\/h2>\n<p>Templates are JSON documents that describe the canvas: dimensions, background, and layers. Here\u2019s a minimal branded card \u2014 a 1200\u00d7630 social share image with a gradient background, a headline, and a subtitle:<\/p>\n<pre><code>{\n  &quot;width&quot;: 1200,\n  &quot;height&quot;: 630,\n  &quot;background&quot;: {\n    &quot;type&quot;: &quot;gradient&quot;,\n    &quot;colors&quot;: [&quot;#1a1a2e&quot;, &quot;#16213e&quot;, &quot;#0f3460&quot;]\n  },\n  &quot;layers&quot;: [\n    {\n      &quot;type&quot;: &quot;text&quot;,\n      &quot;name&quot;: &quot;headline&quot;,\n      &quot;text&quot;: &quot;Your headline goes here&quot;,\n      &quot;font&quot;: { &quot;size&quot;: 72, &quot;weight&quot;: &quot;bold&quot;, &quot;color&quot;: &quot;#ffffff&quot; },\n      &quot;position&quot;: { &quot;x&quot;: 80, &quot;y&quot;: 200 },\n      &quot;width&quot;: 1040,\n      &quot;align&quot;: &quot;left&quot;\n    },\n    {\n      &quot;type&quot;: &quot;text&quot;,\n      &quot;name&quot;: &quot;subtitle&quot;,\n      &quot;text&quot;: &quot;Your subtitle goes here&quot;,\n      &quot;font&quot;: { &quot;size&quot;: 36, &quot;color&quot;: &quot;#a0aec0&quot; },\n      &quot;position&quot;: { &quot;x&quot;: 80, &quot;y&quot;: 330 },\n      &quot;width&quot;: 1040,\n      &quot;align&quot;: &quot;left&quot;\n    }\n  ]\n}\n<\/code><\/pre>\n<p>A few things to note:<\/p>\n<ul>\n<li><strong><code>name<\/code><\/strong> is the layer\u2019s ID \u2014 you\u2019ll reference it in every API call. Keep it stable: <code>headline<\/code>, <code>subtitle<\/code>, <code>logo<\/code>, <code>price<\/code>.<\/li>\n<li><strong><code>text<\/code><\/strong> is the default value. The API overrides it per request, but a sensible default makes the template testable in the editor.<\/li>\n<li><strong>Text styling<\/strong> \u2014 size, weight, color, alignment, and wrapping are all first-class properties. You can also add image layers (for logos and photos) and shape layers (for badges and dividers).<\/li>\n<\/ul>\n<p>Once saved, the template gets a <strong>template ID<\/strong> that you\u2019ll use in all render calls.<\/p>\n<h2>Step 2: Make Your First API Call<\/h2>\n<p>With the template saved, generating an image is a single POST to the render endpoint:<\/p>\n<pre><code>POST https:\/\/app.jsontoimg.com\/api\/v1\/render\n<\/code><\/pre>\n<p>Here\u2019s the same request with <code>curl<\/code>:<\/p>\n<pre><code>curl -X POST &quot;https:\/\/app.jsontoimg.com\/api\/v1\/render?wait=60&quot; \\\n  -H &quot;Authorization: Bearer $JSONTOIMG_API_KEY&quot; \\\n  -H &quot;Content-Type: application\/json&quot; \\\n  -d &#39;{\n    &quot;template&quot;: &quot;social-share-card&quot;,\n    &quot;format&quot;: &quot;png&quot;,\n    &quot;layers&quot;: {\n      &quot;headline&quot;: { &quot;text&quot;: &quot;Launching the New Dashboard&quot; },\n      &quot;subtitle&quot;: { &quot;text&quot;: &quot;Real-time analytics for your team&quot; }\n    }\n  }&#39;\n<\/code><\/pre>\n<p>The response is small and predictable:<\/p>\n<pre><code>{\n  &quot;id&quot;: &quot;rnd_a1b2c3&quot;,\n  &quot;status&quot;: &quot;done&quot;,\n  &quot;format&quot;: &quot;png&quot;,\n  &quot;assetUrl&quot;: &quot;https:\/\/app.jsontoimg.com\/api\/v1\/renders\/rnd_a1b2c3\/asset?sig=...&quot;\n}\n<\/code><\/pre>\n<p>The <code>image_url<\/code> is the finished PNG, ready to host, serve, or upload anywhere. You\u2019re done \u2014 that\u2019s the whole first call.<\/p>\n<h3>Node.js<\/h3>\n<pre><code>const JSONTOIMG_API_KEY = process.env.JSONTOIMG_API_KEY;\n\nasync function renderImage() {\n  const response = await fetch(&#39;https:\/\/app.jsontoimg.com\/api\/v1\/render?wait=60&#39;, {\n    method: &#39;POST&#39;,\n    headers: {\n      &#39;Authorization&#39;: `Bearer ${JSONTOIMG_API_KEY}`,\n      &#39;Content-Type&#39;: &#39;application\/json&#39;\n    },\n    body: JSON.stringify({\n      template: &#39;social-share-card&#39;,\n      format: &#39;png&#39;,\n      layers: {\n        headline: { text: &#39;Launching the New Dashboard&#39; },\n        subtitle: { text: &#39;Real-time analytics for your team&#39; }\n      }\n    })\n  });\n\n  const data = await response.json();\n  console.log(data.assetUrl);\n}\n\nrenderImage();\n<\/code><\/pre>\n<h3>Python<\/h3>\n<pre><code>import os\nimport requests\n\nAPI_KEY = os.environ[&#39;JSONTOIMG_API_KEY&#39;]\n\nresponse = requests.post(\n    &#39;https:\/\/app.jsontoimg.com\/api\/v1\/render&#39;,\n    headers={\n        &#39;Authorization&#39;: f&#39;Bearer {API_KEY}&#39;,\n        &#39;Content-Type&#39;: &#39;application\/json&#39;\n    },\n    json={\n        &#39;template&#39;: &#39;social-share-card&#39;,\n        &#39;format&#39;: &#39;png&#39;,\n        &#39;layers&#39;: {\n            &#39;headline&#39;: { &#39;text&#39;: &#39;Launching the New Dashboard&#39; },\n            &#39;subtitle&#39;: { &#39;text&#39;: &#39;Real-time analytics for your team&#39; }\n        }\n    }\n)\n\nprint(response.json()[&#39;assetUrl&#39;])\n<\/code><\/pre>\n<h2>Step 3: Sync vs Async vs Webhooks<\/h2>\n<p>Rendering a single image is fast \u2014 usually a second or two \u2014 so the synchronous call above is all you need for most cases. But at volume you\u2019ll want the async patterns that production integrations use. Here\u2019s how the three modes compare:<\/p>\n<table>\n<thead>\n<tr>\n<th>Mode<\/th>\n<th>How it works<\/th>\n<th>Best for<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>Synchronous<\/strong><\/td>\n<td>Connection stays open; <code>image_url<\/code> returned in the response<\/td>\n<td>Simple renders, low volume, Lambda\/edge functions<\/td>\n<\/tr>\n<tr>\n<td><strong>Async + polling<\/strong><\/td>\n<td>Response returns <code>job_id<\/code> and <code>status: &quot;queued&quot;<\/code>; you poll a status endpoint<\/td>\n<td>Large or complex renders where you don\u2019t want to hold the connection<\/td>\n<\/tr>\n<tr>\n<td><strong>Webhook<\/strong><\/td>\n<td>Pass <code>webhook_url<\/code>; jsontoimg POSTs the finished image to your endpoint<\/td>\n<td>High-volume batch pipelines, event-driven systems<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>For polling, the response looks like this:<\/p>\n<pre><code>{\n  &quot;status&quot;: &quot;queued&quot;,\n  &quot;job_id&quot;: &quot;job_8f3k2m&quot;\n}\n<\/code><\/pre>\n<p>Then you poll until the job completes:<\/p>\n<pre><code>curl -X GET &quot;https:\/\/app.jsontoimg.com\/api\/v1\/renders\/rnd_8f3k2m&quot; \\\n  -H &quot;Authorization: Bearer $JSONTOIMG_API_KEY&quot;\n<\/code><\/pre>\n<p>A common production pattern is <strong>exponential backoff<\/strong> \u2014 poll at 1s, 2s, 4s, 8s \u2014 rather than hammering the endpoint every second (<a href=\"https:\/\/www.wireflow.ai\/blog\/best-image-generation-api-for-developers-2026\">Wireflow\u2019s developer guide<\/a> covers exactly this trade-off). And for anything beyond a few seconds of processing, webhooks are the standard recommendation: your server gets notified when the job completes instead of polling at all (<a href=\"https:\/\/apiframe.ai\/blog\/best-ai-image-generation-apis\">Apiframe\u2019s 2026 API roundup<\/a>). Bannerbear and Placid offer the same dual pattern \u2014 poll a GET endpoint or receive a webhook POST (<a href=\"https:\/\/www.bannerbear.com\/help\/articles\/123-how-do-i-create-an-image-via-api\">Bannerbear help<\/a>, <a href=\"https:\/\/placid.app\/docs\/2.0\/rest\/images\">Placid docs<\/a>).<\/p>\n<h2>Step 4: Generate Your First Batch<\/h2>\n<p>Single renders are nice; batches are where the API earns its keep. Send an array of renders in one request:<\/p>\n<pre><code>const response = await fetch(&#39;https:\/\/app.jsontoimg.com\/api\/v1\/renders\/batch&#39;, {\n  method: &#39;POST&#39;,\n  headers: {\n    &#39;Authorization&#39;: `Bearer ${JSONTOIMG_API_KEY}`,\n    &#39;Content-Type&#39;: &#39;application\/json&#39;\n  },\n  body: JSON.stringify({\n    jobs: [\n      {\n        template: &#39;social-share-card&#39;,\n        format: &#39;png&#39;,\n        layers: {\n          headline: { text: &#39;Post 1: The Ultimate Guide&#39; },\n          subtitle: { text: &#39;Everything you need to know&#39; }\n        }\n      },\n      {\n        template: &#39;social-share-card&#39;,\n        format: &#39;png&#39;,\n        layers: {\n          headline: { text: &#39;Post 2: Case Study&#39; },\n          subtitle: { text: &#39;How one team scaled to 10K images&#39; }\n        }\n      }\n    ]\n  })\n});\n\nconst results = await response.json();\n\/\/ GET \/api\/v1\/renders\/batches\/{id}; each done job has assetUrl\n<\/code><\/pre>\n<p>One template, hundreds of variations, one request. This is the workflow behind the big use cases on the site:<\/p>\n<ul>\n<li><a href=\"\/use-cases\/open-graph-images\">Auto-generate Open Graph images at scale<\/a><\/li>\n<li><a href=\"\/use-cases\/product-banners\">Product banners for thousands of SKUs<\/a><\/li>\n<li><a href=\"\/use-cases\/certificates\">Certificate generation<\/a><\/li>\n<li><a href=\"\/use-cases\/social-posts\">Social media post automation<\/a><\/li>\n<\/ul>\n<p>If you\u2019re evaluating whether template-based rendering is the right pattern for your stack at all, the <a href=\"https:\/\/www.abyssale.com\/blog\/template-based-image-generation-api\">Abyssale comparison of template-based image APIs<\/a> is a good industry overview \u2014 and the <a href=\"\/jsontoimg-vs-bannerbear\">jsontoimg vs Bannerbear<\/a> and <a href=\"\/jsontoimg-vs-placid\">jsontoimg vs Placid<\/a> pages cover where the trade-offs land.<\/p>\n<h2>Common Mistakes and How to Fix Them<\/h2>\n<table>\n<thead>\n<tr>\n<th>Error \/ symptom<\/th>\n<th>Likely cause<\/th>\n<th>Fix<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>401 Unauthorized<\/code><\/td>\n<td>Wrong or missing API key<\/td>\n<td>Confirm <code>Authorization: Bearer<\/code> ; never hardcode keys in client code<\/td>\n<\/tr>\n<tr>\n<td><code>404 template not found<\/code><\/td>\n<td>Typo in <code>template<\/code><\/td>\n<td>Copy the ID from the dashboard exactly<\/td>\n<\/tr>\n<tr>\n<td>Render succeeds but text is unchanged<\/td>\n<td><code>name<\/code> doesn\u2019t match a layer<\/td>\n<td>The modification <code>name<\/code> must equal a layer <code>name<\/code> in the template<\/td>\n<\/tr>\n<tr>\n<td>Text clipped or overflowing<\/td>\n<td>Font too large for the layer width<\/td>\n<td>Check <code>font.size<\/code> against the layer <code>width<\/code> and <code>align<\/code> settings<\/td>\n<\/tr>\n<tr>\n<td>Slow responses on big batches<\/td>\n<td>Many heavy renders in one call<\/td>\n<td>Use the batch endpoint with a <code>webhook_url<\/code> and process asynchronously<\/td>\n<\/tr>\n<tr>\n<td>Rate limit errors<\/td>\n<td>Too many requests per second<\/td>\n<td>Add backoff; the async\/webhook path is more forgiving at volume<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Next Steps<\/h2>\n<p>You\u2019ve made your first call. The natural next step is to wire this into a real workflow:<\/p>\n<ol>\n<li><strong>Read the use case guides<\/strong> \u2014 <a href=\"\/use-cases\/open-graph-images\">OG images<\/a>, <a href=\"\/use-cases\/email-hero-images\">email hero images<\/a>, <a href=\"\/use-cases\/event-tickets\">event tickets<\/a> show the full pipelines.<\/li>\n<li><strong>Build something<\/strong> \u2014 the <a href=\"\/use-cases\/product-banners\">product banner generator<\/a> walkthrough takes the batch pattern above and points it at a real product catalog.<\/li>\n<li><strong>Compare options<\/strong> \u2014 if you\u2019re still deciding between providers, the <a href=\"\/jsontoimg-vs-bannerbear\">comparison series<\/a> covers the honest trade-offs.<\/li>\n<\/ol>\n<p>And if you\u2019re curious about the technical story behind why a JSON-driven API beats a headless browser, check out <a href=\"\/blog\/why-i-built-a-json-to-image-api-instead-of-using-puppeteer\">Why I Built a JSON-to-Image API Instead of Using Puppeteer<\/a> (coming soon) \u2014 spoiler: it\u2019s the cost and the ops burden.<\/p>\n<h2>Key Takeaways<\/h2>\n<ul>\n<li><strong>JSON in, image out<\/strong> \u2014 a template + a JSON payload is all you need to generate branded images at scale<\/li>\n<li><strong>Design once, render forever<\/strong> \u2014 templates separate the visual design from the data, so any system that speaks JSON becomes an image generator<\/li>\n<li><strong>The API is one POST<\/strong> \u2014 <code>template<\/code> + <code>layers<\/code> \u2192 <code>assetUrl<\/code>; the same convention as Bannerbear, Placid, and Pixelixe<\/li>\n<li><strong>Pick the right mode<\/strong> \u2014 synchronous for simple renders, polling for long jobs, webhooks for production pipelines<\/li>\n<li><strong>Batch is where scale happens<\/strong> \u2014 one request, hundreds of images<\/li>\n<li><strong>First render in ~5 minutes<\/strong> \u2014 template \u2192 <code>curl<\/code> \u2192 done<\/li>\n<\/ul>\n<h2>FAQ<\/h2>\n<h3>What do I need before my first render?<\/h3>\n<p>An account, an API key, and one template with its changing layers named. Every account starts with 25 free API images and no card, so you can get through a first call before deciding anything.<\/p>\n<h3>What does the minimal JSON to image request look like?<\/h3>\n<p>A <code>POST \/api\/v1\/render<\/code> with the template ID and an object of layer names to values. Layers you do not mention keep the defaults you set in the editor.<\/p>\n<h3>Why is my render returning 422?<\/h3>\n<p>Almost always a layer name that does not exist in the template \u2014 a typo or a layer renamed in the editor. The API rejects unknown keys instead of quietly rendering an image with a missing field.<\/p>\n<h3>When should I move from single renders to the batch endpoint?<\/h3>\n<p>As soon as you are rendering a list rather than one image. <code>POST \/api\/v1\/renders\/batch<\/code> takes up to 50 jobs per request and can report back by webhook.<\/p>\n<h3>Do failed calls use up my free images?<\/h3>\n<p>No. Credits are spent on successful renders only, and designing in the editor with watermarked previews does not touch them at all.<\/p>\n<h2>Related Resources<\/h2>\n<ul>\n<li><a href=\"https:\/\/jsontoimg.com\/docs\/quick-start\">Quick start docs<\/a><\/li>\n<li><a href=\"https:\/\/jsontoimg.com\/tools\/free-json-to-image\">Free JSON to image tool<\/a><\/li>\n<li><a href=\"\/use-cases\/open-graph-images\">Auto-Generate Open Graph Images at Scale<\/a> \u2014 use case guide<\/li>\n<li><a href=\"\/use-cases\/product-banners\">Product Banners for Thousands of SKUs<\/a> \u2014 batch workflow<\/li>\n<li><a href=\"\/blog\/json-to-image-converter\">Building a JSON-to-Image Converter: Turn Data into Shareable Visuals<\/a> \u2014 a worked example on the blog<\/li>\n<li><a href=\"\/jsontoimg-vs-bannerbear\">jsontoimg vs Bannerbear<\/a> \u2014 comparison<\/li>\n<li><a href=\"https:\/\/www.bannerbear.com\/examples\">Bannerbear API Quick Start<\/a> \u2014 reference for the industry-standard pattern<\/li>\n<li><a href=\"https:\/\/placid.app\/docs\/2.0\/rest\/images\">Placid REST API docs<\/a> \u2014 another take on template-based rendering<\/li>\n<\/ul>\n<p>Next: <a href=\"https:\/\/jsontoimg.com\/docs\">docs<\/a>, <a href=\"https:\/\/jsontoimg.com\/blog\/designing-image-templates-with-json-complete-guide\">named layers<\/a>, <a href=\"https:\/\/jsontoimg.com\/pricing\">pricing<\/a>.<\/p>\n<p>Zoom out: <a href=\"https:\/\/jsontoimg.com\/blog\/json-to-image-converter\">How JSON-to-Image Conversion Works<\/a> maps the whole template, named-layer, and render-job architecture.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the first successful POST \/api\/v1\/render \u2014 not a second homepage. Create an API key, send a template id and optional layer overrides, wait up to 60 seconds, download the file. 25 images are free; no card.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5,4,3],"class_list":["post-91","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-api","tag-image-generation","tag-jsontoimg"],"_links":{"self":[{"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/posts\/91","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/comments?post=91"}],"version-history":[{"count":2,"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/posts\/91\/revisions"}],"predecessor-version":[{"id":348,"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/posts\/91\/revisions\/348"}],"wp:attachment":[{"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/media?parent=91"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/categories?post=91"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/tags?post=91"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}