---
title: Generate Report Document from JSON API
slug: generate-report-document-from-json-api
url: https://apyhub.com/callable-labs/service/generate-report-document-from-json-api
provider: Callable Labs
tags: [document-generation, reporting, pdf-rendering, docx-export, html-rendering]
auth: api_key
version: v1
service_type: sync
endpoints: 1
atoms: 200
mcp: true
---

# Generate Report Document from JSON API

Render structured JSON into PDF, HTML, or DOCX reports. Returns file bytes or a data URI plus render metadata, cache status, and page count.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/callable-labs/generate-report-document-from-json-api/v1/documents/preset/report` | What it does Generates a rendered report from JSON report content and returns the render metadata a… | 200 |

## Endpoint reference

### Generate a preset document from JSON (report)

`POST https://api.eu.apyhub.com/callable-labs/generate-report-document-from-json-api/v1/documents/preset/report` · 200 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `data.date` | body | string | yes | Date Default: `14 October 2026`. |
| `data.title` | body | string | yes | Title Default: `Quarterly Sales Review`. Example: `Quarterly Operations Review`. |
| `data.author` | body | any | no | Author Default: `Example Company`. |
| `data.footer` | body | any | no | Footer Default: `null`. |
| `data.summary` | body | any | no | Executive summary printed before the sections. Default: `A review of quarterly sales and upcoming priorities.`. |
| `data.sections` | body | array of object | yes | Sections |
| `data.sections[].table` | body | any | no | Default: `{"rows":[["July","120"],["August","134"],["September","142"]],"columns":["Month","Orders"]}`. |
| `data.sections[].bullets` | body | array of string | no | Bullets |
| `data.sections[].heading` | body | string | yes | Heading Default: `Sales`. |
| `data.sections[].paragraphs` | body | array of string | no | Paragraphs Default: `["Orders increased across the product range."]`. |
| `data.subtitle` | body | any | no | Subtitle Default: `null`. |
| `page.size` | body | string | no | Paper size. One of: A4, Letter, Legal, A3, A5. Default: `A4`. |
| `page.margin_mm` | body | number | no | Uniform page margin in millimetres. Default: `18`. |
| `page.orientation` | body | string | no | Orientation One of: portrait, landscape. Default: `portrait`. |
| `format` | body | string | no | `pdf`, `html` or `docx` return the bytes; `json` (default) returns a PDF data URI plus metadata. One of: json, html, pdf, docx. Default: `pdf`. |
| `download` | body | boolean | no | Send `Content-Disposition: attachment` so browsers save the file. Default: `false`. |

#### Quickstart

Render a report from the required report data and return JSON metadata by default.

```bash
curl -X POST "https://api.eu.apyhub.com/callable-labs/generate-report-document-from-json-api/v1/documents/preset/report" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "data": {
      "title": "Quarterly Operations Review",
      "date": "18 September 2026",
      "sections": [
        {
          "heading": "Volume",
          "paragraphs": ["Requests grew steadily through the quarter."]
        }
      ]
    }
  }'
```

#### What you'll get back

Returns a JSON object with metadata about the render. The schema declares top-level fields such as `bytes` (`integer`), `cache` (`hit` or `miss`), `pages` (`integer` or `null`), `engine` (`string`), `format` (`docx`, `pdf`, or `html`), `data_uri` (`string`), `warnings` (`string[]`), `queued_ms` (`integer`), `render_ms` (`integer`), `media_type` (`string`), and `engine_version` (`string`).

```json
{
  "bytes": 12345,
  "cache": "miss",
  "pages": 2,
  "engine": "render-report-preset",
  "format": "pdf",
  "data_uri": "data:application/pdf;base64,...",
  "warnings": [],
  "queued_ms": 12,
  "render_ms": 340,
  "media_type": "application/pdf",
  "engine_version": "1.0.0"
}
```

## About

## What it does
Report Generator turns structured JSON into a formatted report document. Send report content with a title, date, and one or more sections, then choose the output format you need: PDF, HTML, DOCX, or JSON metadata.

Use the `body.data` object to provide report content. The schema supports an optional `subtitle`, `author`, `footer`, and `summary`, plus up to 50 sections. Each section needs a `heading` and can include `paragraphs`, `bullets`, or a `table` with `columns`, `rows`, and an optional `caption`. You can also set page options such as `size`, `margin_mm`, and `orientation`, and control whether the result is downloaded as a file.

The response includes rendering details such as `bytes`, `cache`, `pages`, `engine`, `format`, `data_uri`, `warnings`, `queued_ms`, `render_ms`, `media_type`, and `engine_version`. For PDF output, `pages` reports the page count; for DOCX and HTML, it is null. That makes it useful for operational reports, summaries, status updates, and templated documents where you already have the content in JSON and need consistent output across runs.

Use Report Generator when your app assembles report data programmatically and you need predictable document rendering without building a layout engine yourself.

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/callable-labs/service/generate-report-document-from-json-api
