- An exhausted window answers 403, not 429. The body is
{"message":"Too Many Requests"}, so the plugin classifies a 403 by its body: a wrong key and an exhausted window share the status. On the free plan that 403 means the day’s quota is used up and carries no reset time, so the plugin reportsCustomjsAPIErrorwithisRateLimitat once instead of retrying. A 429, or a 403 withRetry-After, is retried up to three times. - Files come back base64 encoded.
pdf.fromHtml,pdf.fromMarkdown,screenshot.captureandjavascript.runBinaryreturn{ base64, contentType, byteLength }. Decodebase64to write a file. javascript.runreturns text, not parsed JSON. The route answerstext/plainwhatever the script returns, so an object arrives JSON encoded inoutputand a script with noreturnarrives empty.- Missing required fields render blank files. CustomJS answers 200 with an empty PDF or PNG when
htmlorurlis absent, so the input schema requires them. scrape.agentbills model tokens. It drives a browser for up tomaxStepsactions and returns its token usage.scrape.pageruns your exact steps and spends none.- Page names are not unique.
pages.createpublishes a new page every call, even with a name that already exists, so a retry duplicates it and the plugin never replays that call.pages.deletefails with a 404 for a page ID that does not exist. - Stored functions are not wrapped. The docs describe calling a saved script by ID; the route answered 500 with every ID tried, so this plugin only runs code inline.
- 12 typed API operations
Setup
1
Install
2
Add the plugin
corsair.ts
multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.3
Choose authentication
- API Key (Recommended)
Store the CustomJS API key before the first call: More: API Key
pnpm corsair setup --plugin=customjs --tenant=acme api_key=<your-key> (leave out --tenant without multiTenancy), or pass it as key in the plugin options. With Hub, each tenant enters their own key on the connect page. See API key auth.4
Connect a tenant
Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see Connect / OAuth.
Example API calls
Render HTML to PDFWhat’s next
API reference
Every
customjs.api.* operation with input and output types.Connect / OAuth
createLink, Hub delivery, and tenant connect flows.
Use with agents
Expose this plugin’s operations as MCP tools.