Skip to main content

FAQ

1. General API Usage

What is the reportgen API?

The reportgen API is a powerful service for generating customizable PDF reports. It supports various templating engines like GoTempl, EJS, Handlebars, and Raw HTML. The API is designed for developers looking to automate report generation processes such as invoices, sales reports, or any document requiring dynamic data. The API offers both asynchronous and synchronous PDF generation, data insertion, and template customization.

How do I get started with the API?

To get started with the API, visit our Getting Started page. There you will find step-by-step instructions on setting up your access keys, making your first API request, and generating your first PDF report.

What’s the base URL for the API?

The base URL for the reportgen API is:

  • Production: https://reportgen.io/api/v1

Currently, we don't have a sandbox environment, so all requests should be made in the production environment. We recommend using a separate account for testing purposes.


2. Authentication & Access

How do I authenticate with the API?

Authentication is done via API keys. You can obtain an API key by logging into your account and navigating to the Access Keys section. You can also programmatically generate API keys using the /access-keys endpoint. For more details, check the Auth Documentation.

All requests must include the API key in the request header:

-H "X-API-Key: YOUR_API_KEY"

What should I do if I lose my access key?

Access keys are hashed and can only be retrieved once at the time of creation. If you forget or lose your key, you’ll need to create a new one by navigating to the Access Keys section of your account or using the /access-keys API endpoint. Unfortunately, for security reasons, lost keys cannot be recovered.

Can I rotate or regenerate my access keys?

Yes, you can rotate or regenerate your access keys by deleting the old key and creating a new one either from the dashboard or programmatically via the /access-keys endpoint.


3. Error Handling

What do I do if I receive a "401 Unauthorized" error?

A "401 Unauthorized" error typically occurs when:

  • Your API key is missing or incorrect.
  • Your API key has expired or been deleted.

Make sure to double-check that you're including the correct X-API-Key in the headers of your requests.

Why am I receiving a "400 Bad Request" error?

A "400 Bad Request" error usually indicates an issue with your request payload. Common reasons include:

  • Missing required fields in your request.
  • Incorrect data types or malformed JSON in the payload.

Check the API documentation for the required fields and formats for each endpoint.

What do I do if my report is erroring out and not being generated?

If your report fails to generate, the error message will be returned directly in the API response. Alternatively, you can visit the dashboard and hover over the “Error” status of the report to see more details about what went wrong.

Errors like this should never happen, so either something terribly wrong happened on our end or your report template is having issues and can't be rendered - template engine can't handle it (usually syntax issues). Anyway the error message returned should tell exactly what went wrong.


4. Template Engines

What’s the difference between the Raw and templating engines?

  • Raw Engine: The Raw engine allows you to pass plain HTML directly to the API without any templating. It’s ideal for static HTML documents where you don’t need to insert dynamic data.
  • Templating Engines (GoTempl, EJS, Handlebars): These engines allow you to create dynamic reports by inserting data into predefined templates. You can use placeholders within the HTML template to generate content like invoices, sales reports, or any document with dynamic data.

5. PDF Generation

What’s the difference between async and sync PDF generation?

  • Async Generation: Asynchronous generation allows you to initiate a PDF generation process and receive a report ID instantly. You can then use the report ID to check the status or retrieve the report once it’s ready. This is ideal for long-running or complex reports.
  • Sync Generation: Synchronous generation waits for the PDF to be fully generated and returns the file in the response. This is more suitable for smaller, less complex reports where immediate output is required.

Refer to the API Reference for detailed information on how to use each method.


6. Customization & Templates

How do I create custom templates?

Custom templates can be created using the supported templating engines such as GoTempl, EJS, and Handlebars. Templates are written in HTML with placeholders for dynamic data that can be filled in when the report is generated.

For example, using GoTempl, you could have a template like this:

<h1>Invoice for {{.Name}}</h1>
<p>Total Due: ${{.Total}}</p>

Can I include images or charts in my reports?

Yes, you can include images, charts, and other elements within your reports. For charts, we recommend using Chart.js or similar JavaScript libraries that can render data into dynamic charts within the report. You can embed images using standard HTML <img> tags, and the API will render them in the final PDF.

Can I use any front-end library or code in my templates?

Yes, you can use any library or front-end code, such as Tailwind CSS or Chart.js, as long as the page is rendered correctly as static HTML. However, keep in mind that animations do not work in generated PDFs.

What templating engine should I use for my projects?

If you’re using JavaScript or TypeScript, we strongly suggest sticking with EJS or Handlebars as templating engines. They are well-supported and allow for flexible dynamic content generation within your reports.

How do I pass dynamic data to my template?

Dynamic data is passed to the API as a JSON object in the request body. Here’s an example using the EJS templating engine:

{
"html_template": "<h1>Invoice for <%= Name %></h1><p>Total Due: $<%= Total %></p>",
"data": {
"Name": "John Doe",
"Total": 120
},
"engine": "ejs"
}

7. API Limits and Constraints

Is there a limit to the number of reports I can generate per day?

No. We scale with you, not against you. There are no limits on the number of reports you can generate.


8. Troubleshooting & Support

Why is my PDF not rendering correctly?

If your PDF is not rendering as expected:

  • Check your HTML template for syntax errors.
  • Ensure that any referenced assets (images, fonts) are accessible via public URLs.
  • Simplify the content to isolate the issue and test with smaller datasets or templates.

How do I contact support if I encounter an issue?

The fastest way to reach us is via the contact form. We’ll get back to you as soon as possible.

Is there a sandbox environment for testing?

Currently, we do not have a sandbox environment. We recommend creating a separate account for testing purposes.


9. Billing & Pricing

Billing is still under development. We are actively working with our customers to ensure fair and transparent pricing. Stay tuned for updates!