About this endpoint
What it does
Renders source code with Pygments highlighting and returns the rendered output plus metadata about the render. The request body contains the source code and optional rendering options such as format, theme, width, and scale.
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| source | String | Yes | Source code. ≤ 64 KiB via POST, ≤ 8 KiB via GET, ≤ 2000 lines. Long listings fit as format=svg (no pixel ceiling); raster output is limited to 8192×8192 px (~380 lines at 1×). |
| scale | Number | No | Zoom the output 0.5–4×. Ignored when width is set. Raster and PDF output is capped at 8192×8192 px on the hosted plans (WebP 4096×4096); SVG has no ceiling. Default: 1. |
| theme | String | No | Pygments style name. Curated: default, friendly, monokai, dracula, github-dark, solarized-dark, solarized-light, nord, one-dark, gruvbox-dark; any other Pygments style name is accepted too. Default: default. |
| title | String | No | Filename shown in the window bar (implies window). |
| width | Integer | No | Target width in pixels (16–4096); height follows the aspect ratio and must stay within the same pixel ceiling. Overrides scale. |
| format | ENUM | No | Output format. Allowed values: json, svg, png, pdf, jpeg, webp. Default: json. json returns a PNG data URI plus metadata; svg/png/pdf/jpeg/webp return the bytes. |
| window | Boolean | No | Draw a macOS-style window title bar. Default: false. |
| download | Boolean | No | Send Content-Disposition: attachment so browsers save the file. Default: false. |
| language | String | No | Pygments language name, e.g. python; auto-detected when omitted. |
| background | String | No | Background colour as #rrggbb/#rgb, a CSS name, or transparent for none. |
| line_numbers | Boolean | No | Print a line-number gutter. Default: false. |
Response
Returns a JSON object with cache, width, engine, format, height, data_uri, warnings, queued_ms, render_ms, media_type, and engine_version fields. cache is an ENUM string, warnings is an array of strings, width and height are integers, queued_ms and render_ms are integers, and the remaining fields are strings.
| Attribute | Type | Mandatory | Description |
|---|---|---|---|
| cache | ENUM | No | Render cache outcome. Allowed values: hit, miss. |
| width | Integer | No | Rendered output width in pixels. |
| engine | String | No | Rendering engine name. |
| format | String | No | Output format. |
| height | Integer | No | Rendered output height in pixels. |
| data_uri | String | No | Rendered data URI. |
| warnings | String Array | No | Warning messages returned by the renderer. |
| queued_ms | Integer | No | Time spent waiting in queue, in milliseconds. |
| render_ms | Integer | No | Time spent rendering, in milliseconds. |
| media_type | String | No | Media type of the rendered output. |
| engine_version | String | No | Rendering engine version. |



