Skip to Content

Python

Official Python SDK for TemplateFox.

PyPI version GitHub Repository 

Installation

pip install templatefox

Or with poetry:

poetry add templatefox

Generate a PDF

from templatefox import ApiClient, Configuration from templatefox.api import PDFApi from templatefox.models import CreatePdfRequest # Initialize the client config = Configuration() config.api_key['ApiKeyAuth'] = 'your-api-key' with ApiClient(config) as client: api = PDFApi(client) # Generate a PDF response = api.create_pdf( CreatePdfRequest( template_id='YOUR_TEMPLATE_ID', data={ 'name': 'John Doe', 'invoice_number': 'INV-001', 'total_amount': 150.00, } ) ) print(f'PDF URL: {response.url}') print(f'Credits remaining: {response.credits_remaining}')

Configuration

import os from templatefox import Configuration config = Configuration() config.api_key['ApiKeyAuth'] = os.environ.get('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