Skip to main content
By the end of this guide you’ll have an API key, an installed SDK, and your first call to Context.dev’s Brand, Web, and Classification API endpoints.

Integrate Context.dev into my app

Open in Cursor

0. Pick the right API for your job

Context.dev has 4 products:
APIUse-case
Brand APIsLook up a brand by name, domain, email, stock ticker, or ISIN
Extract a website’s styleguide: fonts, spacing, shadows, etc.
Logo Link CDNGet embeddable logo images from a domain
Web APIsScrape any websiteinto clean HTML/Markdown
Crawl a whole siteand get clean Markdown for every page
Crawl a sitemapto discover all URLs of a domain
Extract every imageon a webpage
Capture a webpage screenshot
Extract product details(name, price, features) from a page
Extract structured datafrom a website’s pages with a JSON Schema
Classification APIsEnrich a card-transaction descriptorto a brand
Classify a brand into NAICS, SIC, or EIC industry codes

1. Get an API key

1

Sign up

Create an account at context.dev/signup.Context.dev signup page
2

Copy your key from the dashboard

Open the dashboard and copy the key from the “API Keys” section. It starts with ctxt_secret_.API Keys section in the Context.dev dashboard
3

Expose it as an environment variable

The SDKs and curl examples read CONTEXT_DEV_API_KEY from the environment. The SDKs read CONTEXT_DEV_API_KEY first and fall back to CONTEXT_API_KEY if it isn’t set, so exporting CONTEXT_DEV_API_KEY alone is enough:
terminal
export CONTEXT_DEV_API_KEY="ctxt_secret_..."
For local development, save the key to a .env file and make sure it’s listed in your .gitignore. For deployment, set the key in your platform’s environment variable store:
  • Vercel: vercel env add CONTEXT_DEV_API_KEY
  • Heroku: heroku config:set CONTEXT_DEV_API_KEY=ctxt_secret_...
  • Docker: pass via -e CONTEXT_DEV_API_KEY=ctxt_secret_... at docker run
  • AWS Lambda: store in Secrets Manager or Parameter Store; expose to the function via its environment config
Never call the Context.dev API directly from a browser. The key would be visible to anyone with devtools. Always proxy through your backend.

2. Install an SDK

Context.dev publishes official SDKs for TypeScript, Python, Ruby, and Go. Pick the one for your stack.
npm install context.dev
You can also call the API directly with curl. No install required.

3. Make your first call

All code snippets expect CONTEXT_DEV_API_KEY to be set. Depending on which API you chose:
Retrieving a brand requires a brand identifier (name, domain, email, stock ticker, or ISIN code) and gives you its logo, name, slogan, description, address, social media handles, and more.Read the full guide
curl -G https://api.context.dev/v1/brand/retrieve \
  -H "Authorization: Bearer $CONTEXT_DEV_API_KEY" \
  --data-urlencode "domain=airbnb.com"
10 credits per successful call

4. Understand the response

Brand and Classification endpoints return JSON with status, code, and a brand object. The Web Markdown endpoint returns success, url, and markdown.
Calling /brand/retrieve with domain=airbnb.com returns the brand record for Airbnb.
brand.retrieve response
{
  "status": "ok",
  "code": 200,
  "brand": {
    "domain": "airbnb.com",
    "title": "Airbnb",
    "description": "Airbnb is a global online community marketplace that connects hosts with guests...",
    "slogan": "Belong Anywhere",
    "colors": [
      { "hex": "#fc3c5c", "name": "Radical Red" },
      { "hex": "#fc9cb4", "name": "Saira Red" },
      { "hex": "#fb5c74", "name": "Ponceau" }
    ],
    "logos": [
      {
        "url": "https://media.brand.dev/4ae9a10b-ffde-45c8-b5c1-c1e7cef5b716.png",
        "mode": "light",
        "type": "icon",
        "colors": [{ "hex": "#fc3c5c", "name": "Radical Red" }],
        "resolution": { "width": 250, "height": 250, "aspect_ratio": 1 }
      }
    ],
    "backdrops": [
      {
        "url": "https://media.brand.dev/example-backdrop.png",
        "colors": [{ "hex": "#fc3c5c", "name": "Radical Red" }],
        "resolution": { "width": 1200, "height": 630, "aspect_ratio": 1.9 }
      }
    ],
    "address": {
      "street": "888 Brannan Street",
      "city": "San Francisco",
      "state_province": "California",
      "state_code": "CA",
      "country": "United States",
      "country_code": "US",
      "postal_code": "94103"
    },
    "socials": [
      { "type": "x",         "url": "https://x.com/airbnb" },
      { "type": "facebook",  "url": "https://facebook.com/airbnb" },
      { "type": "linkedin",  "url": "https://linkedin.com/company/airbnb" },
      { "type": "instagram", "url": "https://instagram.com/airbnb" }
    ],
    "stock": { "ticker": "ABNB", "exchange": "NASDAQ" },
    "phone": "+1-415-555-0100",
    "is_nsfw": false,
    "industries": {
      "eic": [
        { "industry": "Hospitality & Tourism", "subindustry": "Vacation Rentals & Short-Term Stays" },
        { "industry": "Technology",            "subindustry": "eCommerce & Marketplace Platforms" }
      ]
    },
    "links": { "blog": null, "careers": null, "privacy": null, "terms": null, "contact": null, "pricing": null },
    "primary_language": "english"
  }
}
FieldTypeDescription
brand.titlestringCompany name.
brand.domainstringCanonical domain.
brand.descriptionstringBrief description of the brand.
brand.sloganstringThe brand’s slogan.
brand.colors[]arrayBrand colors. Each has hex and name.
brand.logos[]arrayLogos associated with the brand. Each has url, mode (light, dark, has_opaque_background), type (icon, logo), colors[], and resolution.
brand.backdrops[]arrayBackdrop images for the brand. Each has url, colors[], and resolution.
brand.addressobjectstreet, city, state_province, state_code, country, country_code, postal_code.
brand.socials[]arraySocial profile URLs. Each has type (x, facebook, linkedin, instagram, …) and url.
brand.stockobjectticker and exchange. null for private companies.
brand.phonestringCompany phone number.
brand.is_nsfwbooleanIndicates whether the brand content is not safe for work (NSFW).
brand.industries.eic[]arrayEasy Industry Classification industry and subindustry pairs.
brand.linksobjectImportant website links (careers, privacy, terms, contact, blog, pricing); fields may be null when not found.
brand.primary_languagestringPrimary language of the brand’s website content, or null when not detected.

5. Handle errors

A non-2xx response returns an error envelope. The common ones:
StatusMeaningWhat to do
401API key missing, invalid, or deletedRe-check the env var and the dashboard.
408Cold-hit timeout (rare; first crawl exceeded the deadline)Retry once; the second hit is warm. Better: prefetch.
422Disposable or free-email address on retrieve-by-emailSkip the call for personal addresses.
429Rate limitWait per the Retry-After header; see Handle Rate Limits.
500Transient server errorRetry once with backoff; if it persists, contact support.
A retry pattern that covers 408 and 429:
import ContextDev from "context.dev";

const client = new ContextDev({ apiKey: process.env.CONTEXT_DEV_API_KEY });

async function retrieveWithRetry(domain: string, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      const { brand } = await client.brand.retrieve({ domain });
      return brand;
    } catch (err: any) {
      const retryable = err.status === 408 || err.status === 429;
      if (retryable && i < maxRetries - 1) {
        await new Promise((r) => setTimeout(r, 2 ** i * 1000));
        continue;
      }
      throw err;
    }
  }
  throw new Error("unreachable");
}
For the full catalog of error codes and remediations, see Troubleshooting.

Next steps

Prefetch for Faster Response

Hide cold-hit latency from your users.

Handle Rate Limits

Backoff strategies, client cache, and prefetch fallbacks.

Best Practices

Caching, error handling, and key hygiene.

Troubleshooting

Status codes, retry patterns, and common errors.