Stickermaker.dev Docs
Sdks

JavaScript SDK

Official SDK for interacting with the Sticker Maker API in Node.js and browsers.

The @sticker-maker/sdk is the easiest way to integrate sticker generation into your JavaScript or TypeScript applications.

Installation

npm install @sticker-maker/sdk

Basic Usage

Initialization

import { StickerMakerClient } from "@sticker-maker/sdk";

const client = new StickerMakerClient({
  apiKey: "your_api_key",
});

Generating a Sticker

The generateSticker method handles the entire async workflow for you, including real-time progress tracking.

const job = await client.generateSticker(
  {
    source: {
      type: "image",
      image: { url: "https://example.com/image.jpg" },
    },
    processing: {
      image: { removeBackground: "hq" },
    },
    output: { format: "webp", size: 512 },
  },
  {
    onProgress: (job) => {
      console.log(`Step: ${job.currentStepName} - ${job.progress}%`);
    },
  },
);

console.log("Sticker ready:", job.result.stickerUrl);

Advanced Usage

Manual Job Management

If you prefer to manage the job lifecycle manually:

// 1. Create the job
const response = await client.createJob(request);
const jobId = response.jobId;

// 2. Create a tracker
const tracker = client.createTracker(jobId);

tracker.on("progress", (data) => {
  console.log("Progress:", data.progress);
});

tracker.on("completed", (result) => {
  console.log("Done!", result.stickerUrl);
});

// 3. Connect to updates
tracker.connect();

Retrieving an Existing Job

const job = await client.getJob("job_abc123");
console.log("Current Status:", job.status);

Listing Your Jobs

const { data: jobs, total } = await client.listJobs({
  limit: 10,
  status: "completed",
});

Cancelling a Job

await client.cancelJob("job_abc123");

Features

  • Multi-Transport Support: Automatically switches between WebSocket, SSE, and Polling based on environment compatibility.
  • Type-Safe: Full TypeScript support with Zod-based validation.
  • Auto-Retry: Built-in exponential backoff for network transient errors.
  • Universal: Works in Node.js, Browsers, and Edge runtimes.

On this page