Get Started
Quickstart
Get up and running with Parsew in under 5 minutes.
Install the SDK
npm install @parsew/sdk zod zod-to-json-schemanpm install @parsew/sdk valibotnpm install @parsew/sdk arktypeInitialize the client
import { Parsew } from '@parsew/sdk/server'
const parsew = new Parsew({
apiKey: 'sr_...',
})Scrape a page
const result = await parsew.scrape('https://example.com')
console.log(result.markdown) // Page content as Markdown
console.log(result.links) // All links found on the pageExtract structured data
Define a schema with your preferred validation library and pass it to extract().
Any library that implements standard-schema works out of the box.
import { z } from 'zod'
const result = await parsew.extract('https://example.com/product', {
schema: z.object({
title: z.string(),
price: z.number(),
inStock: z.boolean(),
}),
prompt: 'Extract the product details',
})
console.log(result.data) // { title: "...", price: 29.99, inStock: true }import * as v from 'valibot'
const result = await parsew.extract('https://example.com/product', {
schema: v.object({
title: v.string(),
price: v.number(),
inStock: v.boolean(),
}),
prompt: 'Extract the product details',
})
console.log(result.data) // { title: "...", price: 29.99, inStock: true }import { type } from 'arktype'
const result = await parsew.extract('https://example.com/product', {
schema: type({
title: 'string',
price: 'number',
inStock: 'boolean',
}),
prompt: 'Extract the product details',
})
console.log(result.data) // { title: "...", price: 29.99, inStock: true }Analyze a brand
const result = await parsew.brand('https://stripe.com')
console.log(result.data.colors) // Primary, secondary, accent, etc.
console.log(result.data.typography) // Font families, sizes
console.log(result.data.images) // Logo, favicon, OG imageGet a logo URL
import { ParsewBrands } from '@parsew/sdk/client'
const brands = new ParsewBrands({ token: 'pk_...' })
// Build a URL for an <img> tag
const url = brands.url('stripe.com', { size: 256, format: 'webp' })
// Or fetch the logo programmatically
const logo = await brands.fetch('stripe.com', { size: 512 })
console.log(logo.contentType) // "image/png"
console.log(logo.data) // ArrayBuffer