Integrate Context.dev's Screenshot API in your app
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:- Give a specific URL: pass
directUrlwith the full URL (e.g.https://stripe.com/pricing). - Give a domain and a page type: pass
domain(e.g.stripe.com) for the homepage. Add apagetype (choose fromlogin,signup,blog,careers,pricing,terms,privacy, orcontact) to let Context.dev’s resolver find the right URL on the domain.
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
Response
Handle errors
The endpoint surfaces four failure modes:
A retry pattern that covers 500:
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.