Documentation

TypeScript SDK

Prefer a typed client over raw fetch? The official SDK wraps every endpoint and returns a { data, error } result — no manual URL building or response parsing.

Install

Install

npm install @renderfast/client

Usage

Usage

import { createClient, postApiGenerate } from '@renderfast/client';

const client = createClient({
	baseUrl: 'https://yourdomain.com',
	headers: {
		Authorization: 'Bearer ' + process.env.RENDERFAST_API_KEY
	}
});

const { data, error } = await postApiGenerate({
	client,
	body: {
		templateId: 'your-template-id',
		layers: {
			title: { text: 'My Blog Post Title' },
			subtitle: { text: 'Published on Jan 15', fontSize: 24, color: '#666666' }
		}
	}
});

if (error) throw error;
console.log(data.imageUrl); // { success, imageUrl, cached, generationTimeMs }

The same generated functions cover the rest of the API — getApiTemplates, postApiTemplatesByIdClone, getApiUploads, and more. Each takes { client, body?, path?, query? } and returns { data, error }.

Plain Node ESM works

The SDK is published as `@renderfast/client`, currently at version `0.0.4`. It runs under plain Node ESM with no bundler required.