canonical: https://jentic.com/apis/app.onedoclabs.com/onedoclabs

# Onedoclabs API Doc

The Onedoc API generates PDF documents from React components and HTML, giving developers a programmatic way to render branded contracts, receipts, invoices, and reports. Two endpoints cover the lifecycle: /api/docs/initiate prepares the rendering session and /api/docs/generate returns the rendered PDF. The API is designed for teams that want PDF output that mirrors a React frontend without maintaining a headless-browser pipeline.

## For AI agents

Render PDFs from React or HTML templates so an agent can produce branded contracts, receipts, and reports without running headless Chrome.

## Scope

Does not handle e-signatures, document storage, or OCR - use for rendering React or HTML templates to PDF only.

## Capabilities

- Initiate a PDF rendering session via /api/docs/initiate
- Generate a final PDF document by calling /api/docs/generate with the prepared payload
- Render React components to a styled PDF without managing a headless-browser pipeline
- Produce branded receipts and invoices that match the live web UI styling
- Output multi-page documents from a single template payload

## Use cases

### Receipt and Invoice Generation

Render branded receipts and invoices from a React template that already exists in the product UI, removing the need for a separate PDF stylesheet. After /api/docs/initiate prepares the session, /api/docs/generate returns the binary PDF that can be emailed to the customer or stored in the order record. This pattern keeps the visual design in one codebase.

Example prompt: Call POST /api/docs/initiate with the React component payload for the order receipt, then POST /api/docs/generate to retrieve the binary PDF for emailing

### Contract Document Rendering

Generate signed-ready contract PDFs from a templated HTML or React document populated with deal-specific values. The two-step initiate-then-generate flow lets the caller validate the payload before paying for the render, which is useful when contract templates change frequently and rendering is the most expensive step.

Example prompt: Initiate a document with the contract template and merged variables, then generate the PDF and post the URL to the e-signature platform

### Report and Statement Output

Produce monthly statements, analytic reports, or compliance documents as PDFs from a React component populated with data pulled from the warehouse. The Onedoc API handles pagination and styling, so backend services can focus on data assembly rather than maintaining a separate pdf-rendering stack.

Example prompt: Assemble the report data, send the populated React component payload to /api/docs/initiate, then /api/docs/generate to produce the PDF for storage

### Agent-Driven Document Production

Let an AI agent produce PDFs in response to natural-language requests by searching Jentic for 'generate a pdf', loading the Onedoc operation schema, and executing with the template payload. The agent never holds the x-api-key - Jentic injects it at execution time.

Example prompt: Search Jentic for 'generate a pdf from a react template', load the schema for /api/docs/generate, and execute with the user's template payload

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /api/docs/initiate | Initiate a PDF rendering session |
| POST | /api/docs/generate | Generate the final PDF document |

## Key resources

- **Document** — Initiate a rendering session and generate the final PDF output

## Why Jentic

- **Setup:** Wiring Onedoc by hand means learning its x-api-key scheme and sequencing the two-step initiate then generate calls to render a PDF yourself. Through Jentic you install once, import the Onedoc API from the API Directory, store the key once, and your agent calls it.
- **Permission scoping:** Onedoc exposes two operations, POST /api/docs/initiate and POST /api/docs/generate, both taking their target in the request body, so you limit the agent to the operations it needs to render a document. You choose the operations it may call, so the agent only runs the PDF-generation steps you have added.
- **Credential handling:** Your Onedoc x-api-key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'generate a PDF from a React template', and Jentic returns the initiate and generate operations with their input schemas so the agent calls the right sequence without reading Onedoc docs.

## Related APIs

- **PDFMonkey API** — PDFMonkey renders PDFs from HTML/Liquid templates managed in their dashboard
- **PDF Generator API** — PDF Generator API offers a drag-and-drop template builder with merge-data rendering
- **CraftMyPDF API** — CraftMyPDF provides JSON-to-PDF rendering with a visual template editor

## FAQ

### What authentication does the Onedoc API use?

API key authentication via the x-api-key header. Through Jentic the key is stored encrypted in the vault (your Jentic One instance) and never enters agent context - agents receive scoped access only.

### Can I render React components directly to a PDF?

Yes. The two-step flow uses /api/docs/initiate to prepare the rendering session and /api/docs/generate to return the binary PDF. Onedoc's value proposition is that the React component used in your live UI is the same one rendered to PDF.

### What are the rate limits for the Onedoc API?

The OpenAPI spec does not publish explicit rate limits. Limits are governed by your Onedoc subscription tier - check your account dashboard at onedoclabs.com for current quota before bulk rendering.

### How do I generate a PDF through Jentic?

Run pip install jentic, then search 'generate a pdf from html'. Jentic returns POST /api/docs/initiate and POST /api/docs/generate with their input schemas - load each schema in turn and execute. The agent never sees the x-api-key.

### Is the Onedoc API free to use?

Onedoc operates on a tiered subscription with per-render pricing above the free quota. The OpenAPI spec does not encode pricing - refer to onedoclabs.com for current plans.

### Why two endpoints instead of one?

The /api/docs/initiate step lets you validate the payload and lock in template variables before the more expensive /api/docs/generate render call, which is helpful when rendering is metered or when previewing variants before committing.

### Can I limit what my agent is allowed to do with the Onedoc API?

Yes. The Onedoc API exposes only two operations, POST /api/docs/initiate and POST /api/docs/generate, and because Jentic One is self-hosted by you, your own rules decide which of these the agent may call and which credentials it may use. If you want the agent to prepare a rendering session but never trigger a paid render, you can add only the initiate operation and leave out generate. The agent can call nothing you have not added, and the x-api-key stays with your instance rather than the agent.
