Request
curl -X POST https://api.iterationlayer.com/document-generation/v1/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"format": "pdf",
"document": {
"metadata": {
"title": "Q4 Performance Report",
"author": "Northwind Analytics"
},
"page": {
"size": { "preset": "A4" },
"margins": {
"top_in_pt": 72,
"right_in_pt": 72,
"bottom_in_pt": 72,
"left_in_pt": 72
}
},
"styles": {
"text": {
"font_family": "Helvetica",
"font_size_in_pt": 11.0,
"line_height": 1.5,
"color": "#333333"
},
"headline": {
"font_family": "Helvetica",
"font_size_in_pt": 24.0,
"color": "#111111",
"spacing_before_in_pt": 12.0,
"spacing_after_in_pt": 6.0,
"is_bold": true
},
"link": {
"color": "#0066CC",
"is_underlined": true
},
"list": {
"text_style": {
"font_family": "Helvetica",
"font_size_in_pt": 11.0,
"line_height": 1.5,
"color": "#333333"
},
"marker_color": "#333333",
"marker_gap_in_pt": 8.0
},
"table": {
"header": {
"background_color": "#333333",
"text_color": "#FFFFFF",
"font_size_in_pt": 11.0,
"is_bold": true
},
"body": {
"background_color": "#FFFFFF",
"text_color": "#333333",
"font_size_in_pt": 11.0
},
"border": {
"outer": {
"top": { "color": "#CCCCCC", "width_in_pt": 1.0 },
"right": { "color": "#CCCCCC", "width_in_pt": 1.0 },
"bottom": { "color": "#CCCCCC", "width_in_pt": 1.0 },
"left": { "color": "#CCCCCC", "width_in_pt": 1.0 }
},
"inner": {
"horizontal": { "color": "#EEEEEE", "width_in_pt": 0.5 },
"vertical": { "color": "#EEEEEE", "width_in_pt": 0.5 }
}
}
},
"grid": {
"background_color": "#FFFFFF",
"border_color": "#CCCCCC",
"border_width_in_pt": 0.0,
"gap_in_pt": 12.0
},
"separator": {
"color": "#CCCCCC",
"thickness_in_pt": 1.0,
"spacing_before_in_pt": 12.0,
"spacing_after_in_pt": 12.0
},
"image": {
"border_color": "#000000",
"border_width_in_pt": 0.0
}
},
"footer": [
{
"type": "paragraph",
"runs": [{
"text": "Northwind Analytics · Confidential · Generated March 14, 2026"
}]
}
],
"content": [
{ "type": "headline", "level": "h1", "text": "Q4 Performance Report" },
{ "type": "paragraph", "runs": [
{ "text": "Executive Summary: ", "is_bold": true },
{ "text": "Q4 2025 showed strong revenue growth driven by new enterprise contracts and improved retention rates. Total revenue increased 18% quarter-over-quarter, while operating costs remained flat. Customer acquisition cost decreased by 12%, reflecting improved efficiency in our go-to-market strategy." }
] },
{ "type": "separator" },
{ "type": "headline", "level": "h2", "text": "Key Metrics" },
{
"type": "table",
"column_widths_in_percent": [40, 20, 20, 20],
"header": {
"cells": [
{ "text": "Metric" },
{ "text": "Q3", "horizontal_alignment": "right" },
{ "text": "Q4", "horizontal_alignment": "right" },
{ "text": "Change", "horizontal_alignment": "right" }
]
},
"rows": [
{ "cells": [
{ "text": "Total Revenue" },
{ "text": "$2.4M", "horizontal_alignment": "right" },
{ "text": "$2.83M", "horizontal_alignment": "right" },
{ "text": "+18%", "horizontal_alignment": "right" }
] },
{ "cells": [
{ "text": "Active Customers" },
{ "text": "1,240", "horizontal_alignment": "right" },
{ "text": "1,385", "horizontal_alignment": "right" },
{ "text": "+11.7%", "horizontal_alignment": "right" }
] },
{ "cells": [
{ "text": "Churn Rate" },
{ "text": "4.2%", "horizontal_alignment": "right" },
{ "text": "3.1%", "horizontal_alignment": "right" },
{ "text": "-1.1pp", "horizontal_alignment": "right" }
] },
{ "cells": [
{ "text": "Customer Acquisition Cost" },
{ "text": "$1,850", "horizontal_alignment": "right" },
{ "text": "$1,628", "horizontal_alignment": "right" },
{ "text": "-12%", "horizontal_alignment": "right" }
] }
]
},
{ "type": "separator" },
{ "type": "paragraph", "runs": [
{ "text": "Report generated on March 14, 2026 by Northwind Analytics. For questions, contact analytics@northwind.com." }
] }
]
}
}'Response
{
"success": true,
"data": {
"buffer": "JVBERi0xLjcKMSAwIG9iago8...",
"mime_type": "application/pdf"
}
}Request
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });
const result = await client.generateDocument({
format: "pdf",
document: {
metadata: {
title: "Q4 Performance Report",
author: "Northwind Analytics",
},
page: {
size: { preset: "A4" },
margins: {
top_in_pt: 72,
right_in_pt: 72,
bottom_in_pt: 72,
left_in_pt: 72,
},
},
styles: {
text: {
font_family: "Helvetica",
font_size_in_pt: 11.0,
line_height: 1.5,
color: "#333333",
},
headline: {
font_family: "Helvetica",
font_size_in_pt: 24.0,
color: "#111111",
spacing_before_in_pt: 12.0,
spacing_after_in_pt: 6.0,
is_bold: true,
},
link: {
color: "#0066CC",
is_underlined: true,
},
list: {
text_style: {
font_family: "Helvetica",
font_size_in_pt: 11.0,
line_height: 1.5,
color: "#333333",
},
marker_color: "#333333",
marker_gap_in_pt: 8.0,
},
table: {
header: {
background_color: "#333333",
text_color: "#FFFFFF",
font_size_in_pt: 11.0,
is_bold: true,
},
body: {
background_color: "#FFFFFF",
text_color: "#333333",
font_size_in_pt: 11.0,
},
border: {
outer: {
top: { color: "#CCCCCC", width_in_pt: 1.0 },
right: { color: "#CCCCCC", width_in_pt: 1.0 },
bottom: { color: "#CCCCCC", width_in_pt: 1.0 },
left: { color: "#CCCCCC", width_in_pt: 1.0 },
},
inner: {
horizontal: { color: "#EEEEEE", width_in_pt: 0.5 },
vertical: { color: "#EEEEEE", width_in_pt: 0.5 },
},
},
},
grid: {
background_color: "#FFFFFF",
border_color: "#CCCCCC",
border_width_in_pt: 0.0,
gap_in_pt: 12.0,
},
separator: {
color: "#CCCCCC",
thickness_in_pt: 1.0,
spacing_before_in_pt: 12.0,
spacing_after_in_pt: 12.0,
},
image: {
border_color: "#000000",
border_width_in_pt: 0.0,
},
},
footer: [
{
type: "paragraph",
runs: [{
text: "Northwind Analytics · Confidential · Generated March 14, 2026",
}],
},
],
content: [
{ type: "headline", level: "h1", text: "Q4 Performance Report" },
{ type: "paragraph", runs: [
{ text: "Executive Summary: ", is_bold: true },
{ text: "Q4 2025 showed strong revenue growth driven by new enterprise contracts and improved retention rates. Total revenue increased 18% quarter-over-quarter, while operating costs remained flat. Customer acquisition cost decreased by 12%, reflecting improved efficiency in our go-to-market strategy." },
] },
{ type: "separator" },
{ type: "headline", level: "h2", text: "Key Metrics" },
{
type: "table",
column_widths_in_percent: [40, 20, 20, 20],
header: {
cells: [
{ text: "Metric" },
{ text: "Q3", horizontal_alignment: "right" },
{ text: "Q4", horizontal_alignment: "right" },
{ text: "Change", horizontal_alignment: "right" },
],
},
rows: [
{ cells: [
{ text: "Total Revenue" },
{ text: "$2.4M", horizontal_alignment: "right" },
{ text: "$2.83M", horizontal_alignment: "right" },
{ text: "+18%", horizontal_alignment: "right" },
] },
{ cells: [
{ text: "Active Customers" },
{ text: "1,240", horizontal_alignment: "right" },
{ text: "1,385", horizontal_alignment: "right" },
{ text: "+11.7%", horizontal_alignment: "right" },
] },
{ cells: [
{ text: "Churn Rate" },
{ text: "4.2%", horizontal_alignment: "right" },
{ text: "3.1%", horizontal_alignment: "right" },
{ text: "-1.1pp", horizontal_alignment: "right" },
] },
{ cells: [
{ text: "Customer Acquisition Cost" },
{ text: "$1,850", horizontal_alignment: "right" },
{ text: "$1,628", horizontal_alignment: "right" },
{ text: "-12%", horizontal_alignment: "right" },
] },
],
},
{ type: "separator" },
{ type: "paragraph", runs: [
{ text: "Report generated on March 14, 2026 by Northwind Analytics. For questions, contact analytics@northwind.com." },
] },
],
},
});
await Bun.write("q4-performance-report.pdf", Buffer.from(result.data.buffer, "base64"));Response
{
"success": true,
"data": {
"buffer": "JVBERi0xLjcKMSAwIG9iago8...",
"mime_type": "application/pdf"
}
}Request
import base64
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")
result = client.generate_document(
format="pdf",
document={
"metadata": {
"title": "Q4 Performance Report",
"author": "Northwind Analytics",
},
"page": {
"size": {"preset": "A4"},
"margins": {
"top_in_pt": 72,
"right_in_pt": 72,
"bottom_in_pt": 72,
"left_in_pt": 72,
},
},
"styles": {
"text": {
"font_family": "Helvetica",
"font_size_in_pt": 11.0,
"line_height": 1.5,
"color": "#333333",
},
"headline": {
"font_family": "Helvetica",
"font_size_in_pt": 24.0,
"color": "#111111",
"spacing_before_in_pt": 12.0,
"spacing_after_in_pt": 6.0,
"is_bold": True,
},
"link": {
"color": "#0066CC",
"is_underlined": True,
},
"list": {
"text_style": {
"font_family": "Helvetica",
"font_size_in_pt": 11.0,
"line_height": 1.5,
"color": "#333333",
},
"marker_color": "#333333",
"marker_gap_in_pt": 8.0,
},
"table": {
"header": {
"background_color": "#333333",
"text_color": "#FFFFFF",
"font_size_in_pt": 11.0,
"is_bold": True,
},
"body": {
"background_color": "#FFFFFF",
"text_color": "#333333",
"font_size_in_pt": 11.0,
},
"border": {
"outer": {
"top": {"color": "#CCCCCC", "width_in_pt": 1.0},
"right": {"color": "#CCCCCC", "width_in_pt": 1.0},
"bottom": {"color": "#CCCCCC", "width_in_pt": 1.0},
"left": {"color": "#CCCCCC", "width_in_pt": 1.0},
},
"inner": {
"horizontal": {"color": "#EEEEEE", "width_in_pt": 0.5},
"vertical": {"color": "#EEEEEE", "width_in_pt": 0.5},
},
},
},
"grid": {
"background_color": "#FFFFFF",
"border_color": "#CCCCCC",
"border_width_in_pt": 0.0,
"gap_in_pt": 12.0,
},
"separator": {
"color": "#CCCCCC",
"thickness_in_pt": 1.0,
"spacing_before_in_pt": 12.0,
"spacing_after_in_pt": 12.0,
},
"image": {
"border_color": "#000000",
"border_width_in_pt": 0.0,
},
},
"footer": [
{
"type": "paragraph",
"runs": [{
"text": "Northwind Analytics · Confidential · Generated March 14, 2026",
}],
},
],
"content": [
{"type": "headline", "level": "h1", "text": "Q4 Performance Report"},
{"type": "paragraph", "runs": [
{"text": "Executive Summary: ", "is_bold": True},
{"text": "Q4 2025 showed strong revenue growth driven by new enterprise contracts and improved retention rates. Total revenue increased 18% quarter-over-quarter, while operating costs remained flat. Customer acquisition cost decreased by 12%, reflecting improved efficiency in our go-to-market strategy."},
]},
{"type": "separator"},
{"type": "headline", "level": "h2", "text": "Key Metrics"},
{
"type": "table",
"column_widths_in_percent": [40, 20, 20, 20],
"header": {
"cells": [
{"text": "Metric"},
{"text": "Q3", "horizontal_alignment": "right"},
{"text": "Q4", "horizontal_alignment": "right"},
{"text": "Change", "horizontal_alignment": "right"},
],
},
"rows": [
{"cells": [
{"text": "Total Revenue"},
{"text": "$2.4M", "horizontal_alignment": "right"},
{"text": "$2.83M", "horizontal_alignment": "right"},
{"text": "+18%", "horizontal_alignment": "right"},
]},
{"cells": [
{"text": "Active Customers"},
{"text": "1,240", "horizontal_alignment": "right"},
{"text": "1,385", "horizontal_alignment": "right"},
{"text": "+11.7%", "horizontal_alignment": "right"},
]},
{"cells": [
{"text": "Churn Rate"},
{"text": "4.2%", "horizontal_alignment": "right"},
{"text": "3.1%", "horizontal_alignment": "right"},
{"text": "-1.1pp", "horizontal_alignment": "right"},
]},
{"cells": [
{"text": "Customer Acquisition Cost"},
{"text": "$1,850", "horizontal_alignment": "right"},
{"text": "$1,628", "horizontal_alignment": "right"},
{"text": "-12%", "horizontal_alignment": "right"},
]},
],
},
{"type": "separator"},
{"type": "paragraph", "runs": [
{"text": "Report generated on March 14, 2026 by Northwind Analytics. For questions, contact analytics@northwind.com."},
]},
],
},
)
with open("q4-performance-report.pdf", "wb") as f:
f.write(base64.b64decode(result["data"]["buffer"]))Response
{
"success": true,
"data": {
"buffer": "JVBERi0xLjcKMSAwIG9iago8...",
"mime_type": "application/pdf"
}
}Request
package main
import (
"encoding/base64"
"os"
il "github.com/iterationlayer/sdk-go"
)
func main() {
client := il.NewClient("YOUR_API_KEY")
result, err := client.GenerateDocument(il.GenerateDocumentRequest{
Format: "pdf",
Document: il.DocumentDefinition{
Metadata: il.DocumentMetadata{
Title: "Q4 Performance Report",
Author: "Northwind Analytics",
},
Page: il.PageConfig{
Size: il.PageSize{Preset: "A4"},
Margins: il.Margins{TopInPt: 72, RightInPt: 72, BottomInPt: 72, LeftInPt: 72},
},
Content: []il.ContentBlock{
il.NewHeadlineBlock("h1", "Q4 Performance Report"),
il.ParagraphBlock{Type: "paragraph", Runs: []il.TextRun{
{Text: "Executive Summary: ", IsBold: true},
{Text: "Q4 2025 showed strong revenue growth driven by new enterprise contracts and improved retention rates."},
}},
il.NewSeparatorBlock(),
il.NewHeadlineBlock("h2", "Key Metrics"),
il.NewTableBlock([]il.TableRow{
{Cells: []il.TableCell{{Text: "Total Revenue"}, {Text: "$2.4M"}, {Text: "$2.83M"}, {Text: "+18%"}}},
{Cells: []il.TableCell{{Text: "Active Customers"}, {Text: "1,240"}, {Text: "1,385"}, {Text: "+11.7%"}}},
{Cells: []il.TableCell{{Text: "Churn Rate"}, {Text: "4.2%"}, {Text: "3.1%"}, {Text: "-1.1pp"}}},
{Cells: []il.TableCell{{Text: "Customer Acquisition Cost"}, {Text: "$1,850"}, {Text: "$1,628"}, {Text: "-12%"}}},
}),
il.NewSeparatorBlock(),
il.ParagraphBlock{Type: "paragraph", Markdown: "Report generated on March 14, 2026 by Northwind Analytics."},
},
},
})
if err != nil {
panic(err)
}
decoded, _ := base64.StdEncoding.DecodeString(result.Data.Buffer)
os.WriteFile("q4-performance-report.pdf", decoded, 0644)
}Response
{
"success": true,
"data": {
"buffer": "JVBERi0xLjcKMSAwIG9iago8...",
"mime_type": "application/pdf"
}
}