Understanding API responses helps you handle them correctly in your code.
Successful Response (200 OK)
{
"success": true,
"imageUrl": "https://cdn.canvelete.com/renders/abc123def456.png",
"renderTime": 234,
"format": "png",
"width": 1080,
"height": 1080
}
| Field | Description |
|---|
success | Always true for successful renders |
imageUrl | Direct URL to your generated image |
renderTime | How long the render took (milliseconds) |
format | The output format you requested |
width / height | Dimensions of the generated image |
Error Response (4xx/5xx)
{
"success": false,
"error": {
"code": "INVALID_DESIGN_ID",
"message": "The specified design was not found"
}
}
Common Error Codes
| Code | Meaning | Solution |
|---|
INVALID_API_KEY | API key is wrong or revoked | Check your key in Dashboard |
INVALID_DESIGN_ID | Design doesn't exist | Verify the design ID |
RATE_LIMIT_EXCEEDED | Too many requests | Wait and retry, or upgrade plan |
INSUFFICIENT_CREDITS | Out of render credits | Add credits or upgrade |
INVALID_ELEMENT | Element name doesn't exist | Check layer names in editor |
Handling Responses in Code
const response = await fetch(url, options);
const data = await response.json();
if (data.success) {
console.log("Image URL:", data.imageUrl);
} else {
console.error("Error:", data.error.message);
}
Was this article helpful?
Need more help? Contact support