Auto-generate screenshots in Contentful
Enrich your content model with automatically captured website screenshots
Connect Allscreenshots to Contentful to automatically generate and store website screenshots as media assets. When editors add a URL to a content entry, a screenshot is captured and linked automatically — keeping your visual content always current.
- 1
Add a URL field
Add a short text or URL field to your Contentful content type.
- 2
Set up a webhook
Configure a Contentful webhook that fires when entries are published.
- 3
Capture and upload
Your handler captures the screenshot and uploads it as a Contentful asset.
- 4
Link the asset
Update the content entry to reference the new screenshot asset.
1import contentful from 'contentful-management';
2
3const client = contentful.createClient({
4 accessToken: process.env.CONTENTFUL_MGMT_TOKEN,
5});
6
7export async function POST(request) {
8 const { fields, sys } = await request.json();
9 const url = fields.websiteUrl?.['en-US'];
10 if (!url) return Response.json({ skipped: true });
11
12 // Capture screenshot
13 const response = await fetch(
14 'https://api.allscreenshots.com/v1/screenshots',
15 {
16 method: 'POST',
17 headers: {
18 'X-API-Key': process.env.SCREENSHOT_API_KEY,
19 'Content-Type': 'application/json',
20 },
21 body: JSON.stringify({ url, fullPage: false }),
22 }
23 );
24 const { storageUrl } = await response.json();
25
26 // Create asset in Contentful
27 const space = await client.getSpace(process.env.CONTENTFUL_SPACE_ID);
28 const env = await space.getEnvironment('master');
29
30 const asset = await env.createAsset({
31 fields: {
32 title: { 'en-US': `Screenshot: ${url}` },
33 file: {
34 'en-US': {
35 contentType: 'image/png',
36 fileName: `screenshot-${sys.id}.png`,
37 upload: storageUrl,
38 },
39 },
40 },
41 });
42
43 await asset.processForAllLocales();
44 return Response.json({ assetId: asset.sys.id });
45}Automated asset creation
Screenshots are created as Contentful assets automatically — no manual upload needed.
Content model integration
Screenshot assets link directly to your content entries for a clean data model.
Editor-friendly
Editors just enter a URL. The screenshot appears as a linked asset without any technical knowledge.
How do I set up Contentful webhooks?
Go to Settings > Webhooks in your Contentful space and add a webhook URL. Set it to trigger on Entry publish events.
Can I update screenshots when content changes?
Yes. Configure the webhook to fire on entry updates. Your handler can check if the URL changed and recapture the screenshot.
Does this work with Contentful's free plan?
Yes. Webhooks and the management API are available on all Contentful plans, including the free community tier.
- Full-page captures
- Popups and repeated sticky bars removed
- Markdown, JSON and PDF output
- Crawl a site from one URL
- Desktop, tablet and phone in one image
- Works in n8n, Make and Zapier
- MCP server for AI assistants