API Reference
Base URL: https://api.coderender.app
POST /api/html
Converts raw HTML and CSS into editable Figma output using the viewport dimensions you provide.
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
schemaVersion | string | yes | Must be "1.0". |
html | string | yes | The HTML to convert. Can be a full document or a fragment. |
vpWidth | number | yes | Viewport width in pixels. Range: 120–8192. |
vpHeight | number | yes | Viewport height in pixels. Range: 120–8192. |
outputMode | string | no | "opcode" (default) or "clipboard".
See Opcode mode and Clipboard mode.
|
options.assetPolicy | string | no | "allow-public-https" (default) or "block-external".
See Asset policy below.
|
Asset policy
Controls whether the render environment can fetch external resources during conversion.
- • allow-public-https (default) — HTTPS requests to public hosts are allowed. External images, stylesheets, and web fonts load normally. Private/internal network addresses and non-HTTPS URLs are still blocked.
- • block-external — all external network requests are blocked. Your HTML must be self-contained: inline CSS, data URI images, system fonts. Use this for faster renders when no external assets are needed.
GET /api/balance
Returns your current usage and remaining quota for the billing period.
curl https://api.coderender.app/api/balance \
-H "Authorization: Bearer cr_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" Response:
{
"renders_this_period": 7,
"limit": 25,
"remaining": 18,
"period_start": "2026-04-01T00:00:00Z",
"period_end": "2026-05-01T00:00:00Z"
} Error handling
All error responses return JSON with an error field.
| Status | Meaning | Common cause |
|---|---|---|
400 | Bad Request | Missing or invalid fields. |
401 | Unauthorized | Missing, invalid, or revoked API key. |
429 | Too Many Requests | Monthly quota exceeded. |
502 | Bad Gateway | Render service failed to process the HTML. |
500 | Internal Error | Pipeline failure. Retry or contact support. |
Example error response:
{
"error": "unsupported schema version (must be \"1.0\")"
} HTML tips
For the fastest renders, send self-contained HTML and set assetPolicy to "block-external":
- • Inline CSS — use
<style>blocks or style attributes. - • Embed images — convert to data URIs, or use
allow-public-httpsto load from HTTPS URLs. - • System fonts — use
system-ui,sans-serif, etc. For custom fonts, inline the@font-faceor useallow-public-https. - • Static HTML preferred — send HTML and CSS that already represents the design you want in Figma. Scripts can prepare the visual state, but external network access follows the selected asset policy.
- • Set viewport dimensions — use
vpWidthandvpHeightto match your intended layout (e.g. 1280×900 for desktop, 375×812 for mobile).