Quickstart
Get an API key and make your first request with cURL or your preferred SDK.
Try a request
Create an account, then copy your key from the dashboard. Set it in the shell where you’ll run the example:export CONTEXT_DEV_API_KEY="ctxt_secret_..."
- Scrape
- Fields
- Images
- Map URLs
- Answers
- Brand
- Styleguide
- Batches
- Monitors
Turn a webpage into Markdown. Read page text from
mainContentOnly keeps only the main content of the page. This request costs 1 credit.curl https://api.context.dev/v1/web/scrape \
--request POST \
--header "Authorization: Bearer $CONTEXT_DEV_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"url": "https://example.com",
"formats": { "markdown": true },
"sharedParams": { "mainContentOnly": true }
}'
import ContextDev from "context.dev";
const client = new ContextDev({ apiKey: process.env.CONTEXT_DEV_API_KEY });
const page = await client.web.scrape({
url: "https://example.com",
formats: { markdown: true },
sharedParams: { mainContentOnly: true },
});
console.log(page.markdown.data);
import os
from context.dev import ContextDev
client = ContextDev(api_key=os.environ["CONTEXT_DEV_API_KEY"])
page = client.web.scrape(
url="https://example.com",
formats={"markdown": True},
shared_params={"main_content_only": True},
)
print(page.markdown.data)
require "cgi/core"
require "context_dev"
client = ContextDev::Client.new(api_key: ENV.fetch("CONTEXT_DEV_API_KEY"))
page = client.web.scrape(
url: "https://example.com",
formats: {markdown: true},
shared_params: {main_content_only: true},
)
puts page.markdown.data
package main
import (
"context"
"fmt"
"os"
contextdev "github.com/context-dot-dev/context-go-sdk/v2"
"github.com/context-dot-dev/context-go-sdk/v2/option"
)
func main() {
client := contextdev.NewClient(option.WithAPIKey(os.Getenv("CONTEXT_DEV_API_KEY")))
page, err := client.Web.Scrape(context.Background(), contextdev.WebScrapeParams{
URL: "https://example.com",
Formats: contextdev.WebScrapeParamsFormats{Markdown: contextdev.Bool(true)},
SharedParams: contextdev.WebScrapeParamsSharedParams{MainContentOnly: contextdev.Bool(true)},
})
if err != nil {
panic(err)
}
fmt.Println(page.Markdown.Data)
}
<?php
require __DIR__.'/vendor/autoload.php';
use ContextDev\Client;
$client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY'));
$page = $client->web->scrape(
formats: ['markdown' => true],
url: 'https://example.com',
sharedParams: ['mainContentOnly' => true],
);
echo $page->markdown->data, PHP_EOL;
markdown.data. The page title, description, and other tags are in metadata. The scrape guide covers content controls, freshness, and dynamic pages.Pass a YouTube video URL to get its metadata, description, and timestamped transcript as Markdown. Follow the YouTube transcript guide.Select fields from a page with CSS selectors and get them back as JSON. Each rule is a selector string or an object with Read the fields from
selector, type, and output. This request costs 1 credit.curl https://api.context.dev/v1/web/scrape \
--request POST \
--header "Authorization: Bearer $CONTEXT_DEV_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"url": "https://example.com",
"formats": { "parse": true },
"parseParams": {
"rules": {
"title": "h1",
"links": { "selector": "a", "type": "list", "output": "@href" }
}
}
}'
import ContextDev from "context.dev";
const client = new ContextDev({ apiKey: process.env.CONTEXT_DEV_API_KEY });
const page = await client.web.scrape({
url: "https://example.com",
formats: { parse: true },
parseParams: {
rules: {
title: "h1",
links: { selector: "a", type: "list", output: "@href" },
},
},
});
console.log(page.parsed.data);
import os
from context.dev import ContextDev
client = ContextDev(api_key=os.environ["CONTEXT_DEV_API_KEY"])
page = client.web.scrape(
url="https://example.com",
formats={"parse": True},
parse_params={
"rules": {
"title": "h1",
"links": {"selector": "a", "type": "list", "output": "@href"},
},
},
)
print(page.parsed.data)
require "cgi/core"
require "context_dev"
client = ContextDev::Client.new(api_key: ENV.fetch("CONTEXT_DEV_API_KEY"))
page = client.web.scrape(
url: "https://example.com",
formats: {parse: true},
parse_params: {
rules: {
title: "h1",
links: {selector: "a", type: "list", output: "@href"},
},
},
)
pp page.parsed.data
package main
import (
"context"
"fmt"
"os"
contextdev "github.com/context-dot-dev/context-go-sdk/v2"
"github.com/context-dot-dev/context-go-sdk/v2/option"
)
func main() {
client := contextdev.NewClient(option.WithAPIKey(os.Getenv("CONTEXT_DEV_API_KEY")))
page, err := client.Web.Scrape(context.Background(), contextdev.WebScrapeParams{
URL: "https://example.com",
Formats: contextdev.WebScrapeParamsFormats{Parse: contextdev.Bool(true)},
ParseParams: contextdev.WebScrapeParamsParseParams{
Rules: map[string]contextdev.WebScrapeParamsParseParamsRuleUnion{
"title": {OfString: contextdev.String("h1")},
"links": {OfWebScrapesParseParamsRuleObject: &contextdev.WebScrapeParamsParseParamsRuleObject{
Selector: "a",
Type: "list",
Output: "@href",
}},
},
},
})
if err != nil {
panic(err)
}
fmt.Println(page.Parsed.Data)
}
<?php
require __DIR__.'/vendor/autoload.php';
use ContextDev\Client;
$client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY'));
$page = $client->web->scrape(
formats: ['parse' => true],
url: 'https://example.com',
parseParams: [
'rules' => [
'title' => 'h1',
'links' => ['selector' => 'a', 'type' => 'list', 'output' => '@href'],
],
],
);
print_r($page->parsed->data);
parsed.data. A missing item returns null and a missing list returns []. Add markdown or html to formats to get page content in the same request for the same credit. See Extract structured fields with CSS for rule shapes and nesting.Find image sources referenced by a webpage. This request costs 1 credit.Read the manifest from
curl https://api.context.dev/v1/web/scrape \
--request POST \
--header "Authorization: Bearer $CONTEXT_DEV_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"url": "https://stripe.com",
"formats": { "images": true }
}'
import ContextDev from "context.dev";
const client = new ContextDev({ apiKey: process.env.CONTEXT_DEV_API_KEY });
const page = await client.web.scrape({
url: "https://stripe.com",
formats: { images: true },
});
console.log(page.images.data);
import os
from context.dev import ContextDev
client = ContextDev(api_key=os.environ["CONTEXT_DEV_API_KEY"])
page = client.web.scrape(
url="https://stripe.com",
formats={"images": True},
)
print(page.images.data)
require "cgi/core"
require "context_dev"
client = ContextDev::Client.new(api_key: ENV.fetch("CONTEXT_DEV_API_KEY"))
page = client.web.scrape(
url: "https://stripe.com",
formats: {images: true},
)
pp page.images.data
package main
import (
"context"
"fmt"
"os"
contextdev "github.com/context-dot-dev/context-go-sdk/v2"
"github.com/context-dot-dev/context-go-sdk/v2/option"
)
func main() {
client := contextdev.NewClient(option.WithAPIKey(os.Getenv("CONTEXT_DEV_API_KEY")))
page, err := client.Web.Scrape(context.Background(), contextdev.WebScrapeParams{
URL: "https://stripe.com",
Formats: contextdev.WebScrapeParamsFormats{Images: contextdev.Bool(true)},
})
if err != nil {
panic(err)
}
for _, image := range page.Images.Data {
fmt.Println(image.URL, image.Alt)
}
}
<?php
require __DIR__.'/vendor/autoload.php';
use ContextDev\Client;
$client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY'));
$page = $client->web->scrape(
formats: ['images' => true],
url: 'https://stripe.com',
);
print_r($page->images->data);
images.data. Each entry has a url and an alt value, which is null when the page provides no alt text. The array is empty when the page has no images. See the image guide for dimensions, hosted copies, visual classification, and deduplication.Map a website’s URLs using Context.dev’s index. This example returns up to 50 customer-page URLs for Stripe and costs 1 credit.Read the list from
curl --get https://api.context.dev/v1/web/urls \
--header "Authorization: Bearer $CONTEXT_DEV_API_KEY" \
--data-urlencode "domain=stripe.com" \
--data-urlencode "maxLinks=50" \
--data-urlencode "urlRegex=/customers/"
import ContextDev from "context.dev";
const client = new ContextDev({ apiKey: process.env.CONTEXT_DEV_API_KEY });
const site = await client.web.mapUrls({
domain: "stripe.com",
maxLinks: 50,
urlRegex: "/customers/",
});
console.log(site.urls);
import os
from context.dev import ContextDev
client = ContextDev(api_key=os.environ["CONTEXT_DEV_API_KEY"])
site = client.web.map_urls(
domain="stripe.com",
max_links=50,
url_regex="/customers/",
)
print(site.urls)
require "cgi/core"
require "context_dev"
client = ContextDev::Client.new(api_key: ENV.fetch("CONTEXT_DEV_API_KEY"))
site = client.web.map_urls(
domain: "stripe.com",
max_links: 50,
url_regex: "/customers/",
)
pp site.urls
package main
import (
"context"
"fmt"
"os"
contextdev "github.com/context-dot-dev/context-go-sdk/v2"
"github.com/context-dot-dev/context-go-sdk/v2/option"
)
func main() {
client := contextdev.NewClient(option.WithAPIKey(os.Getenv("CONTEXT_DEV_API_KEY")))
site, err := client.Web.MapURLs(context.Background(), contextdev.WebMapURLsParams{
Domain: "stripe.com",
MaxLinks: contextdev.Int(50),
URLRegex: contextdev.String("/customers/"),
})
if err != nil {
panic(err)
}
for _, entry := range site.URLs {
fmt.Println(entry.URL, entry.Title)
}
}
<?php
require __DIR__.'/vendor/autoload.php';
use ContextDev\Client;
$client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY'));
$site = $client->web->mapUrls(
domain: 'stripe.com',
maxLinks: 50,
urlRegex: '/customers/',
);
print_r($site->urls);
urls. Each entry has a url, plus title, description, keywords, and language when the index has them. partial: true means the request hit its deadline before mapping finished. The Map URLs guide covers filters, limits, and choosing what to scrape next.Research a question on the live web and return structured JSON with source URLs. This example uses Fast mode, which costs 10 credits per successful answer.Read the answer from
curl https://api.context.dev/v1/web/answers \
--request POST \
--header "Authorization: Bearer $CONTEXT_DEV_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"mode": "fast",
"task": "Find the pricing page URL and plan names for context.dev.",
"json_format": {
"pricing_page_url": "",
"plans": [{ "name": "" }]
},
"timeoutOpts": { "milliseconds": 30000, "behavior": "return-partial" }
}'
import ContextDev from "context.dev";
const client = new ContextDev({ apiKey: process.env.CONTEXT_DEV_API_KEY });
const response = await client.web.answers({
mode: "fast",
task: "Find the pricing page URL and plan names for context.dev.",
json_format: {
pricing_page_url: "",
plans: [{ name: "" }],
},
timeoutOpts: { milliseconds: 30000, behavior: "return-partial" },
});
console.log(response.json_content, response.sources, response.partial ?? false);
import os
from context.dev import ContextDev
client = ContextDev(api_key=os.environ["CONTEXT_DEV_API_KEY"])
response = client.web.answers(
mode="fast",
task="Find the pricing page URL and plan names for context.dev.",
json_format={"pricing_page_url": "", "plans": [{"name": ""}]},
timeout_opts={"milliseconds": 30000, "behavior": "return-partial"},
)
print(response.json_content, response.sources, response.partial or False)
require "cgi/core"
require "context_dev"
client = ContextDev::Client.new(api_key: ENV.fetch("CONTEXT_DEV_API_KEY"))
response = client.web.answers(
mode: "fast",
task: "Find the pricing page URL and plan names for context.dev.",
json_format: {pricing_page_url: "", plans: [{name: ""}]},
timeout_opts: {milliseconds: 30000, behavior: "return-partial"}
)
pp response.json_content, response.sources, response.partial
package main
import (
"context"
"fmt"
"os"
contextdev "github.com/context-dot-dev/context-go-sdk/v2"
"github.com/context-dot-dev/context-go-sdk/v2/option"
)
func main() {
client := contextdev.NewClient(option.WithAPIKey(os.Getenv("CONTEXT_DEV_API_KEY")))
response, err := client.Web.Answers(context.Background(), contextdev.WebAnswersParams{
Mode: contextdev.WebAnswersParamsModeFast,
Task: "Find the pricing page URL and plan names for context.dev.",
JsonFormat: map[string]any{
"pricing_page_url": "",
"plans": []any{map[string]any{"name": ""}},
},
TimeoutOpts: contextdev.WebAnswersParamsTimeoutOpts{Milliseconds: 30000, Behavior: "return-partial"},
})
if err != nil {
panic(err)
}
fmt.Println(response.JsonContent, response.Sources, response.Partial)
}
<?php
require __DIR__.'/vendor/autoload.php';
use ContextDev\Client;
$client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY'));
$response = $client->web->answers(
task: 'Find the pricing page URL and plan names for context.dev.',
mode: 'fast',
jsonFormat: [
'pricing_page_url' => '',
'plans' => [['name' => '']],
],
timeoutOpts: ['milliseconds' => 30000, 'behavior' => 'return-partial'],
);
print_r($response->jsonContent);
print_r($response->sources);
var_dump($response->partial ?? false);
json_content and the contributing URLs from sources. partial: true means the answer uses the evidence collected before the deadline; unknown values can be null. The Answers guide covers output shapes, source verification, and Ultra mode, which is the default and costs 100 credits.Look up a company profile with logos, colors, descriptions, and social links. A successful lookup costs 10 credits.The matched company is in
curl https://api.context.dev/v1/brand/retrieve \
--request POST \
--header "Authorization: Bearer $CONTEXT_DEV_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"type": "by_domain",
"domain": "stripe.com"
}'
import ContextDev from "context.dev";
const client = new ContextDev({ apiKey: process.env.CONTEXT_DEV_API_KEY });
const response = await client.brand.retrieve({
type: "by_domain",
domain: "stripe.com",
});
console.log(response.brand?.title);
import os
from context.dev import ContextDev
client = ContextDev(api_key=os.environ["CONTEXT_DEV_API_KEY"])
response = client.brand.retrieve(
type="by_domain",
domain="stripe.com",
)
print(response.brand.title if response.brand else None)
require "cgi/core"
require "context_dev"
client = ContextDev::Client.new(api_key: ENV.fetch("CONTEXT_DEV_API_KEY"))
response = client.brand.retrieve(
body: {
"type" => "by_domain",
"domain" => "stripe.com",
}
)
puts response.brand&.title
package main
import (
"context"
"fmt"
"os"
contextdev "github.com/context-dot-dev/context-go-sdk/v2"
"github.com/context-dot-dev/context-go-sdk/v2/option"
)
func main() {
client := contextdev.NewClient(option.WithAPIKey(os.Getenv("CONTEXT_DEV_API_KEY")))
response, err := client.Brand.Get(context.Background(), contextdev.BrandGetParams{
OfByDomain: &contextdev.BrandGetParamsBodyByDomain{
Domain: "stripe.com",
},
})
if err != nil {
panic(err)
}
fmt.Println(response.Brand.Title)
}
<?php
require __DIR__.'/vendor/autoload.php';
$client = new ContextDev\Client(apiKey: getenv('CONTEXT_DEV_API_KEY'));
// Use the SDK's low-level request: its generated Brand helper cannot express this lookup.
$response = $client->request(
method: 'post',
path: 'brand/retrieve',
body: [
"type" => "by_domain",
"domain" => "stripe.com",
],
);
$data = json_decode((string) $response->getBody(), true, flags: JSON_THROW_ON_ERROR);
echo $data['brand']['title'] ?? 'No match', PHP_EOL;
brand. The PHP example uses the SDK’s low-level request method for this lookup. See the brand guide for lookup options and result fields.Extract observed colors, typography, available font files, and component styles. This request costs 10 credits.Inspect
curl --get https://api.context.dev/v1/web/styleguide \
--header "Authorization: Bearer $CONTEXT_DEV_API_KEY" \
--data-urlencode "domain=stripe.com" \
--data-urlencode "colorScheme=light"
import ContextDev from "context.dev";
const client = new ContextDev({
apiKey: process.env.CONTEXT_DEV_API_KEY,
});
const response = await client.web.extractStyleguide({
domain: "stripe.com",
colorScheme: "light",
});
console.log(response.styleguide?.colors);
console.log(response.styleguide?.typography.headings.h1);
import os
from context.dev import ContextDev
client = ContextDev(api_key=os.environ["CONTEXT_DEV_API_KEY"])
response = client.web.extract_styleguide(
domain="stripe.com",
color_scheme="light",
)
print(response.styleguide.colors)
print(response.styleguide.typography.headings.h1)
require "cgi/core"
require "context_dev"
client = ContextDev::Client.new(
api_key: ENV.fetch("CONTEXT_DEV_API_KEY")
)
response = client.web.extract_styleguide(
domain: "stripe.com",
color_scheme: :light
)
puts response.styleguide.colors.inspect
puts response.styleguide.typography.headings.h1.inspect
package main
import (
"context"
"fmt"
"os"
contextdev "github.com/context-dot-dev/context-go-sdk/v2"
"github.com/context-dot-dev/context-go-sdk/v2/option"
)
func main() {
client := contextdev.NewClient(
option.WithAPIKey(os.Getenv("CONTEXT_DEV_API_KEY")),
)
response, err := client.Web.ExtractStyleguide(
context.Background(),
contextdev.WebExtractStyleguideParams{
Domain: contextdev.String("stripe.com"),
ColorScheme: contextdev.WebExtractStyleguideParamsColorSchemeLight,
},
)
if err != nil {
panic(err)
}
fmt.Println(response.Styleguide.Colors)
fmt.Println(response.Styleguide.Typography.Headings.H1)
}
<?php
require __DIR__.'/vendor/autoload.php';
use ContextDev\Client;
$client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY'));
$response = $client->web->extractStyleguide(
domain: 'stripe.com',
colorScheme: 'light',
);
var_dump($response->styleguide->colors);
var_dump($response->styleguide->typography->headings->h1);
styleguide.colors and styleguide.typography. Available font files are included in styleguide.fontLinks, keyed by family and weight. These are observations of the rendered page, not an official design-system specification. See the styleguide guide for the full result.Submit two URLs for background scraping. Each successful page costs 1 credit.The response contains a job
curl https://api.context.dev/v1/batch/submit \
--request POST \
--header "Authorization: Bearer $CONTEXT_DEV_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"input": {
"mode": "scrape",
"data": {
"format": "markdown",
"urls": [
{
"url": "https://docs.context.dev/introduction"
},
{
"url": "https://docs.context.dev/quickstart"
}
]
}
}
}'
import ContextDev from "context.dev";
const client = new ContextDev({ apiKey: process.env.CONTEXT_DEV_API_KEY });
const response = await client.batch.submit({
input: {
mode: "scrape",
data: {
format: "markdown",
urls: [
{
url: "https://docs.context.dev/introduction",
},
{
url: "https://docs.context.dev/quickstart",
},
],
},
},
});
console.log(response.id);
import os
from context.dev import ContextDev
client = ContextDev(api_key=os.environ["CONTEXT_DEV_API_KEY"])
response = client.batch.submit(
input={
"mode": "scrape",
"data": {
"format": "markdown",
"urls": [
{
"url": "https://docs.context.dev/introduction",
},
{
"url": "https://docs.context.dev/quickstart",
},
],
},
},
)
print(response.id)
require "cgi/core"
require "context_dev"
client = ContextDev::Client.new(api_key: ENV.fetch("CONTEXT_DEV_API_KEY"))
response = client.batch.submit(
input: {
mode: "scrape",
data: {
format: "markdown",
urls: [
{
url: "https://docs.context.dev/introduction",
},
{
url: "https://docs.context.dev/quickstart",
},
],
},
},
)
puts response.id
package main
import (
"context"
"fmt"
"os"
contextdev "github.com/context-dot-dev/context-go-sdk/v2"
"github.com/context-dot-dev/context-go-sdk/v2/option"
)
func main() {
client := contextdev.NewClient(option.WithAPIKey(os.Getenv("CONTEXT_DEV_API_KEY")))
response, err := client.Batch.Submit(context.Background(), contextdev.BatchSubmitParams{
Input: contextdev.BatchSubmitParamsInputUnion{
OfScrape: &contextdev.BatchSubmitParamsInputScrape{
Mode: "scrape",
Data: contextdev.BatchSubmitParamsInputScrapeDataUnion{
OfMarkdown: &contextdev.BatchSubmitParamsInputScrapeDataMarkdown{
Format: "markdown",
URLs: []contextdev.BatchSubmitParamsInputScrapeDataMarkdownURL{
contextdev.BatchSubmitParamsInputScrapeDataMarkdownURL{
URL: "https://docs.context.dev/introduction",
},
contextdev.BatchSubmitParamsInputScrapeDataMarkdownURL{
URL: "https://docs.context.dev/quickstart",
},
},
},
},
},
},
})
if err != nil {
panic(err)
}
fmt.Println(response.ID)
}
<?php
require __DIR__.'/vendor/autoload.php';
use ContextDev\Client;
$client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY'));
$response = $client->batch->submit(
input: [
"mode" => "scrape",
"data" => [
"format" => "markdown",
"urls" => [
[
"url" => "https://docs.context.dev/introduction",
],
[
"url" => "https://docs.context.dev/quickstart",
],
],
],
],
);
echo $response->id, PHP_EOL;
id, not completed page content. Save it, then poll for completion and read the results.Check a pricing page for text changes every day. No webhook is required.Save
curl https://api.context.dev/v1/monitors \
--request POST \
--header "Authorization: Bearer $CONTEXT_DEV_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"name": "Pricing changes",
"target": {
"type": "page",
"url": "https://stripe.com/pricing",
"normalize_whitespace": true
},
"change_detection": {
"type": "exact"
},
"schedule": {
"type": "interval",
"frequency": 1,
"unit": "days"
}
}'
import ContextDev from "context.dev";
const client = new ContextDev({ apiKey: process.env.CONTEXT_DEV_API_KEY });
const response = await client.monitors.create({
name: "Pricing changes",
target: {
type: "page",
url: "https://stripe.com/pricing",
normalize_whitespace: true,
},
change_detection: {
type: "exact",
},
schedule: {
type: "interval",
frequency: 1,
unit: "days",
},
});
console.log(response.id, response.initial_run_id);
import os
from context.dev import ContextDev
client = ContextDev(api_key=os.environ["CONTEXT_DEV_API_KEY"])
response = client.monitors.create(
name="Pricing changes",
target={
"type": "page",
"url": "https://stripe.com/pricing",
"normalize_whitespace": True,
},
change_detection={
"type": "exact",
},
schedule={
"type": "interval",
"frequency": 1,
"unit": "days",
},
)
print(response.id, response.initial_run_id)
require "cgi/core"
require "context_dev"
client = ContextDev::Client.new(api_key: ENV.fetch("CONTEXT_DEV_API_KEY"))
response = client.monitors.create(
name: "Pricing changes",
target: {
type: "page",
url: "https://stripe.com/pricing",
normalize_whitespace: true,
},
change_detection: {
type: "exact",
},
schedule: {
type: "interval",
frequency: 1,
unit: "days",
},
)
puts response.id, response.initial_run_id
package main
import (
"context"
"fmt"
"os"
contextdev "github.com/context-dot-dev/context-go-sdk/v2"
"github.com/context-dot-dev/context-go-sdk/v2/option"
)
func main() {
client := contextdev.NewClient(option.WithAPIKey(os.Getenv("CONTEXT_DEV_API_KEY")))
response, err := client.Monitors.New(context.Background(), contextdev.MonitorNewParams{
Name: "Pricing changes",
Target: contextdev.MonitorNewParamsTargetUnion{
OfPage: &contextdev.MonitorNewParamsTargetPage{
Type: "page",
URL: "https://stripe.com/pricing",
NormalizeWhitespace: contextdev.Bool(true),
},
},
ChangeDetection: contextdev.MonitorNewParamsChangeDetectionUnion{
OfExact: &contextdev.MonitorNewParamsChangeDetectionExact{
Type: "exact",
},
},
Schedule: contextdev.MonitorNewParamsSchedule{
Type: "interval",
Frequency: 1,
Unit: "days",
},
})
if err != nil {
panic(err)
}
fmt.Println(response.ID, response.InitialRunID)
}
<?php
require __DIR__.'/vendor/autoload.php';
use ContextDev\Client;
$client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY'));
$response = $client->monitors->create(
name: "Pricing changes",
target: [
"type" => "page",
"url" => "https://stripe.com/pricing",
"normalizeWhitespace" => true,
],
changeDetection: [
"type" => "exact",
],
schedule: [
"type" => "interval",
"frequency" => 1,
"unit" => "days",
],
);
echo $response->id, " ", $response->initialRunID, PHP_EOL;
id and initial_run_id. The first run establishes a baseline. Use the monitoring guide to read later runs and changes.Explore the APIs
Web data APIs
Scrape
Fetch a page once and return Markdown, rendered HTML, a screenshot, page images, original bytes, and CSS-selected fields in any combination.
Map URLs
Map all URLs a website has using our index, with available titles, descriptions, keywords, and languages.
Crawl
Follow website links and return each page as Markdown.
Web search
Search the web and optionally scrape result pages in the same call.
Answers
Research the live web and return JSON with source URLs in Fast or Ultra mode.
YouTube transcripts
Get video metadata, a description, and a timestamped transcript as Markdown.
Document parsing
Convert uploaded PDFs, Office documents, images, and other supported files into Markdown.
Brand data APIs
Brand lookup
Retrieve company logos, colors, descriptions, social links, and industry tags where available.
Brand search
Find indexed brands by name or domain prefix for autocomplete.
Styleguide
Extract a website’s colors, typography, available font files, spacing, and component styles.
Logo Link
Embed a company logo directly using a separate public client ID.
Company and people data
People enrichment
Match identity clues to a person profile with a match score. Beta, paid plans.
Company news
Find current and historical company news by name, domain, ticker, or ISIN.
Automation and utilities
Batches
Process URL lists or website crawls asynchronously and retrieve the results.
Monitors
Track changes to pages, URL inventories, or structured data and receive signed webhooks.
Prefetch
Warm brand or styleguide caches before you need the data. Paid subscription required.
Before you ship
Context.dev is a hosted API, with SDKs for TypeScript, Python, Ruby, Go, and PHP. There is no self-hosted edition. Scraping can render JavaScript, but a login wall or bot challenge can still prevent access. Scrape outputs can come from a cache. Each output has its own cache entry, andmaxAgeMs defaults to one day (86400000 milliseconds). Set maxAgeMs to 0 when you need a fresh fetch. Custom headers, browser actions, and zero data retention bypass the cache. Other endpoints have their own freshness rules.
Each guide explains its costs, limits, and failure cases. Set timeouts and partial-result behavior, choose API-key permissions, and review your organization’s Free credits or refills.
API reference
Check the request parameters and response fields for each endpoint.
Production checklist
Plan retries, data handling, and deployment behavior.