Getting Started Overview
Welcome to Json2doc! This guide will help you understand how to create professional documents from JSON configurations in minutes.
What is Json2doc?
Json2doc is a powerful document generation API that transforms JSON into beautiful, professional documents. Create PDFs and Word documents programmatically with:
- ⚡ Lightning Fast: Generate complex documents in just 2 seconds
- 🎨 Professional Quality: Clean, consistent formatting with extensive styling options
- 🔧 Two Generation Modes: Templates and full document creation
- 📁 AI-Optimized: Perfect for AI agents with interactive document building
- 🌍 Global Ready: Support for 50+ languages with 2000+ fonts
Two Generation Modes
Json2doc offers two complementary approaches to document generation:
1. 📝 Template Mode
Replace placeholders in existing Word documents:
{
"templateId": "business-report-template",
"variables": {
"companyName": "Acme Corp",
"revenue": "$1.2M",
"year": "2024"
},
"output": {
"filename": "acme-report-2024"
}
}
2. 🏗️ Document Mode
Create complete documents from scratch:
{
"document": {
"type": "pdf",
"filename": "report",
"title": "Business Report"
},
"defaults": {
"fontFamily": "Arial",
"styles": {
"h1": { "fontSize": 24, "fontWeight": "bold" }
}
},
"sections": [
{
"type": "flow",
"content": [
{ "type": "h1", "text": "Executive Summary" },
{ "type": "text", "text": "This report covers..." }
]
}
]
}
API Architecture
Json2doc follows RESTful principles with these core concepts:
🔐 Authentication
All requests require an API key passed in the x-api-key header.
📄 Templates
Upload and manage Word document templates with {{variable}} placeholders.
🏗️ Document Builder
Interactive document creation with sessions, sections, and content management.
📁 Files
Upload, validate, and manage your assets (templates, images, fonts).
🎯 Jobs
Asynchronous document generation with real-time status updates.
Processing Flow
Here's how a typical workflow works:
- Upload templates or assets (optional)
- Create document job with JSON configuration
- Monitor generation status (typically completes in 2 seconds)
- Download the result as PDF or Word document
Next Steps
🔑 Authentication
Set up your API key and make your first authenticated request.
Learn about authentication →Document Features
📄 Output Formats
- PDF: Professional-quality PDFs with advanced formatting
- DOCX: Microsoft Word compatible documents
🎨 Styling & Layout
- 2000+ Fonts: Comprehensive font library including international fonts
- Headers & Footers: Custom headers/footers with variables
- Page Management: Portrait/landscape orientation, custom margins
- Colors & Spacing: Full control over colors, fonts, and spacing
📝 Content Types
- Headings: Six levels (H1-H6) with custom styling
- Text: Rich formatting with markdown support (bold, italic, links)
- Lists: Nested ordered and unordered lists
- Tables: Complex tables with custom styling and borders
- Images: Insert and position images with alignment options
🔧 Advanced Features
- Variables: Dynamic content with
{{variableName}}syntax - Document Builder: Interactive creation with AI agents
- Template System: Reuse layouts with variable replacement
- Multi-language: 50+ language support with appropriate fonts
Performance & Quality
- ⚡ Speed: 2-second generation time for complex documents
- 📊 Scale: Handle large documents up to 100 pages
- 🎯 Consistency: Professional, consistent formatting every time
- 🔍 Quality: Clean, publication-ready output
Common Questions
How fast is document generation?
Json2doc generates most documents in 2 seconds, regardless of complexity. Even large documents with multiple sections, tables, and images complete in under 5 seconds.
What document formats are supported?
- PDF: Full-featured PDFs with advanced formatting
- DOCX: Microsoft Word compatible documents
- Both formats maintain formatting, fonts, and layout perfectly
Are there document size limits?
- Pages: Up to 100 pages per document
- Content: 1000+ paragraphs, 50+ tables, 100+ images
- File size: Generated documents typically 1-10MB depending on content
How do I handle errors?
The API returns clear error messages:
{
"success": false,
"error": "validation_error",
"message": "Template variable 'companyName' is not defined"
}
Can I use it with AI agents?
Yes! The Document Builder API is specifically designed for AI integration:
- Create interactive sessions
- Add sections incrementally
- Update content as needed
- Generate final document when complete
Ready to create your first document? Let's set up your authentication! 🚀