Connect and render
Send HTML and receive a PNG, JPG, or WebP through the API or MCP. Static and inline-image renders need no account or API key. Uploads and renders that use uploaded assets need your account: an API key, or over MCP an app you have connected.
HopShot supports both inline base64 images and private temporary uploads. Neither replaces the other, and both can be used in the same render.
Choose inline images for small, one-off inputs without an API key. Choose uploads to reuse images across renders or avoid base64 payload overhead, within the upload limits. Both accept static PNG, JPEG, and WebP images.
API quick start
POST JSON to https://hopshot.dev/api/v1/render.
curl --fail-with-body --silent --show-error \
--header 'Content-Type: application/json' \
--dump-header render.headers \
--output render.png \
--data-binary @- \
'https://hopshot.dev/api/v1/render' <<'JSON'
{
"html": "<div class=\"flex h-full w-full items-center justify-center bg-[#112233] text-6xl text-white\">Hello World</div>",
"width": 1200,
"height": 630,
"format": "png"
}
JSON
A successful request saves render.png and the response headers in render.headers. Expect HTTP 200 and Content-Type: image/png. On an HTTP error, curl exits non-zero and saves the error body instead of a PNG.
Request fields
html— static HTML, required unless you supplytemplate. Supply exactly one of these inputs.template— a saved template id (ULID). Uses its saved dimensions and default variables; do not supplywidthorheight.template_version— optional saved version number, valid only withtemplate. Omit it to use the latest version.format— optional string:png,jpg,jpeg, orwebp; defaults topng. Use lowercase values.jpgandjpegboth produce a JPG file.width— optional integer in pixels; defaults to 1200.height— optional integer in pixels; defaults to 630.variables— optional JSON object for[[ name ]],[[ group.name ]], and[[ name | Default value ]]placeholders. With rawhtml, pass{}to activate inline defaults; omittingvariablespreserves the HTML literally. Saved templates bind automatically, with optional variable overrides.
JSON payload
{
"html": "<div class=\"flex h-full w-full items-center justify-center bg-[#112233] text-6xl text-white\">Hello World</div>",
"width": 1200,
"height": 630,
"format": "png"
}
The API sends raw image bytes, not base64 or a file URL. The response Content-Type and filename match the selected format. Rendering completes before the response is streamed, so a failed render can still return an error status. Rendered images are not saved by HopShot; uploaded source images are stored privately until they expire or are deleted.
Variables and inline defaults
Use [[ name ]] or nested lookups such as [[ content.headline ]] in text and supported quoted attributes. Add a fallback with [[ headline | Your headline here ]]. Inline styles and plain <style> rules also support whole-value CSS placeholders, such as color:[[ accent | #c3a06b ]] and font-size:[[ quote.size | 32px ]].
{
"html": "<div style=\"width:100%;height:100%;background:[[ background | #112233 ]];color:[[ accent | #c3a06b ]];font-size:[[ size | 32px ]]\" title=\"[[ description | Example quote ]]\">[[ headline | Make it yours. ]]</div>",
"variables": {},
"width": 320,
"height": 160,
"format": "png"
}
Send this JSON to the render endpoint, or use it as the arguments to MCP render_image. With raw HTML, variables: {} activates binding and uses inline defaults. To customize it, supply values such as {"headline":"Hello!","accent":"#ffffff","size":"24px"} instead. Saved templates always bind: render overrides take precedence over saved variables, then inline defaults. Previews use the saved variables and inline defaults, without needing duplicate entries in the variables object.
Defaults are trimmed literal strings, not filters or expressions. They apply only to absent paths. Supplied empty strings, zero, and false are preserved where valid for the context; null, objects, arrays, and invalid parent paths are errors. An empty text default is allowed: [[ subtitle | ]]. Nested placeholders are not supported.
Text and attribute values are escaped as data, never raw markup. Use normal HTML entities in authored defaults, for example [[ headline | <Welcome> ]] or title="[[ description | "Hello" ]]". Image placeholders must fill the whole src value; defaults and overrides still undergo image validation and private-asset ownership checks. Saved examples cannot depend on temporary uploads.
CSS placeholders must fill a whole declaration value. Only plain colors (hex, named, rgb/rgba, or hsl/hsla), numeric sizes and values, up to four space-separated dimensions, keywords, and font-family lists are accepted. CSS code, URLs, general functions such as calc() and var(), comments, escapes, and !important are rejected. Use [[ size | 32px ]], not [[ size | 32 ]]px. Dynamic tags, attribute names, classes, selectors, custom-property declarations, and quoted CSS strings remain unsupported. Invalid values return invalid_variables rather than silently falling back.
Use a template
Browse the template directory for rendered previews, dimensions, default values, and copyable requests. Public templates need no account. Private templates belong to their owning account and can be accessed with that account’s API keys or connected MCP clients.
Discover designs with GET /api/v1/templates and fetch a definition with GET /api/v1/templates/{id}. Add ?version=1 to fetch a saved version. Lists support search, tags[] (tag names), tag_match (all, the default, or any), shape (square, portrait, or landscape), page, per_page (up to 50), and visibility (public, private, or all). Private/all listings require authentication and never reveal another owner’s private templates.
Discover tags with GET /api/v1/template-tags or MCP list_template_tags. Results contain generated tag IDs, display names, and template counts scoped to the requested visibility. Tags used only on private templates never appear in public discovery. Tag lists support search, visibility, page, and per_page (up to 100). Tags replace the old single category. Shape is derived from the latest canvas dimensions, not stored as a tag.
Over MCP, call list_templates with a tags array of names and optional tag_match and shape, then get_template. Then call render_image, or the existing REST render endpoint, with template, optional template_version, variables, and format. Variable overrides merge with the saved defaults, including nested objects.
{
"template": "01k7q0m0000000000000000001",
"template_version": 1,
"variables": { "headline": "Your next good idea." },
"format": "png"
}
The ULID above is an example; use an id returned by the directory or discovery tools. Template IDs are generated automatically, and display names do not need to be unique. Definition changes keep older numbered versions renderable. Changing a template to private restricts every version and preview. Template previews are stored; images returned by normal render requests are not.
Template authoring (administrators only)
POST /api/v1/templates and MCP create_template accept name, html, width, height, optional description, tags, default/example variables, and visibility. Visibility is only private (default) or public; there is no draft or publish step. Examples must render successfully before anything is saved. Saved examples cannot depend on temporary uploaded assets; use inline images for their defaults.
Only administrators can create or attach tags, including through API keys and OAuth-connected agents. Supply tags as an array of up to 12 names, each at most 80 characters. Existing names are reused ignoring case and extra whitespace; new names are created only for administrators. On update, the array replaces all tags; omit it to preserve them, or send [] to clear them. Tag changes are metadata: they do not render a new preview or create a version.
{"tags": ["Instagram", "Recipe"]}
Update your own templates with PATCH /api/v1/templates/{id} or MCP update_template. Supply only changed fields; the generated id and owner cannot change. Definition edits create a new version and preview. Metadata or visibility changes do not. Missing credentials return 401; authenticated non-administrators receive REST 403 or an MCP tool error with code forbidden. These advertised tools do not grant authoring access to ordinary accounts.
Choose an output format
Set format in the API JSON or MCP tool arguments. Leave it out for PNG. Each request returns one image in the chosen format.
- PNG — lossless, with transparency. A good default for text and graphics. Returns
image/pngandrender.png. - JPG — lossy, without transparency. Set a background color in your HTML. Use
jpgorjpeg; both returnimage/jpegandrender.jpg. - WebP — lossless, with transparency. An alternative for web graphics. Returns
image/webpandrender.webp.
For WebP, change "format": "png" to "format": "webp" in the quick start and change --output render.png to --output render.webp. For JPG, use "format": "jpg" and --output render.jpg. Changing the filename alone does not change the image format.
SVG, animation, and quality controls are not supported by HopShot yet.
Connect an MCP client
Static and inline-image renders and public template discovery need no sign-in. Uploads and the rendering guide need your verified account; template authoring requires administrator access. Claude Desktop and ChatGPT connect with OAuth; you do not create or paste an API key, client ID, or client secret.
Remote clients reach HopShot over the internet, so the URL must be a publicly reachable HTTPS deployment. A local .test address cannot be reached by Claude or ChatGPT.
Claude Desktop
- Open Connectors and add a custom connector.
- Name it
HopShotand enterhttps://hopshot.dev/mcpas the remote MCP server URL. - Under Authentication, choose Sign in now. For the OAuth client, choose Register automatically, not the published-identity option.
- In HopShot, enter your email address, enter the emailed code, then choose Allow access.
- Enable the connector in a conversation and ask Claude to render an image.
ChatGPT
- Add a custom remote MCP server in ChatGPT’s connector or app settings.
- Name it
HopShotand enterhttps://hopshot.dev/mcpas the server URL. - Choose OAuth. If ChatGPT offers client registration, choose automatic registration; no client ID or client secret is needed.
- In HopShot, enter your email address, enter the emailed code, then choose Allow access.
- Select HopShot in a chat and ask ChatGPT to render an image.
To disconnect, open Connected apps on your account page and choose Disconnect for the app.
Other clients and API keys
Other clients can add https://hopshot.dev/mcp as a remote MCP server using Streamable HTTP. Where OAuth is not available, create an API key on your account page and send it as Authorization: Bearer <key>. Clients that accept an mcpServers configuration can use:
{
"mcpServers": {
"hopshot": {
"type": "http",
"url": "https://hopshot.dev/mcp"
}
}
}
Discover the tools. Once connected, call get_rendering_guide with no arguments for supported features, current limits, examples, fonts, and retry guidance. Then call render_image with the same html, width, height, and format fields as the API. The client handles initialization and protocol negotiation.
Test MCP from a terminal
This direct tool call uses protocol version 2025-11-25 and returns JSON:
curl --fail-with-body --silent --show-error \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/event-stream' \
--header 'MCP-Protocol-Version: 2025-11-25' \
--data-binary @- \
'https://hopshot.dev/mcp' <<'JSON'
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "render_image",
"arguments": {
"html": "<div class=\"flex h-full w-full items-center justify-center bg-[#112233] text-6xl text-white\">Hello World</div>",
"width": 1200,
"height": 630,
"format": "png"
}
}
}
JSON
Tool call JSON
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "render_image",
"arguments": {
"html": "<div class=\"flex h-full w-full items-center justify-center bg-[#112233] text-6xl text-white\">Hello World</div>",
"width": 1200,
"height": 630,
"format": "png"
}
}
}
On success, result.isError is false. The image content has type: image, the selected format’s mimeType (image/png, image/jpeg, or image/webp), and base64 image bytes in data. Decode those bytes to save a file; they are not an image URL. Streamable HTTP is the MCP transport, not an incremental image stream.
Upload an image
Upload a local PNG, JPEG, or WebP once, then reference it in as many renders as you need. Uploads belong to your account. An OAuth-connected MCP client can create uploads and render with them as that account without an API key; the file transfer still uses the upload ticket.
The REST example below needs an API key. Create a named key from your account page after signing in; the secret is shown once and expires after 90 days. Send it as Authorization: Bearer <key> on every call except the file transfer itself, which uses the returned Authorization: Upload <ticket> header.
FILE=hero.png
TYPE=image/png
SIZE=$(wc -c < "$FILE" | tr -d ' ')
SHA=$(shasum -a 256 "$FILE" | cut -d' ' -f1)
# 1. Create the upload with your API key
curl --fail-with-body --silent --show-error \
--header "Authorization: Bearer $HOPSHOT_API_KEY" \
--header 'Content-Type: application/json' \
--data "{\"content_type\":\"$TYPE\",\"size_bytes\":$SIZE,\"sha256\":\"$SHA\"}" \
https://hopshot.dev/api/v1/image-uploads > upload.json
# 2. Send the file bytes to the returned URL with the returned upload header
curl --fail-with-body --silent --show-error --request PUT \
--header "Authorization: $(jq -r .upload.headers.Authorization upload.json)" \
--header "Content-Type: $TYPE" \
--header 'Expect:' \
--data-binary @"$FILE" \
"$(jq -r .upload.url upload.json)" > asset.json
# 3. Render with the asset reference
REFERENCE=$(jq -r .asset.reference asset.json)
jq -n --arg reference "$REFERENCE" '{html: "<div style=\"display:flex;width:100%;height:100%;background:#112233;padding:16px\"><img src=\"[[ images.hero ]]\" alt=\"Product photo\" width=\"320\" height=\"160\"></div>", variables: {images: {hero: $reference}}, width: 640, height: 320}' |
curl --fail-with-body --silent --show-error \
--header "Authorization: Bearer $HOPSHOT_API_KEY" \
--header 'Content-Type: application/json' \
--output render.png --data-binary @- \
https://hopshot.dev/api/v1/render
- Create the upload with
content_type, the exactsize_bytes, and the file’s lowercase hexadecimalsha256. The response holdsupload_idand anuploadrequest with aurlandheaders. - Send the file as the raw request body, not JSON or base64, to that
urlwith thoseheadersand a matchingContent-Length. The transfer is authorized by the upload header alone. Do not follow redirects. The response containsasset.reference, for exampleasset:hsa_…. - Add a
variablesobject to your render request, such as{"images": {"hero": "asset:hsa_…"}}, and use<img src="[[ images.hero ]]">in the HTML. The placeholder must be the wholesrcvalue. You can also use the reference directly:<img src="asset:hsa_…">. Requests without variables render the HTML exactly as written when supplying rawhtml; saved templates bind automatically.
The upload request is valid for 5 minutes. An uploaded asset expires 30 minutes after it is accepted and cannot be extended; upload again after it expires or after you delete it. Files can be up to 2 MiB and must be static PNG, JPEG, or WebP images that fit the source image limits.
Only the owner of an upload can use it, through any of that account’s API keys or connected apps. The original file cannot be downloaded, listed, or linked, and renders are returned to you directly rather than hosted. An authenticated render that uses an asset it cannot find returns asset_unavailable whether the reference is unknown, expired, deleted, or belongs to someone else.
GET /api/v1/image-uploads/{upload_id}returns the status, and the asset reference once ready. Use it if the transfer response is lost.DELETE /api/v1/image-assets/{asset_id}revokes an asset immediately.asset_idis thehsa_…part of the reference. Deleting twice is safe.- MCP clients use
create_image_upload,get_image_upload, anddelete_image_asset. The file transfer is still an HTTP request that your client code makes with the returneduploaddetails; MCP does not carry the file. Authenticate the MCP connection with OAuth or an API key as a Bearer header.
Upload errors
- 401 —
authentication_required: send your API key as a Bearer header, or sign in again if you use an OAuth-connected client. Protected MCP calls return HTTP 401 with an OAuth discovery challenge so your client can start sign-in. On the file transfer,upload_ticket_invalidmeans the returned upload header is missing or wrong. - 404 —
upload_unavailableorasset_unavailablefor an authenticated caller: the upload or asset is unknown, expired, deleted, or belongs to someone else. Upload again. Without authentication, the REST request returns 401. - 408 —
upload_timeout: the file transfer arrived too slowly. Retry the same transfer on a faster connection. - 409 —
upload_expired,upload_failed, orupload_conflict: create a new upload.upload_in_progress: check the upload status before retrying. - 429 —
upload_busy: retry the same transfer afterRetry-After.upload_quota_exceeded,upload_capacity_reached, orrate_limited: wait forRetry-Afteror delete assets you no longer need. - 503 —
uploads_unavailable: new uploads are paused; retry afterRetry-After.upload_storage_unavailable,upload_timeout, orupload_interrupted: retry the same transfer.
Supported markup and limits
Use static text and layout elements with inline CSS, plain rules in <style> tags, or common Tailwind classes in class attributes. Text defaults to bundled Instrument Sans; Unicode emoji render in color using bundled Twemoji Mozilla. HopShot is not a browser; not every CSS feature or Tailwind utility is supported.
To use Google Fonts, declare font-family in inline CSS or a stylesheet rule, for example font-family:Roboto,sans-serif;font-weight:700. HopShot automatically downloads and caches the requested families, weights, and styles. Loading is best-effort; unavailable fonts fall back to bundled fonts. Do not add a stylesheet link, @import, @font-face, or a font URL.
Scripts, event handlers, remote images, SVG, arbitrary external assets, uploaded font files, CSS URLs, at-rules, CSS comments, and CSS escapes are not supported. Only the controlled Google Fonts loader fetches remote resources, from fonts.googleapis.com and fonts.gstatic.com.
Inline images
Use <img src="data:image/png;base64,..." alt="Local image" width="64" height="32">. Accepted MIME types are image/png, image/jpeg, and image/webp; images must be static. Images default to block display. CSS sizing and object-fit:contain or object-fit:cover are supported. Call get_rendering_guide for a working example.
Have client code read and base64-encode the local file; do not ask a model to manufacture base64. A conversation attachment is not automatically accessible to a remote MCP server. Inline bytes count toward HTML and request limits, and base64 adds roughly one-third to file size. Resize or recompress oversized images. Metadata is stripped before decoding; orient JPEG pixels client-side because EXIF orientation is not applied.
Remote image URLs, file paths, animated images, SVG, srcset, <picture>, and CSS image URLs remain unsupported. Invalid images fail the render instead of being silently omitted. Layouts containing images must keep measured boxes and transformed bounds within the canvas dimension and pixel limits. Inline images are not stored.
- HTML: up to 1,024 KiB. HTTP request body: up to 2 MiB.
- Dimensions: free and anonymous renders support 1–4096 pixels per side, up to 8,000,000 pixels total. Verified administrators and active subscribers can render up to 8192 pixels per side and 32,000,000 pixels total. Both limits apply.
- HTML structure: at most 2000 nodes and 64 levels of nesting.
- Inline images: up to 16 elements and 8 distinct sources. Compressed bytes: 512 KiB per image, 768 KiB total across distinct sources.
- Source images: up to 4096 pixels per side and 4,000,000 pixels per image; 8,000,000 source pixels total, counting repeated images.
- Image output: up to 8 MiB. Render timeout: 10 seconds.
- Anonymous HTTP requests: 30 per minute per IP, shared across browser rendering, REST, and HTTP MCP. Initialization, discovery, and tool calls count toward this request throttle.
- Anonymous render attempts: 3 per minute, 20 per hour, and 50 per day per IP. The website, REST, and MCP share these allowances.
- Authenticated rendering uses your account allowance (normally 30 per minute), shared across browser sessions, keys, OAuth connections, and stdio. Changing IP or credentials does not reset it.
- Failed and busy render attempts count. Service-wide hourly and daily budgets can also temporarily pause rendering. Customized preview images stay in your browser and are not published or stored by HopShot.
- Up to 2 renders at once across the service.
Read X-RateLimit-Limit and X-RateLimit-Remaining for the HTTP request throttle, which is separate from actual render allowances. For HTTP 429 or 503, respect Retry-After when present. MCP tool errors include error.retry_after for render allowances, budget exhaustion, or a rendering pause. The website shows a countdown and requires another explicit click; it does not automatically retry.
Errors and retries
- 400 — malformed JSON. Send a valid JSON object.
- 413 — request body too large. Reduce the payload.
- 415 — unsupported content type. Send
application/jsonto the render and upload-creation endpoints; send the file transfer with theContent-Typedeclared when the upload was created. - 422 — invalid fields, unsupported markup, invalid or oversized input images, a memory safety limit, or oversized output. Check the message and adjust the request.
- 429 — a request/render allowance reached (
rate_limited), service render budget exhausted (render_budget_exceeded), or all render slots busy (render_busy). RespectRetry-After. - 500 / 503 — rendering failed, is paused (
rendering_paused), or its renderer/quota cache is unavailable (renderer_unavailable/render_budget_unavailable). Retry later; persistent failures need service-side investigation. - 504 — render timeout. Simplify the HTML or reduce the dimensions.
API field validation errors contain message and errors, keyed by field. Other application errors contain error.code and error.message.
MCP tool failures can return HTTP 200 with result.isError: true and an explanation in text content. Check that flag before reading image data. HTTP-level failures such as throttling use the status codes above.