canonical: https://jentic.com/apis/customjs.space/customjs

# Customjs Space CustomJS API

Jentic publishes the only available OpenAPI specification for CustomJS API, keeping it validated and agent-ready. CustomJS is a hosted automation toolkit for HTML-to-PDF and Markdown-to-PDF conversion, full-page web screenshots, HTML scraping, on-demand JavaScript execution, and lightweight hosted HTML pages. The 9 endpoints let you turn raw HTML or a URL into rendered output without operating a headless browser yourself. Authentication is a single X-API-Key header.

## For AI agents

Convert HTML and Markdown to PDF, capture web screenshots, scrape HTML, and run arbitrary JavaScript - all over a simple HTTP API.

## Scope

Does not handle PDF parsing, OCR, or persistent file storage - use for HTML/Markdown rendering, screenshots, and lightweight scraping only.

## Capabilities

- Convert raw HTML to a downloadable PDF via POST /html2pdf
- Render Markdown to PDF in a single call via POST /markdown2pdf
- Capture a full-page web screenshot of any URL via POST /screenshot
- Scrape rendered HTML from a URL after JavaScript execution via POST /scraper
- Execute custom JavaScript in a sandbox via POST /__js1- and return the result
- Host and serve a small HTML page directly through the upsert-html endpoint

## Use cases

### Generate PDF receipts on demand

Render a templated HTML invoice or receipt to PDF without running a headless Chrome cluster. POST the HTML body to /html2pdf and store the resulting PDF, or attach it to an email. Works well for low-volume back-office workflows where managing Puppeteer or wkhtmltopdf is overkill.

Example prompt: Render the HTML invoice for order 4521 by calling POST /html2pdf and return a downloadable PDF link.

### Periodic visual snapshots of a page

Capture timestamped screenshots of a marketing page or competitor pricing page on a schedule. POST /screenshot accepts a URL and returns a rendered image you can store in object storage. Pair it with a cron-style scheduler to build a visual change log.

Example prompt: Take a screenshot of https://example.com/pricing and store the PNG with today's date as the filename.

### Lightweight scraping for SPA content

Pull rendered HTML out of a JavaScript-heavy single-page app without standing up your own browser pool. POST /scraper executes the page in a real browser and returns the post-render HTML, which a downstream parser can extract into structured records.

Example prompt: Scrape the rendered HTML from https://example.com/products and return the body element only.

### PDF and screenshot tools for AI agents via Jentic

Give an autonomous agent a way to produce documents and visuals as part of its workflow. The agent searches Jentic for 'convert HTML to PDF', loads the schema, and executes the call - the API key is held in the vault rather than the agent's prompt.

Example prompt: Through Jentic, call POST /html2pdf with the HTML body of a generated report and attach the PDF to an outbound email.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/html2pdf` | Convert HTML to PDF |
| POST | `/markdown2pdf` | Convert Markdown to PDF |
| POST | `/screenshot` | Capture a web page screenshot |
| POST | `/scraper` | Scrape post-render HTML from a URL |
| POST | `/__js1-` | Execute custom JavaScript and return the result |
| POST | `/pages/page/upsert-html` | Create or update a hosted HTML page |

## Key resources

- **Conversion** — HTML-to-PDF and Markdown-to-PDF endpoints
- **Screenshots** — Capture full-page or viewport screenshots from URLs
- **Scraping** — Return post-render HTML of a target URL
- **Execution** — Run sandboxed JavaScript and return the result
- **Pages** — Create, retrieve, and delete hosted HTML pages

## Why Jentic

- **Setup:** Wiring the CustomJS API by hand means provisioning an X-API-Key, setting it on every header, and formatting the request bodies for its render, screenshot, and scraper routes yourself. Through Jentic you install once, import the CustomJS API from the API Directory, store the key once, and your agent calls it.
- **Permission scoping:** CustomJS drives each job from the request body rather than a resource id in the URL path, so scope the agent to the operations it needs, such as HTML-to-PDF conversion or taking a screenshot. If you grant only the rendering operations, the scraper is not included unless you add it.
- **Credential handling:** Your CustomJS X-API-Key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'convert HTML to PDF' or 'take a screenshot of a webpage', and Jentic returns the matching CustomJS operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **html2pdf.app** — Single-purpose HTML-to-PDF conversion API
- **Urlbox** — Specialised website screenshot and PDF rendering API
- **PDF.co** — Broader PDF processing toolkit (parsing, splitting, OCR)

## FAQ

### Why is there no official OpenAPI spec for CustomJS API?

CustomJS does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call CustomJS via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the CustomJS API use?

An API key passed in the X-API-Key header on every request. Through Jentic, the key is stored in the encrypted vault and injected at execution time so it never appears in agent prompts or logs.

### Can I generate a PDF from HTML with CustomJS?

Yes. POST /html2pdf with the HTML body returns a rendered PDF. Use POST /markdown2pdf if your source is Markdown - CustomJS handles the conversion in one call.

### Can I scrape JavaScript-rendered pages with CustomJS?

Yes. POST /scraper executes the target URL in a real browser and returns the post-render HTML, which is what you typically need for single-page apps where the source HTML is empty.

### What are the rate limits for the CustomJS API?

Rate limits depend on your CustomJS plan rather than the spec. Watch for 429 responses, back off, and check your account dashboard for the per-minute and per-day quotas tied to your tier.

### How do I convert HTML to PDF through Jentic?

Run pip install jentic, search for 'convert HTML to PDF', load the /html2pdf schema, and execute with your HTML body. Jentic returns the rendered PDF response without your code touching the API key.

### Can I limit what my agent is allowed to do with the CustomJS API?

Yes. Because you run Jentic One yourself, your own rules decide which CustomJS operations and credentials the agent can use, and CustomJS drives each job from the request body rather than a resource id in the path, so you scope the agent to just the operations it needs. For example, you can grant only HTML-to-PDF conversion via POST /html2pdf and screenshot capture via POST /screenshot while withholding the scraper at POST /scraper or JavaScript execution. If you allow only the rendering operations, the scraper is not included unless you add it. The stored X-API-Key is injected at execution time and never enters the agent's prompt or logs.
