API Playground
The API Playground is an interactive tool for testing the Rynko document generation API directly from your browser.
Overview
The API Playground allows you to:
- Generate single PDF or Excel documents from templates
- Generate batch documents (multiple documents at once)
- Check the status of document generation jobs
- Check the status of batch jobs
- View code samples in 6 programming languages
Getting Started
Accessing the Playground
- Navigate to API → Playground from the dashboard sidebar
- The playground opens with the default "Single Doc" tab selected
Prerequisites
Before using the playground, you'll need:
- At least one API Key created in your account
- At least one document template (PDF or Excel)
Interface Layout
The playground has a simple two-panel layout:
Tab Navigation
Four tabs at the top let you switch between modes:
| Tab | Icon | Description |
|---|---|---|
| Single Doc | 📄 | Generate a single document |
| Batch | 📑 | Generate multiple documents at once |
| Job Status | 🔍 | Check status of a single document job |
| Batch Status | ⏱️ | Check status of a batch job |
Request Panel (Left)
Configure your API request:
- API Key: Select which API key to use
- Template: Choose a document template
- Format: Select PDF or Excel output
- Variables: Edit template variable values
- Filename: Optional custom filename
- Options: Draft mode, premium credits
Response Panel (Right)
View the API response:
- Success or error status
- JSON response data
- Job ID or batch ID for status checking
- Download link for completed documents
Code Samples (Bottom)
Auto-generated code samples that update as you configure your request.
Generating a Single Document
Step 1: Select API Key
Choose an API key from the dropdown. If you don't have one, create one in Settings → API Keys.
Step 2: Select Template
Choose a document template from the dropdown. Templates are filtered to show only attachment templates (PDF/Excel).
Step 3: Choose Output Format
Select your desired output format:
- PDF - Generates a PDF document
- Excel - Generates an Excel spreadsheet (.xlsx)
Step 4: Configure Variables
If your template has variables, click Edit Variables to open the variable editor. Fill in values for each variable defined in the template.
Step 5: Optional Settings
- Filename: Specify a custom filename (e.g.,
invoice-2024.pdf) - Use Draft Version: Generate from the draft template instead of published version
- Use Premium Credits: For Free tier users with credits, generate without watermark
Step 6: Generate
Click Generate Document to submit the request.
Response
A successful response includes:
{
"jobId": "job_abc123xyz",
"status": "completed",
"downloadUrl": "https://storage.rynko.dev/...",
"filename": "invoice-2024.pdf",
"format": "pdf",
"creditsUsed": 1
}
Generating Batch Documents
Batch generation lets you create multiple documents from the same template with different variable values.
Step 1: Configure Base Settings
Same as single document: select API key, template, and format.
Step 2: Add Documents
Click Add Document to add documents to the batch. Each document can have:
- Its own set of variable values
- An optional custom filename
Step 3: Generate Batch
Click Generate Batch to submit. The response includes a batch ID for tracking:
{
"batchId": "batch_xyz789",
"status": "processing",
"totalJobs": 5,
"completedJobs": 0
}
Checking Job Status
Use the Job Status tab to check the status of a document generation job.
How to Use
- Enter a job ID (e.g.,
job_abc123xyz) - Click Check Status
Response
{
"jobId": "job_abc123xyz",
"status": "completed",
"downloadUrl": "https://storage.rynko.dev/...",
"createdAt": "2024-01-15T10:30:00Z",
"completedAt": "2024-01-15T10:30:05Z"
}
Job Statuses
| Status | Description |
|---|---|
pending | Job is queued for processing |
processing | Document is being generated |
completed | Document is ready for download |
failed | Generation failed (check error message) |
Checking Batch Status
Use the Batch Status tab to check the status of a batch job.
Response
{
"batchId": "batch_xyz789",
"status": "completed",
"totalJobs": 5,
"completedJobs": 5,
"failedJobs": 0,
"documents": [
{
"jobId": "job_1",
"status": "completed",
"downloadUrl": "..."
}
]
}
Code Samples
The playground automatically generates code samples in 6 languages based on your current configuration.
Available Languages
| Language | Library Used |
|---|---|
| cURL | Command line |
| JavaScript | axios |
| Python | requests |
| PHP | cURL |
| Ruby | net/http |
| Go | net/http |
Using Code Samples
- Configure your request in the playground
- Scroll down to the Code Samples section
- Click on the language tab you want
- Click Copy to copy the code
- Paste into your application
Example: JavaScript
const axios = require('axios');
const API_KEY = 'fm_your_api_key';
const API_ENDPOINT = 'https://api.rynko.dev/api';
async function generateDocument() {
try {
const response = await axios.post(`${API_ENDPOINT}/v1/documents/generate`, {
templateId: 'your-template-id',
format: 'pdf',
variables: {
customerName: 'Acme Corp',
invoiceNumber: 'INV-001'
}
}, {
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${API_KEY}`
}
});
console.log('Response:', response.data);
return response.data;
} catch (error) {
console.error('Error:', error.response?.data || error.message);
throw error;
}
}
generateDocument();
Example: Python
import requests
API_KEY = 'fm_your_api_key'
API_ENDPOINT = 'https://api.rynko.dev/api'
def generate_document():
url = f'{API_ENDPOINT}/v1/documents/generate'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {API_KEY}'
}
payload = {
'templateId': 'your-template-id',
'format': 'pdf',
'variables': {
'customerName': 'Acme Corp',
'invoiceNumber': 'INV-001'
}
}
response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()
return response.json()
if __name__ == '__main__':
result = generate_document()
print('Response:', result)
API Endpoints Used
The playground uses these document API endpoints:
| Endpoint | Method | Description |
|---|---|---|
/v1/documents/generate | POST | Generate single document |
/v1/documents/generate/batch | POST | Generate batch of documents |
/v1/documents/jobs/:jobId | GET | Check job status |
/v1/documents/batches/:batchId | GET | Check batch status |