TypeScript
Official TypeScript/Node.js SDK for TemplateFox.
Installation
npm install @templatefox/sdkOr with yarn:
yarn add @templatefox/sdkGenerate a PDF
import { Configuration, PDFApi, CreatePdfRequest } from '@templatefox/sdk';
// Initialize the client
const config = new Configuration({
apiKey: 'your-api-key',
});
const api = new PDFApi(config);
// Generate a PDF
async function generatePdf() {
const response = await api.createPdf({
templateId: 'YOUR_TEMPLATE_ID',
data: {
name: 'John Doe',
invoiceNumber: 'INV-001',
totalAmount: 150.00,
},
});
console.log('PDF URL:', response.url);
console.log('Credits remaining:', response.creditsRemaining);
}
generatePdf();Configuration
const config = new Configuration({
apiKey: process.env.TEMPLATEFOX_API_KEY,
});Full SDK Reference
For the complete API coverage including templates, account, S3 integration, and error handling, see the GitHub repository README .
Last updated on