API Documentation
Web Scrape
Web Search
Prompt Engine
File Store
Scrape
The scrape API allows for retrieving contents from a web page. You can target specific content by specifying selectors you are interested in.
import { JigsawStack } from "jigsawstack";
const jigsawstack = JigsawStack({
apiKey: "your-api-key",
});
const result = await jigsawstack.web.scrape({
url: "https://jigsawstack.com",
});
{
"success": true,
"data": [
{
"selector": "h3:contains('Free')",
"results": [
{
"html": "Free",
"text": "Free",
"attributes": [
{
"name": "class",
"value": "text-foreground text-2xl font-normal uppercase flex items-center gap-4 font-mono"
}
]
},
{
"html": "Free",
"text": "Free",
"attributes": [
{
"name": "class",
"value": "text-lg xl:text-xl 2xl:text-2xl leading-5 uppercase font-mono font-normal flex items-center"
}
]
}
]
},
{
"selector": "h3:contains('Pro')",
"results": [
{
"html": "Pro",
"text": "Pro",
"attributes": [
{
"name": "class",
"value": "text-foreground text-2xl font-normal uppercase flex items-center gap-4 font-mono"
}
]
},
{
"html": "Pro",
"text": "Pro",
"attributes": [
{
"name": "class",
"value": "text-lg xl:text-xl 2xl:text-2xl leading-5 uppercase font-mono font-normal flex items-center"
}
]
}
]
},
{
"selector": "h3:contains('Team')",
"results": [
{
"html": "Team",
"text": "Team",
"attributes": [
{
"name": "class",
"value": "text-foreground text-2xl font-normal uppercase flex items-center gap-4 font-mono"
}
]
},
{
"html": "Team",
"text": "Team",
"attributes": [
{
"name": "class",
"value": "text-lg xl:text-xl 2xl:text-2xl leading-5 uppercase font-mono font-normal flex items-center"
}
]
}
]
},
{
"selector": "h3:contains('Enterprise')",
"results": [
{
"html": "Enterprise",
"text": "Enterprise",
"attributes": [
{
"name": "class",
"value": "text-foreground text-2xl font-normal uppercase flex items-center gap-4 font-mono"
}
]
},
{
"html": "Enterprise",
"text": "Enterprise",
"attributes": [
{
"name": "class",
"value": "text-lg xl:text-xl 2xl:text-2xl leading-5 uppercase font-mono font-normal flex items-center"
}
]
}
]
},
{
"selector": "p.font-mono:contains('$0')",
"results": [
{
"html": "$0",
"text": "$0",
"attributes": [
{
"name": "class",
"value": "mt-2 pb-1 font-mono text-5xl"
}
]
}
]
},
{
"selector": "p.font-mono:contains('$25')",
"results": [
{
"html": "$25",
"text": "$25",
"attributes": [
{
"name": "class",
"value": "mt-2 pb-1 font-mono text-5xl"
}
]
}
]
},
{
"selector": "p.font-mono:contains('$599')",
"results": [
{
"html": "$599",
"text": "$599",
"attributes": [
{
"name": "class",
"value": "mt-2 pb-1 font-mono text-5xl"
}
]
}
]
},
{
"selector": "p.font-mono:contains('Custom')",
"results": [
{
"html": "Custom",
"text": "Custom",
"attributes": [
{
"name": "class",
"value": "mt-2 pb-1 font-mono text-4xl"
}
]
}
]
}
]
}
If the elements
parameter is not set, we default to:
"elements":[ {"selector": "*"} ]
For more information on selectors click here
Request Parameters
Body
The URL of the page to retrieve the contents from. Either url
or html
is
required, but not both.
HTML content to scrape directly. Either url
or html
is required, but not
both.
The list of selectors you are interested in.
HTML selector you are interested in. e.g h1
, p
, span
, e.t.c
Advanced configurations
Tracks console messages emitted when JavaScript within the page calls one
of console API methods. E.g console.log
Tracks network response information such as url
, method
, status
,
headers
and body
.
Tracks cookie information.
Custom HTTP headers to send with requests (key-value pairs)
Array of patterns to intercept and block requests (e.g., [“jpg”, “png”])
Custom page-load behavior settings
Custom timeout in milliseconds (maximum: 120000, or 2 minutes)
Page load event to wait for:
load
- Wait until the load event is fireddomcontentloaded
- Wait until the DOMContentLoaded event is firednetworkidle0
- Wait until there are no network connections for at least 500msnetworkidle2
- Wait until there are no more than 2 network connections for at least 500ms
Wait condition before scraping
Type of waiting condition:
timeout
- Wait for a specified timeselector
- Wait for a specified CSS selector to appearfunction
- Wait for a specified function to return true
The value corresponding to the selected mode:
- For
timeout
: Number of milliseconds to wait (maximum: 60000) - For
selector
: CSS selector to wait for (e.g., “h2.title”) For
function
: JavaScript function as a string (e.g., ”() => document.querySelector(‘h2’)”)
Cookies to set for the page request
Cookie name
Cookie value
The URL to associate with the cookie (either url
or domain
is
required)
Cookie domain (either url
or domain
is required)
Whether the cookie is secure (HTTPS only)
Whether the cookie is HTTP-only
Whether the cookie is same-party
Cookie expiration timestamp
Cookie priority: “Low”, “Medium”, or “High”
Whether to emulate a mobile device viewport
Device scale factor (minimum: 1)
Viewport width in pixels
Viewport height in pixels
Whether to force proxy rotation for each request (incurs additional costs)
Bring-your-own-proxy configuration
Proxy server URL (e.g., “https://username:password@proxy.example.com:8080”)
Header
Your JigsawStack API key
Response Structure
Indicates whether the call was successful
Array of scraped elements
The CSS selector used to find this element
import { JigsawStack } from "jigsawstack";
const jigsawstack = JigsawStack({
apiKey: "your-api-key",
});
const result = await jigsawstack.web.scrape({
url: "https://jigsawstack.com",
});
{
"success": true,
"data": [
{
"selector": "h3:contains('Free')",
"results": [
{
"html": "Free",
"text": "Free",
"attributes": [
{
"name": "class",
"value": "text-foreground text-2xl font-normal uppercase flex items-center gap-4 font-mono"
}
]
},
{
"html": "Free",
"text": "Free",
"attributes": [
{
"name": "class",
"value": "text-lg xl:text-xl 2xl:text-2xl leading-5 uppercase font-mono font-normal flex items-center"
}
]
}
]
},
{
"selector": "h3:contains('Pro')",
"results": [
{
"html": "Pro",
"text": "Pro",
"attributes": [
{
"name": "class",
"value": "text-foreground text-2xl font-normal uppercase flex items-center gap-4 font-mono"
}
]
},
{
"html": "Pro",
"text": "Pro",
"attributes": [
{
"name": "class",
"value": "text-lg xl:text-xl 2xl:text-2xl leading-5 uppercase font-mono font-normal flex items-center"
}
]
}
]
},
{
"selector": "h3:contains('Team')",
"results": [
{
"html": "Team",
"text": "Team",
"attributes": [
{
"name": "class",
"value": "text-foreground text-2xl font-normal uppercase flex items-center gap-4 font-mono"
}
]
},
{
"html": "Team",
"text": "Team",
"attributes": [
{
"name": "class",
"value": "text-lg xl:text-xl 2xl:text-2xl leading-5 uppercase font-mono font-normal flex items-center"
}
]
}
]
},
{
"selector": "h3:contains('Enterprise')",
"results": [
{
"html": "Enterprise",
"text": "Enterprise",
"attributes": [
{
"name": "class",
"value": "text-foreground text-2xl font-normal uppercase flex items-center gap-4 font-mono"
}
]
},
{
"html": "Enterprise",
"text": "Enterprise",
"attributes": [
{
"name": "class",
"value": "text-lg xl:text-xl 2xl:text-2xl leading-5 uppercase font-mono font-normal flex items-center"
}
]
}
]
},
{
"selector": "p.font-mono:contains('$0')",
"results": [
{
"html": "$0",
"text": "$0",
"attributes": [
{
"name": "class",
"value": "mt-2 pb-1 font-mono text-5xl"
}
]
}
]
},
{
"selector": "p.font-mono:contains('$25')",
"results": [
{
"html": "$25",
"text": "$25",
"attributes": [
{
"name": "class",
"value": "mt-2 pb-1 font-mono text-5xl"
}
]
}
]
},
{
"selector": "p.font-mono:contains('$599')",
"results": [
{
"html": "$599",
"text": "$599",
"attributes": [
{
"name": "class",
"value": "mt-2 pb-1 font-mono text-5xl"
}
]
}
]
},
{
"selector": "p.font-mono:contains('Custom')",
"results": [
{
"html": "Custom",
"text": "Custom",
"attributes": [
{
"name": "class",
"value": "mt-2 pb-1 font-mono text-4xl"
}
]
}
]
}
]
}
import { JigsawStack } from "jigsawstack";
const jigsawstack = JigsawStack({
apiKey: "your-api-key",
});
const result = await jigsawstack.web.scrape({
url: "https://jigsawstack.com",
});
{
"success": true,
"data": [
{
"selector": "h3:contains('Free')",
"results": [
{
"html": "Free",
"text": "Free",
"attributes": [
{
"name": "class",
"value": "text-foreground text-2xl font-normal uppercase flex items-center gap-4 font-mono"
}
]
},
{
"html": "Free",
"text": "Free",
"attributes": [
{
"name": "class",
"value": "text-lg xl:text-xl 2xl:text-2xl leading-5 uppercase font-mono font-normal flex items-center"
}
]
}
]
},
{
"selector": "h3:contains('Pro')",
"results": [
{
"html": "Pro",
"text": "Pro",
"attributes": [
{
"name": "class",
"value": "text-foreground text-2xl font-normal uppercase flex items-center gap-4 font-mono"
}
]
},
{
"html": "Pro",
"text": "Pro",
"attributes": [
{
"name": "class",
"value": "text-lg xl:text-xl 2xl:text-2xl leading-5 uppercase font-mono font-normal flex items-center"
}
]
}
]
},
{
"selector": "h3:contains('Team')",
"results": [
{
"html": "Team",
"text": "Team",
"attributes": [
{
"name": "class",
"value": "text-foreground text-2xl font-normal uppercase flex items-center gap-4 font-mono"
}
]
},
{
"html": "Team",
"text": "Team",
"attributes": [
{
"name": "class",
"value": "text-lg xl:text-xl 2xl:text-2xl leading-5 uppercase font-mono font-normal flex items-center"
}
]
}
]
},
{
"selector": "h3:contains('Enterprise')",
"results": [
{
"html": "Enterprise",
"text": "Enterprise",
"attributes": [
{
"name": "class",
"value": "text-foreground text-2xl font-normal uppercase flex items-center gap-4 font-mono"
}
]
},
{
"html": "Enterprise",
"text": "Enterprise",
"attributes": [
{
"name": "class",
"value": "text-lg xl:text-xl 2xl:text-2xl leading-5 uppercase font-mono font-normal flex items-center"
}
]
}
]
},
{
"selector": "p.font-mono:contains('$0')",
"results": [
{
"html": "$0",
"text": "$0",
"attributes": [
{
"name": "class",
"value": "mt-2 pb-1 font-mono text-5xl"
}
]
}
]
},
{
"selector": "p.font-mono:contains('$25')",
"results": [
{
"html": "$25",
"text": "$25",
"attributes": [
{
"name": "class",
"value": "mt-2 pb-1 font-mono text-5xl"
}
]
}
]
},
{
"selector": "p.font-mono:contains('$599')",
"results": [
{
"html": "$599",
"text": "$599",
"attributes": [
{
"name": "class",
"value": "mt-2 pb-1 font-mono text-5xl"
}
]
}
]
},
{
"selector": "p.font-mono:contains('Custom')",
"results": [
{
"html": "Custom",
"text": "Custom",
"attributes": [
{
"name": "class",
"value": "mt-2 pb-1 font-mono text-4xl"
}
]
}
]
}
]
}