// getting started

API Key

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.

Get your API key

01

Go to customjs.space and click Sign in.

02

Sign up with email & password or your Google account.

03

In your dashboard, under API Key, click Show.

04

Copy the key and use it in the x-api-key header.

Then include it in the x-api-key header on every request.

Example. Curl

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.pdf

Example. JavaScript (fetch)

The 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

Got your key? Start building.

Pick a dedicated endpoint or run your own JavaScript. Either way, the x-api-key header is all you need.

auth.curl
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.pdf

600 free requests / month ยท no credit card