All API requests require authentication via the x-api-key header.
Get your API key: API Key Documentation
| Endpoint | Description | Documentation |
|---|---|---|
POST /html2pdf | Convert HTML to PDF with optional Nunjucks templating | HTML to PDF |
POST /markdown2pdf | Convert Markdown to PDF | Markdown to PDF |
POST /screenshot | Capture website screenshots with automation | Screenshot API |
POST /scraper | Scrape HTML content from websites | HTML Scraper |
POST /__js1- | Execute custom JavaScript code | JavaScript Execution |
/html2pdfhttps://e.customjs.io/html2pdf
Converts HTML to PDF with optional template rendering using Nunjucks.
| Name | Type | Required | Description |
|---|---|---|---|
x-api-key | string | ✓ | Your API key |
Content-Type | string | ✓ | Must be application/json |
{
"input": {
"html": "<h1>Hello {{ name }}</h1>",
"data": {
"name": "World"
}
}
}
| Name | Type | Required | Description |
|---|---|---|---|
html | string | ✓ | HTML content to convert to PDF |
data | object | ✗ | Template data - when provided, HTML is automatically rendered using Nunjucks template engine |
Simple HTML:
curl -X POST 'https://e.customjs.io/html2pdf' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"input": {
"html": "<h1>Hello World</h1>"
}
}' \
> output.pdf
With Template Data:
curl -X POST 'https://e.customjs.io/html2pdf' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"input": {
"html": "<h1>Hello {{ name }}</h1><p>Total: {{ total }}</p>",
"data": {
"name": "John",
"total": 100
}
}
}' \
> output.pdf
Content-Type: application/pdf
Returns binary PDF data.
/markdown2pdfhttps://e.customjs.io/markdown2pdf
Converts Markdown to PDF.
| Name | Type | Required | Description |
|---|---|---|---|
x-api-key | string | ✓ | Your API key |
Content-Type | string | ✓ | Must be application/json |
{
"input": {
"markdown": "# Hello World\n\nThis is **bold** text."
}
}
| Name | Type | Required | Description |
|---|---|---|---|
markdown | string | ✓ | Markdown content to convert to PDF |
curl -X POST 'https://e.customjs.io/markdown2pdf' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"input": {
"markdown": "# Hello World\n\nThis is **bold** text."
}
}' \
> output.pdf
Content-Type: application/pdf
Returns binary PDF data.
/screenshothttps://e.customjs.io/screenshot
Captures a screenshot of a web page with optional automation commands and custom viewport.
| Name | Type | Required | Description |
|---|---|---|---|
x-api-key | string | ✓ | Your API key |
Content-Type | string | ✓ | Must be application/json |
{
"input": {
"url": "https://example.com",
"commands": [],
"box": {
"x": 0,
"y": 0,
"width": 1200,
"height": 800
}
}
}
| Name | Type | Required | Description |
|---|---|---|---|
url | string | ✓ | The URL of the page to screenshot |
commands | array | ✗ | Array of automation commands to execute before taking the screenshot (e.g., click, scroll, wait, type) |
box | object | ✗ | Bounding box coordinates for partial screenshots (only applied if width > 0 and height > 0) |
box.x | number | ✗ | X-coordinate of the top-left corner |
box.y | number | ✗ | Y-coordinate of the top-left corner |
box.width | number | ✗ | Width of the screenshot area |
box.height | number | ✗ | Height of the screenshot area |
Full Page Screenshot:
curl -X POST 'https://e.customjs.io/screenshot' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"input": {
"url": "https://example.com",
"commands": []
}
}' \
> output.png
With Automation Commands:
curl -X POST 'https://e.customjs.io/screenshot' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"input": {
"url": "https://example.com",
"commands": [
{"action": "click", "selector": "#accept-cookies"},
{"action": "wait", "value": 1000},
{"action": "scroll", "value": 500}
]
}
}' \
> output.png
Custom Viewport Screenshot:
curl -X POST 'https://e.customjs.io/screenshot' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"input": {
"url": "https://example.com",
"commands": [],
"box": {
"x": 0,
"y": 0,
"width": 1200,
"height": 800
}
}
}' \
> output.png
Content-Type: image/png
Returns binary PNG image data.
/scraperhttps://e.customjs.io/scraper
Scrapes HTML content from a web page with optional automation commands.
| Name | Type | Required | Description |
|---|---|---|---|
x-api-key | string | ✓ | Your API key |
Content-Type | string | ✓ | Must be application/json |
{
"input": {
"url": "https://example.com",
"commands": []
}
}
| Name | Type | Required | Description |
|---|---|---|---|
url | string | ✓ | The URL of the page to scrape |
commands | array | ✗ | Array of automation commands to execute before scraping (e.g., click, scroll, wait, type) |
Simple Scraping:
curl -X POST 'https://e.customjs.io/scraper' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"input": {
"url": "https://example.com",
"commands": []
}
}' \
> output.html
With Automation Commands:
curl -X POST 'https://e.customjs.io/scraper' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"input": {
"url": "https://example.com",
"commands": [
{"action": "click", "selector": "button.load-more"},
{"action": "wait", "value": 2000},
{"action": "type", "selector": "input#search", "value": "CustomJS"}
]
}
}' \
> output.html
Content-Type: text/html
Returns HTML content as text.
The commands parameter accepts an array of automation actions that are executed before taking a screenshot or scraping HTML. Each command is an object with the following structure:
| Action | Parameters | Description | Example |
|---|---|---|---|
click | selector | Click on an element | {"action": "click", "selector": "#button"} |
type | selector, value | Type text into an input field | {"action": "type", "selector": "#search", "value": "text"} |
scroll | value | Scroll down by pixels | {"action": "scroll", "value": 500} |
wait | value | Wait for milliseconds | {"action": "wait", "value": 1000} |
waitForSelector | selector | Wait for element to appear | {"action": "waitForSelector", "selector": ".content"} |
hover | selector | Hover over an element | {"action": "hover", "selector": ".menu-item"} |
{
"commands": [
{"action": "waitForSelector", "selector": "#content"},
{"action": "click", "selector": "#accept-cookies"},
{"action": "wait", "value": 1000},
{"action": "type", "selector": "input#search", "value": "CustomJS"},
{"action": "click", "selector": "button[type='submit']"},
{"action": "wait", "value": 2000},
{"action": "scroll", "value": 500}
]
}
/__js1-https://e.customjs.io/__js1-
Execute custom JavaScript code with input data and access to available NPM modules.
| Name | Type | Required | Description |
|---|---|---|---|
x-api-key | string | ✓ | Your API key |
Content-Type | string | ✓ | Must be application/json |
{
"input": "{\"name\":\"Jon Doe\"}",
"code": "return input.name"
}
| Name | Type | Required | Description |
|---|---|---|---|
input | string | ✓ | Input data for your code. Can be a simple value (e.g., "34324") or an escaped JSON string (e.g., "{\"name\":\"Jon Doe\"}") |
code | string | ✓ | JavaScript code to execute. Use input to access the parsed input data |
curl -X POST 'https://e.customjs.io/__js1-' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"input": "{\"name\":\"Jon Doe\"}",
"code": "return input.name"
}'
Returns the result of the executed JavaScript code.
The following NPM modules are available for use in CustomJS. Contact us if you would like to use another NPM module.
const cheerio = require('cheerio');
const { v4: uuidv4 } = require('uuid');
const axios = require('axios').default;
const AWS = require('@aws-sdk/client-s3'); // Typically you import specific AWS services
const jsrsasign = require('jsrsasign');
const forge = require('node-forge'); // Package is typically called 'node-forge'
const { piexif } = require('piexifjs');
const jsrsasignUtil = require('jsrsasign-util');
const jsonwebtoken = require('jsonwebtoken');
const crypto = require('crypto');
const { Configuration, OpenAIApi } = require('openai');
const JavaScriptObfuscator = require('javascript-obfuscator');
const { AuthRocket } = require('@authrocket/authrocket-node');
const firebaseAdmin = require('firebase-admin');
const { PDFDocument, StandardFonts, rgb } = require('pdf-lib');
const mysql2 = require('mysql2');
const cryptoJs = require('crypto-js');
const nodemailer = require('nodemailer');
const converter = require('json-2-csv');
const htmlToText = require('html-to-text');
const moment = require('moment');
const Alexa = require('ask-sdk-core');
const jose = require('jose');
const { nanoid } = require('nanoid');
const { getJson } = require('serpapi');
const { Storage } = require('@google-cloud/storage');
All APIs return standard HTTP status codes:
| Status Code | Description |
|---|---|
200 | ✓ Success |
400 | ✗ Bad Request - Invalid parameters |
401 | ✗ Unauthorized - Invalid API key |
500 | ✗ Internal Server Error |