Parsew
Get Started

Quickstart

Get up and running with Parsew in under 5 minutes.

Install the SDK

npm install @parsew/sdk zod zod-to-json-schema
npm install @parsew/sdk valibot
npm install @parsew/sdk arktype

Initialize the client

index.ts
import { Parsew } from '@parsew/sdk/server'

const parsew = new Parsew({
  apiKey: 'sr_...',
})

Scrape a page

scrape.ts
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 page

Extract 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.

extract.ts
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 }
extract.ts
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 }
extract.ts
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

brand.ts
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 image

Get a logo URL

logo.ts
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

On this page