Errors#
Response Format#
Success Response#
On success, the API returns a JSON object with the image URL or base64 data:
{
"id": "abc123",
"url": "https://api.htmlpix.com/images/abc123.png",
"imageKey": "abc123.png"
}Or with responseFormat: "base64":
{
"id": "abc123",
"base64": "iVBORw0K...",
"mimeType": "image/png"
}Error Response#
On error, the API returns a JSON object:
{
"code": "QUOTA_EXCEEDED",
"message": "Monthly quota of 1000 renders exceeded"
}Error Codes#
| HTTP Status | Code | Description |
|---|---|---|
| 400 | INVALID_BODY | Request body is not valid JSON |
| 400 | MISSING_INPUT | Either html or url field is required |
| 400 | CONFLICTING_INPUT | Cannot specify both html and url |
| 400 | HTML_TOO_LARGE | HTML exceeds maximum size (500KB) |
| 400 | CSS_TOO_LARGE | CSS exceeds maximum size (200KB) |
| 400 | URL_TOO_LONG | URL exceeds maximum length (2048 chars) |
| 400 | INVALID_URL | URL is not valid |
| 400 | INVALID_URL_PROTOCOL | URL must use http or https |
| 400 | SELECTOR_TOO_LONG | CSS selector exceeds max length |
| 401 | MISSING_KEY | Authorization header missing |
| 401 | INVALID_KEY | API key is invalid |
| 401 | KEY_INACTIVE | API key has been revoked |
| 402 | SUBSCRIPTION_INACTIVE | Subscription has expired |
| 429 | QUOTA_EXCEEDED | Monthly render quota exceeded |
| 500 | RENDER_ERROR | Failed to render the HTML |
| 500 | SELECTOR_NOT_FOUND | The specified CSS selector was not found |
| 500 | RENDER_TIMEOUT | Render timed out |
| 503 | NOT_READY | Service is starting up |