Developer API

GenPDF API Documentation

GenPDF was built to solve a fundamental challenge in modern software development: the complexity of programmatic document generation. Traditionally, creating beautiful, structured PDFs required complex layout engines, manual design tweaking, and fragile templates. Our API leverages advanced intelligence to understand your document needs and deliver production-ready PDFs in seconds, allowing you to focus on your core product rather than document styling.

Overview

Why GenPDF?

Creating documents shouldn't feel like building a website from scratch every time. Whether it's an invoice, a resume, or a complex report, the design should be the least of your worries. GenPDF bridges the gap between raw data and professional presentation by using AI to handle the heavy lifting of layout, typography, and structure.

Who uses GenPDF?

SaaS & Fintech

Generate automated invoices, receipts, and financial statements without maintaining complex PDF templates.

HR Tech

Convert user profiles or candidate data into professionally formatted resumes and offer letters instantly.

Education & EdTech

Automate the creation of certificates, diplomas, and student progress reports with personalized data.

E-commerce

Create dynamic product catalogs, shipping labels, and order summaries on the fly from your inventory data.

Intelligent document structuring
Instant text-to-PDF transformation
Zero template maintenance
High-fidelity typography & layout
Production-ready performance
Simplified API integration

Authentication

All requests must include your API key in the Authorization header.

Authorization: Bearer YOUR_API_KEY

Security Best Practice

Never share your API keys or expose them in client-side code. We store only SHA-256 hashes of your keys for maximum security.

Rate Limiting

To ensure stability, we apply rate limits per API key. If you exceed these limits, the API will return a 429 Too Many Requests response.

Per Minute

10 Requests

Per Day

1,000 Requests

Token-Based Billing

We use a consumption-based token model similar to OpenAI. Tokens are deducted only after successful AI generation.

Simple Pricing

$1.00

per 100,000 tokens

Efficiency

~2,000 - 5,000

tokens per average PDF

  • Tokens are deducted atomically during request processing
  • Both input and output tokens are counted
  • Failed or timed-out requests consume ZERO tokens
  • View your detailed usage ledger in the dashboard

Request Format

Endpoint

POST/v1/generate-pdf

Body (JSON)

{
  "prompt": "Create a detailed professional resume for a Senior Software Engineer including skills in React, Node.js, and Cloud Architecture."
}

cURL Example

curl -L -X POST "https://bjubpqvkpmjxnbmgqfdx.supabase.co/functions/v1/generate-pdf" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
--data '{
  "prompt": "Create a simple invoice for web development services."
}' \
--output generated.pdf

* The response is a binary PDF. Use the --output flag to save it directly to a file.

Service Guarantees

Atomicity

Tokens are deducted only after successful generation.

No Waste

Failed or timed-out requests consume zero tokens.

Immutability

Usage records are permanent and auditable.

Control

Revoke API keys instantly without affecting billing.

Error Responses

StatusMeaningCommon Cause
400Bad RequestInvalid or missing prompt
401UnauthorizedMissing or invalid API key
402Payment RequiredInsufficient token balance
429Too Many RequestsRate limit exceeded
504Gateway TimeoutAI generation took too long
500Server ErrorInternal processing error

Ready to start building?

Create your first API key and transform text to PDF in seconds.

Get API Key