API documentation

Five endpoints. Header auth. Image bytes in, image bytes out.

Authentication

Send your key in the X-API-Key header. Authorization: Bearer <key> is also accepted. Keys look like ss_live_… and are shown once, at creation. If you lose one, rotate it from your dashboard — rotating revokes the previous key immediately.

-H "X-API-Key: ss_live_xxxxxxxxxxxxxxxxxxxxxxxx"

POST /v1/render

Renders a snippet and returns the raw image bytes — image/png by default, or image/svg+xml with "format": "svg". Send a JSON body.

FieldTypeDescription
codestring, requiredThe snippet to render. Up to 100 KB and 500 lines.
languagestringSyntax to highlight. Unknown values fall back to plain text. Default plaintext.
themestring or objectOne of the ids from /v1/themes, or a custom theme object — see below. Default midnight.
formatstringpng or svg. Default png.
titlestringFilename shown in the window title bar. Max 60 characters.
lineNumbersbooleanShow a line-number gutter. Default false.
windowControlsbooleanShow the red/yellow/green dots. Default true.
paddingnumberBackdrop padding in px, 0–160. Default 32.
fontSizenumberCode font size in px, 10–32. Default 15.
scalenumberPixel density for PNG, 1–4. Default 2.

Custom themes

Pass an object instead of an id to tweak one of the 20 presets rather than pick one as-is — every field is optional, and anything you don't set falls through to extends (default midnight). Colors must be plain hex (#rgb, #rrggbb or with alpha) — see /v1/themes for the full list of overridable fields.

Every field below is optional — this example sets all of them just to show what exists. A real request would only include the ones you actually want to change.

{
  "code": "const hi = 1;",
  "language": "javascript",
  "theme": {
    "extends": "midnight",
    "background": "#0a0014",
    "window": "#1a0033",
    "titleBar": "#241147",
    "border": "#3d1a66",
    "lineNumber": "#6b4a99",
    "title": "#b799e6",
    "shadow": 0.6,
    "colors": {
      "plain": "#e8ddff",
      "keyword": "#ff00ff",
      "string": "#00ffcc",
      "number": "#ffcc00",
      "comment": "#7a5c99",
      "function": "#66ccff",
      "type": "#ff9d00",
      "property": "#00ffcc",
      "operator": "#ff00ff",
      "punctuation": "#b799e6"
    }
  }
}

Every successful response carries your quota state:

HeaderMeaning
X-Quota-UsedRenders consumed this month.
X-Quota-RemainingRenders left before the quota resets.
X-Render-Cachedtrue when served from cache.
X-Image-Width / X-Image-HeightOutput dimensions in CSS px.

Other endpoints

EndpointAuthReturns
GET /v1/usageAPI keyYour current plan, usage and reset date.
GET /v1/themesnoneAvailable theme ids and names.
GET /v1/languagesnoneSupported language identifiers.
GET /v1/plansnonePlans, prices and monthly limits.
GET /healthznoneService health for uptime monitors.

Errors

Failures return JSON: {"error": {"code": "...", "message": "..."}}.

StatusCodeWhat happened
400invalid_requestA field is missing or out of range. The field property says which.
401unauthorizedMissing, invalid or revoked API key.
402quota_exceededMonthly limit reached. Upgrade or wait for the reset.
413payload_too_largeRequest body above the size cap.
429rate_limitedToo many requests. Honour the Retry-After header.
503raster_unavailablePNG backend is down. Retry, or request "format": "svg".

Renders that fail after passing validation are refunded automatically — you are never billed for an image you did not receive.

Caching

Identical parameters always produce identical bytes, served from a content-addressed cache. Cached responses still count against your quota (they're still API calls), but they return in single-digit milliseconds. Responses carry a stable ETag, so you can revalidate cheaply from your own CDN.

Full example

#!/usr/bin/env bash
set -euo pipefail

curl --fail-with-body -X POST "$SS_HOST/v1/render" \
  -H "X-API-Key: $SS_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<'JSON' --output snippet.png
{
  "code": "SELECT id, email\nFROM users\nWHERE created_at > now() - interval '7 days';",
  "language": "sql",
  "theme": "sunset",
  "title": "recent_signups.sql",
  "lineNumbers": true,
  "scale": 3
}
JSON