Models

Explore our complete list of models and API references here.

Prerequisites

Before you begin, make sure you have:

Installation

Choose your preferred package manager to install the JigsawStack SDK:

npm install jigsawstack

Configuration

There are two ways to configure your JigsawStack SDK:

Create a .env file in your project root:

.env
JIGSAWSTACK_API_KEY=your-api-key

Option 2: Direct configuration

Initialize the SDK with your API key:

import { JigsawStack } from "jigsawstack";

const jigsawstack = JigsawStack({
  apiKey: "your-api-key",
});

Quick Example

Here’s how to use JigsawStack’s AI Web Scraper to extract product information:

import { JigsawStack } from "jigsawstack";

// Initialize the SDK (API key from environment variables)
const jigsawstack = JigsawStack();

// Basic usage - extract pricing information
const result = await jigsawstack.web.ai_scrape({
  url: "https://supabase.com/pricing",
  element_prompts: ["Plan title", "Plan price"],
});

Response Format

The AI scraper returns structured data based on your prompts:

{
  "page_position": 1,
  "page_position_length": 3,
  "context": {
    "Plan title": ["Free", "Pro", "Team", "Enterprise"],
    "Plan price": ["$0", "$25", "$599", "Custom"]
  },
  "selectors": {
    "Plan title": [
      "h3.text-foreground.text-2xl.font-normal.uppercase.flex.items-center.gap-4.font-mono"
    ],
    "Plan price": [
      "div.text-foreground.flex.items-baseline.text-5xl.font-normal.lg\\:text-4xl.xl\\:text-4xl.border-b.border-default.lg\\:min-h-\\[175px\\].py-8.lg\\:pb-0.lg\\:pt-10 p.mt-2.pb-1.font-mono.text-5xl",
      "div.text-foreground.flex.items-baseline.text-5xl.font-normal.lg\\:text-4xl.xl\\:text-4xl.border-b.border-default.lg\\:min-h-\\[175px\\].py-6.lg\\:pb-0.pt-6 p.mt-2.pb-1.font-mono.text-5xl",
      "div.text-foreground.flex.items-baseline.text-5xl.font-normal.lg\\:text-4xl.xl\\:text-4xl.border-b.border-default.lg\\:min-h-\\[175px\\].py-8.lg\\:pb-0.lg\\:pt-10 p.mt-2.pb-1.font-mono.text-4xl"
    ]
 },
 ...
}

What’s Next?

Now that you’ve set up JigsawStack, you can:

Kuddos! You’re ready to build powerful AI applications with JigsawStack.