curl -X POST https://www.getdiro.com/api/v1/documents \
-H "Authorization: Bearer diro_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"templateId": "550e8400-e29b-41d4-a716-446655440000",
"data": {
"name": "John Doe",
"score": 85,
"grade": "A"
}
}'
const response = await fetch('https://www.getdiro.com/api/v1/documents', {
method: 'POST',
headers: {
'Authorization': 'Bearer diro_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
templateId: '550e8400-e29b-41d4-a716-446655440000',
data: {
name: 'John Doe',
score: 85,
grade: 'A',
},
}),
});
const result = await response.json();
import requests
response = requests.post(
'https://www.getdiro.com/api/v1/documents',
headers={
'Authorization': 'Bearer diro_your_api_key',
'Content-Type': 'application/json',
},
json={
'templateId': '550e8400-e29b-41d4-a716-446655440000',
'data': {
'name': 'John Doe',
'score': 85,
'grade': 'A',
},
},
)
result = response.json()
{
"success": true,
"data": {
"id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
"templateId": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"format": "pdf",
"pdfUrl": "https://cdn.getdiro.com/documents/d290f1ee.pdf",
"createdAt": "2025-01-22T10:30:00.000Z",
"completedAt": "2025-01-22T10:30:02.500Z"
},
"meta": {
"timestamp": "2025-01-22T10:30:02.500Z"
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "'data' (object) is required"
},
"meta": {
"timestamp": "2025-01-22T10:30:00.000Z"
}
}
{
"success": false,
"error": {
"code": "TEMPLATE_NOT_FOUND",
"message": "Template not found"
},
"meta": {
"timestamp": "2025-01-22T10:30:00.000Z"
}
}
{
"success": false,
"error": {
"code": "RENDER_LIMIT_EXCEEDED",
"message": "Monthly render limit exceeded. Current: 500/500"
},
"meta": {
"timestamp": "2025-01-22T10:30:00.000Z"
}
}
Documents
Create Document
Generate a new document from a template
POST
/
documents
curl -X POST https://www.getdiro.com/api/v1/documents \
-H "Authorization: Bearer diro_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"templateId": "550e8400-e29b-41d4-a716-446655440000",
"data": {
"name": "John Doe",
"score": 85,
"grade": "A"
}
}'
const response = await fetch('https://www.getdiro.com/api/v1/documents', {
method: 'POST',
headers: {
'Authorization': 'Bearer diro_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
templateId: '550e8400-e29b-41d4-a716-446655440000',
data: {
name: 'John Doe',
score: 85,
grade: 'A',
},
}),
});
const result = await response.json();
import requests
response = requests.post(
'https://www.getdiro.com/api/v1/documents',
headers={
'Authorization': 'Bearer diro_your_api_key',
'Content-Type': 'application/json',
},
json={
'templateId': '550e8400-e29b-41d4-a716-446655440000',
'data': {
'name': 'John Doe',
'score': 85,
'grade': 'A',
},
},
)
result = response.json()
{
"success": true,
"data": {
"id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
"templateId": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"format": "pdf",
"pdfUrl": "https://cdn.getdiro.com/documents/d290f1ee.pdf",
"createdAt": "2025-01-22T10:30:00.000Z",
"completedAt": "2025-01-22T10:30:02.500Z"
},
"meta": {
"timestamp": "2025-01-22T10:30:02.500Z"
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "'data' (object) is required"
},
"meta": {
"timestamp": "2025-01-22T10:30:00.000Z"
}
}
{
"success": false,
"error": {
"code": "TEMPLATE_NOT_FOUND",
"message": "Template not found"
},
"meta": {
"timestamp": "2025-01-22T10:30:00.000Z"
}
}
{
"success": false,
"error": {
"code": "RENDER_LIMIT_EXCEEDED",
"message": "Monthly render limit exceeded. Current: 500/500"
},
"meta": {
"timestamp": "2025-01-22T10:30:00.000Z"
}
}
Generate a PDF or PNG document by combining a template with your data.
string
required
The ID of the template to use. Get this from your dashboard or the List Templates endpoint.
object
required
Key-value pairs of data to inject into the template. Keys should match the field keys defined in your template.
{
"name": "John Doe",
"score": 85,
"department": "Engineering"
}
string
default:"pdf"
Output format:
pdf or pnginteger
default:"2"
Render quality / device scale factor. Integer
1–3 (higher is sharper and produces a larger file).string
URL to call when document generation completes.
integer
Page width in pixels. Overrides template setting.
integer
Page height in pixels. Overrides template setting.
curl -X POST https://www.getdiro.com/api/v1/documents \
-H "Authorization: Bearer diro_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"templateId": "550e8400-e29b-41d4-a716-446655440000",
"data": {
"name": "John Doe",
"score": 85,
"grade": "A"
}
}'
const response = await fetch('https://www.getdiro.com/api/v1/documents', {
method: 'POST',
headers: {
'Authorization': 'Bearer diro_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
templateId: '550e8400-e29b-41d4-a716-446655440000',
data: {
name: 'John Doe',
score: 85,
grade: 'A',
},
}),
});
const result = await response.json();
import requests
response = requests.post(
'https://www.getdiro.com/api/v1/documents',
headers={
'Authorization': 'Bearer diro_your_api_key',
'Content-Type': 'application/json',
},
json={
'templateId': '550e8400-e29b-41d4-a716-446655440000',
'data': {
'name': 'John Doe',
'score': 85,
'grade': 'A',
},
},
)
result = response.json()
{
"success": true,
"data": {
"id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
"templateId": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"format": "pdf",
"pdfUrl": "https://cdn.getdiro.com/documents/d290f1ee.pdf",
"createdAt": "2025-01-22T10:30:00.000Z",
"completedAt": "2025-01-22T10:30:02.500Z"
},
"meta": {
"timestamp": "2025-01-22T10:30:02.500Z"
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "'data' (object) is required"
},
"meta": {
"timestamp": "2025-01-22T10:30:00.000Z"
}
}
{
"success": false,
"error": {
"code": "TEMPLATE_NOT_FOUND",
"message": "Template not found"
},
"meta": {
"timestamp": "2025-01-22T10:30:00.000Z"
}
}
{
"success": false,
"error": {
"code": "RENDER_LIMIT_EXCEEDED",
"message": "Monthly render limit exceeded. Current: 500/500"
},
"meta": {
"timestamp": "2025-01-22T10:30:00.000Z"
}
}
⌘I