B
BRXPDF API

Welcome to the BRXPDF

The simplest way to convert HTML and websites into high-fidelity PDFs. Designed for developers who need reliable, pixel-perfect documents.

Fast & Reliable

Generate invoices, reports, and tickets in seconds with our optimized engine.

Pixel Perfect

Supports CSS3, Web Fonts, and SVG. What you see is what you print.

Easy Integration

Simple REST API. Works with any language: PHP, Node, Python, or No-Code tools.

Authentication

To use the API, you need an API Key. You must include this key in the header of every request you make.

Security Tip

Your API Key is like a password. Never share it or use it in frontend code (like React or Vue) where users can see it. Always keep it on your backend server.

How to authenticate

Add the Authorization header with the value Bearer YOUR_API_KEY.

Authorization: Bearer 8f9a2b3c4d5e6f7a8b9c0d1e2f3a4b5c...

Synchronous vs. Asynchronous

Understanding when to use "Sync" versus "Async" is the key to building a fast and reliable application. We offer both modes to suit different needs.

Synchronous (Sync)

Best for: Speed, Real-time Feedback, Short Documents

In Sync mode, your request stays open until the PDF is ready. It's like ordering coffee: you wait at the counter and get it immediately.

Recommendation: Use Sync for documents under 5 pages (Invoices, Tickets, Labels).

  • Fastest: No polling required.
  • Simple: Easier to code.
  • Timeout Risk: If generation takes > 30s.
Asynchronous (Async)

Best for: Large Reports, Bulk Jobs, Reliability

In Async mode, you submit a job and get a job_id back instantly. You then check the status later. It's like dropping off dry cleaning.

Recommendation: Use Async for 5+ pages or complex reports.

  • Reliable: Handles 100+ pages perfectly.
  • Scalable: Great for background workers.
  • Slower Flow: Requires two API calls.

Generate PDF

POST https://www.api.brixfly.in/api/v1/generate

This is the main endpoint. By default, it runs in Async mode unless you set sync: true.

Parameters

Parameter Type Description
html String Raw HTML content. Required if url is not provided.
url String Public URL to convert. Required if html is not provided.
filename String Optional. Custom name for the PDF file (e.g. invoice-101.pdf).
sync Boolean Critical: Set to true for immediate output. Default is false.
margin_top String CSS unit (e.g., 20mm, 0.5in). Default: 10mm.
orientation String Portrait (default) or Landscape.

Example Request (Sync Mode)

{
  "html": "

Invoice #101

Total: $50.00

", "filename": "invoice-101.pdf", "margin_top": "20mm", "margin_bottom": "20mm", "sync": true, "orientation": "Portrait" }

Check Status

GET https://www.api.brixfly.in/api/v1/status?job_id={id}

Use this endpoint when running in Async mode (sync: false). Poll this endpoint every 2-3 seconds until the status is completed.

Response Example

{
  "status": "completed",
  "download_url": "https://www.api.brixfly.in/api/v1/download?job_id=...",
  "file_size": 102450
}

HTML Compatibility Guide

Our PDF engine uses a WebKit-based browser. To get the best results, follow these rules.

Best Practices
  • Use Tables: Reliable for layouts and page breaks.
  • Absolute URLs: Use full paths (https://...) for images.
  • Page Breaks: Use page-break-inside: avoid;.
Avoid These
  • Modern Grid: Partial support. Use Flexbox/Tables.
  • Client-Side JS: Send final HTML string.
  • Animations: CSS animations are ignored.

Ready to scale?

We offer flexible solutions for developers and businesses of all sizes.

View Plans & Pricing

Ready to Integrate?

Copy and paste the code below to get started immediately.

curl -X POST "https://www.api.brixfly.in/api/v1/generate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://google.com",
    "sync": true
  }'
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.api.brixfly.in/api/v1/generate");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    "url" => "https://google.com",
    "sync" => true
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer YOUR_API_KEY",
    "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

echo $response;
const axios = require('axios');

async function generatePdf() {
  const response = await axios.post('https://www.api.brixfly.in/api/v1/generate', {
    url: 'https://google.com',
    sync: true
  }, {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

  console.log(response.data);
}

generatePdf();