Browse documentation
Render API quickstart
Generate a Print in Motion PNG from Node.js and find it in My works.
Create a key
Sign in with a verified account, create a key, and save it as RENDLOOM_API_KEY in your shell. Run the example with Node.js 22 or later.
Template inputs
Read the required fields and ready-to-submit example inputs for each supported template.
GET /api/v1/templatesQuote, approve, download
Set RENDLOOM_API_KEY, then run node render-poster.mjs. The example authorizes up to 1 Credit and saves poster.png.
render-poster.mjs
// Node.js · set RENDLOOM_API_KEY in your environment
import { randomUUID } from 'node:crypto'
import { readFile, writeFile } from 'node:fs/promises'
const endpoint = new URL('/api/v1/renders', process.env.RENDLOOM_ORIGIN || 'https://rendloom.com').href
const receipt = 'poster-acceptance.json'
if (!process.env.RENDLOOM_API_KEY) throw Error('Set RENDLOOM_API_KEY')
const headers = { Authorization: 'Bearer ' + process.env.RENDLOOM_API_KEY }
async function request(path, body) {
const res = await fetch(endpoint + path, body
? { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify(body) }
: { headers })
if (!res.ok) throw Error(await res.text())
return res
}
let acceptance
try {
acceptance = JSON.parse(await readFile(receipt, 'utf8'))
} catch (error) {
if (error.code !== 'ENOENT') throw error
const quote = await (await request('', {
action: 'quote', templateId: 'print-in-motion', version: '1',
inputs: { city: 'Toronto', venue: 'Cedarline Studio', date: '2027-03-13', start_time_local: '14:00' }
})).json()
if (quote.credits > 1) throw Error('Above budget')
acceptance = { action: 'accept', quoteId: quote.quoteId,
accepted: true, maxCredits: 1, requestKey: randomUUID() }
await writeFile(receipt, JSON.stringify(acceptance), { mode: 0o600, flag: 'wx' })
}
let job = await (await request('', acceptance)).json()
const path = '/' + job.operationId
const deadline = Date.now() + 120000
while (job.state === 'rendering' && Date.now() < deadline) {
await new Promise(resolve => setTimeout(resolve, 3000))
job = await (await request(path)).json()
}
if (job.state !== 'succeeded') throw Error('Check operation ' + job.operationId)
await writeFile('poster.png', Buffer.from(await (await request(path + '?download=1')).arrayBuffer()))Resume the same render
Run the script again from the same folder after a dropped connection. It reads poster-acceptance.json and reuses the original request key. If the server confirms the quote expired before acceptance, or the render failed, move the receipt aside before requesting a new quote. Find finished files in My works.