Scrape

Start Scrape Job

Starts a scrape job for a given URL.

Method: client.scrape.start(params: StartScrapeJobParams): Promise<StartScrapeJobResponse>

Endpoint: POST /api/scrape

Parameters:

Response: StartScrapeJobResponse

Example:

const response = await client.scrape.start({
  url: "https://example.com",
});
console.log(response.jobId);

Get Scrape Job

Retrieves details of a specific scrape job.

Method: client.scrape.get(id: string): Promise<ScrapeJobResponse>

Endpoint: GET /api/scrape/{id}

Parameters:

  • id: string - Scrape job ID

Response: ScrapeJobResponse

Example:

const response = await client.scrape.get(
  "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
);
console.log(response.status);

Start Scrape Job and Wait

Start a scrape job and wait for it to complete

Method: client.scrape.startAndWait(params: StartScrapeJobParams): Promise<ScrapeJobResponse>

Parameters:

Response: ScrapeJobResponse

Example:

const response = await client.scrape.startAndWait({
  url: "https://example.com"
});
console.log(response.status);

Types

ScrapeFormat

type ScrapeFormat = "markdown" | "html" | "links" | "screenshot";

ScrapeJobStatus

type ScrapeJobStatus = "pending" | "running" | "completed" | "failed";

ScrapeOptions

interface ScrapeOptions {
  formats?: ScrapeFormat[];
  includeTags?: string[];
  excludeTags?: string[];
  onlyMainContent?: boolean;
  waitFor?: number;
  timeout?: number;
}

StartScrapeJobResponse

interface StartScrapeJobResponse {
  jobId: string;
}

ScrapeJobData

interface ScrapeJobData {
  metadata?: Record<string, string | string[]>;
  markdown?: string;
  html?: string;
  links?: string[];
}

ScrapeJobResponse

interface ScrapeJobResponse {
  jobId: string;
  status: ScrapeJobStatus;
  data?: ScrapeJobData;
  error?: string;
}

Last updated

Logo

© 2025 S2 Labs, Inc. All rights reserved.