Python
Official Python SDK for TemplateFox.
Installation
pip install templatefoxOr with poetry:
poetry add templatefoxGenerate 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