Skip to main content
Context.dev’s Screenshot API finds and opens any page in a browser, captures a PNG screenshot, hosts it on a CDN, and sends back a URL to access it. It can dismiss cookie banners, capture the full scrollable height, and find standard pages (like pricing, login, etc.) for a given domain without you entering the exact path.

Integrate Context.dev's Screenshot API in your app

Open in Cursor

Prerequisites

  • A Context.dev API key. Sign up at context.dev/signup, copy the key from the dashboard (prefix ctxt_secret_), and export it:
  • An SDK (optional). Install for your language, or skip the install and call directly with curl:

Capture a screenshot

There are two ways to point at the page you want to capture:
  1. Give a specific URL: pass directUrl with the full URL (e.g. https://stripe.com/pricing).
  2. Give a domain and a page type: pass domain (e.g. stripe.com) for the homepage. Add a page type (choose from login, signup, blog, careers, pricing, terms, privacy, or contact) to let Context.dev’s resolver find the right URL on the domain.
5 credits per successful call Context.dev finds and opens the page, closes any cookie consent pop-ups (when handleCookiePopup is set to "true"), takes a screenshot, uploads it to a CDN and returns the public URL.
Captures are cached for one day by default; pass maxAgeMs: 0 to force a fresh render, or up to 30 days for longer reuse.

Request Parameters

Pass either domain or directUrl, not both.

Response

Handle errors

The endpoint surfaces four failure modes: A retry pattern that covers 500:
For the full error code catalog, see Troubleshooting.

Use cases

  • Auto-generate on-brand campaign and preview images for every page.
  • Give your coding agent screenshotting tools to do QA or classification tasks.
  • Archive dated visual snapshots of pages for compliance or audits.
  • Power server-side link-preview / share-card generation for chat apps, comments, and any paste-a-URL flow.

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.