Call pdf.xhub from any stack
Plain HTTP, no client library required. Edge-runtime compatible — works wherever fetch works. Pick your stack, copy the snippet.
// app/api/render/route.ts (Next.js 16, App Router)
export async function POST(req: Request) {
const body = await req.json();
const res = await fetch('https://api.pdf.xhub.io/v1/render', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.PDFXHUB_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
return new Response(await res.arrayBuffer(), {
headers: { 'Content-Type': 'application/pdf' },
});
}// app/api/render/route.ts (Next.js 16, App Router)
export async function POST(req: Request) {
const body = await req.json();
const res = await fetch('https://api.pdf.xhub.io/v1/render', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.PDFXHUB_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
return new Response(await res.arrayBuffer(), {
headers: { 'Content-Type': 'application/pdf' },
});
}Don’t see your stack?
We publish OpenAPI 3.1 — generate a typed client for any language with openapi-generator.