API
API Reference

API Reference

Complete specification for the Canvelete Render API.

Render Design

POST /render/design/{designId}

Generates an image from a design template with optional dynamic content.

Path Parameters

ParameterTypeRequiredDescription
designIdstringYesUnique design identifier

Request Body

FieldTypeRequiredDescription
formatstringYesOutput format: png, jpg, webp, pdf
qualityintegerNoImage quality (1-100). Default: 90
widthintegerNoOutput width in pixels. Maintains aspect ratio if height not specified
heightintegerNoOutput height in pixels. Maintains aspect ratio if width not specified
scalenumberNoScale multiplier (0.1-5.0). Default: 1.0
dynamicElementsobjectNoElement overrides (see below)
cachebooleanNoUse cached render if available. Default: true
webhookstringNoURL to receive completion notification

Dynamic Elements

Override text and image elements in the design:

{
  "dynamicElements": {
    "element_id": {
      "text": "Custom text content",
      "color": "#FF5733",
      "fontSize": 24,
      "fontWeight": "bold"
    },
    "image_element_id": {
      "src": "https://example.com/image.jpg",
      "fit": "cover"
    }
  }
}

Text Element Properties

PropertyTypeDescription
textstringText content
colorstringHex color code
fontSizeintegerFont size in pixels
fontWeightstringnormal, bold, light
fontStylestringnormal, italic

Image Element Properties

PropertyTypeDescription
srcstringImage URL (must be publicly accessible)
fitstringcover, contain, fill, scale-down

Response

Success (200)

{
  "success": true,
  "data": {
    "imageUrl": "https://cdn.canvelete.com/renders/abc123.png",
    "format": "png",
    "width": 1920,
    "height": 1080,
    "fileSize": 245678,
    "renderTime": 1234,
    "cached": false
  }
}

Response Fields

FieldTypeDescription
imageUrlstringCDN URL of rendered image
formatstringOutput format
widthintegerImage width in pixels
heightintegerImage height in pixels
fileSizeintegerFile size in bytes
renderTimeintegerRender duration in milliseconds
cachedbooleanWhether result was served from cache

Error Response

{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": {}
  }
}

Error Codes

CodeStatusDescription
INVALID_API_KEY401Missing or invalid authentication
INVALID_DESIGN_ID404Design not found or inaccessible
INVALID_FORMAT400Unsupported output format
INVALID_QUALITY400Quality must be 1-100
INVALID_DIMENSIONS400Width/height out of bounds
INVALID_ELEMENT_ID400Element ID not found in design
INVALID_IMAGE_URL400Image URL inaccessible or invalid
RATE_LIMIT_EXCEEDED429Too many requests
RENDER_FAILED500Internal rendering error
WEBHOOK_FAILED500Webhook delivery failed

Rate Limiting

Rate limit information is included in response headers:

X-RateLimit-Limit: 500
X-RateLimit-Remaining: 499
X-RateLimit-Reset: 1635724800

When rate limit is exceeded:

{
  "success": false,
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded. Try again in 3600 seconds.",
    "details": {
      "retryAfter": 3600
    }
  }
}

Webhooks

Receive notifications when renders complete (useful for long-running renders).

Webhook Request

POST to your specified webhook URL:

{
  "event": "render.completed",
  "timestamp": "2025-11-19T10:30:00Z",
  "data": {
    "designId": "abc123",
    "imageUrl": "https://cdn.canvelete.com/renders/xyz.png",
    "renderTime": 2345
  }
}

Webhook Headers

X-Canvelete-Signature: sha256=...
X-Canvelete-Event: render.completed

Verify webhook authenticity using HMAC signature with your API secret.

Example Requests

Basic Render

curl -X POST https://api.canvelete.com/api/v1/render/design/abc123 \
  -H "Authorization: Bearer cvt_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "png",
    "quality": 90
  }'

With Dynamic Content

curl -X POST https://api.canvelete.com/api/v1/render/design/abc123 \
  -H "Authorization: Bearer cvt_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "png",
    "quality": 95,
    "dynamicElements": {
      "headline": {
        "text": "Black Friday Sale",
        "color": "#FF0000"
      },
      "product_image": {
        "src": "https://example.com/product.jpg"
      }
    }
  }'

Custom Dimensions

curl -X POST https://api.canvelete.com/api/v1/render/design/abc123 \
  -H "Authorization: Bearer cvt_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "jpg",
    "width": 1200,
    "height": 630,
    "quality": 85
  }'