# HTML to Image — how to use (mcp.ai)

Connect your HTML to Image account and use 3 tools for images and design straight from your AI agent. Connect with your own API key. HTML to Image is a service that converts HTML and CSS into images or captures screenshots of web pages.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_html_to_image?ms=1787291280000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `html_to_image_check_usage`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/html_to_image`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/html_to_image/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/html_to_image/check/usage` — Attempts to retrieve account usage statistics from the HTML-to-Image API by trying multiple common endpoint patterns. NOTE: The html2img.com API does not officially document a dedicated usage statisti
  - body: { endpoint_paths?: string[], return_defaults_on_error?: boolean }
- `POST https://api.mcp.ai/api/html_to_image/convert/to/image` — Tool to convert HTML content into an image. Returns either a downloadable file or a JSON payload containing id and url, depending on the upstream API behavior.
  - body: { html: string, width?: integer, height?: integer }
- `POST https://api.mcp.ai/api/html_to_image/get/image` — Retrieve a previously generated image by its URL. Use this to fetch, resize, or download an existing HTML-to-image asset. The image URL is typically obtained from the 'url' field of the HTML_TO_IMAGE_
  - body: { dl?: integer, dpi?: integer, width?: integer, height?: integer, image_id: string }

## Example prompts
- "What can I do in HTML to Image?"
- "Show me a summary of my HTML to Image account"

## More
- Page: https://mcp.ai/html_to_image
- Agent spec (llms.txt): https://mcp.ai/html_to_image/llms.txt
- Postman collection: https://mcp.ai/html_to_image/postman.json
