// getting started
Every request to the CustomJS HTTP API is authenticated with your API key. Grab it from your dashboard and pass it in the x-api-key header.
Go to customjs.space and click Sign in.
Sign up with email & password or your Google account.
In your dashboard, under API Key, click Show.
Copy the key and use it in the x-api-key header.
Then include it in the x-api-key header on every request.
A minimal request that generates a PDF from HTML.
curl -X POST 'https://e.customjs.io/__js1-YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-H 'customjs-origin: inline/pdf-generator' \
--data-raw '{
"input": { "html": "<h1>Hello World</h1>" },
"code": "const { HTML2PDF } = require(\"./utils\"); return HTML2PDF(input.html);",
"returnBinary": "true"
}' > output.pdfThe same request from Node.js or the browser.
const apiKey = "YOUR_API_KEY";
const res = await fetch(`https://e.customjs.io/__js1-${apiKey}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"customjs-origin": "inline/pdf-generator"
},
body: JSON.stringify({
input: { html: "<h1>Hello World</h1>" },
code: 'const { HTML2PDF } = require("./utils"); return HTML2PDF(input.html);',
returnBinary: "true"
})
});
const pdf = await res.arrayBuffer();
// Node: require('fs').writeFileSync('output.pdf', Buffer.from(pdf));// next steps
Pick a dedicated endpoint or run your own JavaScript. Either way, the x-api-key header is all you need.
curl -X POST 'https://e.customjs.io/html2pdf' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "input": { "html": "<h1>Hi</h1>" } }' > out.pdf600 free requests / month ยท no credit card