SDKs
JavaScript

JavaScriptJavaScript/Node.js SDK

Overview

Official JavaScript/Node.js SDK for the Canvelete API.

Planned Features

  • TypeScript first – Full type definitions included
  • Tree-shakeable – Import only what you need
  • Promise-based – Modern async/await API
  • Browser support – Works in Node.js and browsers
  • Retry logic – Automatic retries with backoff
  • Streaming support – For large files

Expected Installation

npm install @canvelete/sdk
# or
yarn add @canvelete/sdk
# or
pnpm add @canvelete/sdk

Expected Usage

import { Canvelete } from "@canvelete/sdk";
 
const client = new Canvelete({
  apiKey: "cvt_YOUR_API_KEY",
});
 
// Render image
const result = await client.render({
  designId: "abc123",
  format: "png",
  quality: 90,
  dynamicElements: {
    title: { text: "Hello World" },
    image: { src: "https://example.com/image.jpg" },
  },
});
 
console.log("Image URL:", result.imageUrl);
console.log("Render time:", result.renderTime, "ms");

TypeScript Example

import { Canvelete, RenderResponse } from "@canvelete/sdk";
 
const client = new Canvelete({
  apiKey: process.env.CANVELETE_API_KEY!,
});
 
const result: RenderResponse = await client.render({
  designId: "abc123",
  format: "png",
});

Get Notified

Want to be notified when the JavaScript SDK is released?

Join our mailing list (opens in a new tab) or star the repo (opens in a new tab).

Alternative

Use the REST API with fetch or axios:

const response = await fetch("https://api.canvelete.com/api/v1/render", {
  method: "POST",
  headers: {
    Authorization: "Bearer cvt_YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    designId: "abc123",
    format: "png",
  }),
});
 
const data = await response.json();
console.log(data.data.imageUrl);