プロトタイプ · プレビュー版:公式レジストリのすべてのサーバーを掲載し、30分ごとに同期しています。Google でログインするとレビューを書けます。プロトタイプ · 30分ごとに更新
PopNx MCPAIを使う人のためのMCPサーバー · やさしい言葉で解説

API Screenshot

作者:matbronsバージョン 0.1.2i★ 0iパソコンでもクラウドでも公式サイト ↗
レジストリ名io.github.matbrons/api-screenshot

インストール方法

What it does

Clean full-page screenshots of real sites: cookie banners, pop-ups, chat widgets and ads removed.

  • Connects パソコンでもクラウドでも
  • Account or key Cloud: Needs Authorization · Local: Needs API_KEY
  • Category ウェブ・ブラウザ

一緒に使える

この種の作業を AI に教える Skill。これと一緒に使えます

timesfm

TimesFM (Time Series Foundation Model) is a pretrained time-series foundation model developed by Google Research for time-series forecasting.

作者:google-research★ 35,6291 個の skill

Skill · 手順書

Shadowbroker

Open-source intelligence for the global theater. Track everything from the corporate/private jets of the wealthy, and spy satellites, to seismic events in one unified interface. Hook an AI agent up to have it parse through data and find previously unseen correlations. The knowledge is available to…

作者:BigBodyCobain★ 11,6021 個の skill

Skill · 手順書

google-maps-scraper

scrape data from Google Maps. Extracts data such as the name, address, phone number, website URL, rating, reviews number, latitude and longitude, reviews,email and more for each place

作者:gosom★ 8,2091 個の skill

Skill · 手順書

この順位の理由

一覧は利用スコア(100 点満点)で並びます。内訳は次のとおり

人気0/80GitHub スターか週間ダウンロード数。大きい方を 60、小さい方を 20 で数えます
新しさ12/1230 日以内のリリースかコード更新で満点
応答中0/8前回の確認でクラウドのエンドポイントが応答
利用スコア12/100

品質: 基本チェック 3/3 項目に合格(表示のみ、並び順には不使用) · 勢い: データなし (「急上昇」タブでのみ使用)

インストール

使っているAIアプリを選んで、設定をコピーしてください。

ひとことで AI にインストールしてもらう

API Screenshot をインストールして。https://mcp.popnx.com/i/matbrons-api-screenshot.md に従い、コマンドを見せて、私が OK するまで実行しないで。

パソコンで作業できる AI(Claude Code や Cursor など)に貼り付けます。手順を読み、コマンドを見せて、あなたの OK を待ちます。キー不要・登録不要。 · AI が読む全文を見る

チェック 3/3 合格 · 質問内容は提供元のサーバー({host})を通ります · ✓ コマンド確認済み 2026年11月16日

まず:どの AI を使っていますか?

使っているアプリを選ぶと、下に手順が表示されます。

Claude につなげますが、先に準備が必要です

API Screenshot のキーが必要です(提供元のサイトで作成) · アドレスに {…} の部分があり、先に自分の値に書き換える必要があります · claude.ai かデスクトップアプリで一度設定すれば、チャットで使えます · 無料アカウントは 1 つまで · Team/Enterprise はオーナー(Owner)が追加

  1. API Screenshot に登録してキーを作る

    提供元のサイトで登録し、次の手順で使う API キーを作ります。料金や無料プランは提供元のサイトで確認してください。

    API Screenshot のサイトを開く ↗

  2. Claude の Connectors ページを開く

    CustomizeConnectors

    CustomizeConnectors1Add2https://…3Add4
  3. 「Add」→「Custom」→「Web」を押し、この 2 つを入力

    ここからコピーして Claude の同じ名前の欄に貼り付け、Continue を押します

    Name · 名前API Screenshot
    Remote MCP server URL · アドレスhttps://{host}/mcp

    Request headers に、この名前と値を追加

    ヘッダー名Authorization
    値Bearer <ここにキーを貼り付け>

    キーはアプリの入力欄にだけ貼り付け、チャットに貼ったり人に送ったりしないでください

    Claude が検出したサインイン設定の画面で Continue を押す · Authentication は作者の説明どおり(Sign in now・Sign in when needed・No sign in)を選び Add を押します

  4. チャットで有効にする

    +ConnectorsAPI Screenshot

  5. 試してみる

    API Screenshot を使って、私に何ができるか教えて、1 つやってみせて

    ✓ Claude が API Screenshot を使っていると言うか、回答に API Screenshot のツール名が出れば接続成功です

メニュー名は 2026年11月11日 に Anthropic のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります

ChatGPT はまだ API Screenshot につなげません

API Screenshot は接続時に自分のキーが必要ですが、OpenAI のヘルプページは OAuth ログインしか説明しておらず、確認できたキー入力方法がありません

代わりにできること

A · API Screenshot につなげるアプリを使う

  • API Screenshot のキーが必要です(提供元のサイトで作成) · アドレスに {…} の部分があり、先に自分の値に書き換える必要があります · claude.ai かデスクトップアプリで一度設定すれば、チャットで使えます · 無料アカウントは 1 つまで · Team/Enterprise はオーナー(Owner)が追加
  • API Screenshot のキーが必要です(提供元のサイトで作成) · アドレスに {…} の部分があり、先に自分の値に書き換える必要があります
  • API Screenshot のキーが必要です(提供元のサイトで作成) · アドレスに {…} の部分があり、先に自分の値に書き換える必要があります
  • API Screenshot のキーが必要です(提供元のサイトで作成) · アドレスに {…} の部分があり、先に自分の値に書き換える必要があります

B · ウェブ・ブラウザ の中で ChatGPT につなげる別のサーバー

同じカテゴリでよく使われているものから、キーなしでアドレスだけでつなげるものを選びました

Claude Code につなげますが、先に準備が必要です

API Screenshot のキーが必要です(提供元のサイトで作成) · アドレスに {…} の部分があり、先に自分の値に書き換える必要があります

  1. API Screenshot に登録してキーを作る

    提供元のサイトで登録し、次の手順で使う API キーを作ります。料金や無料プランは提供元のサイトで確認してください。

    API Screenshot のサイトを開く ↗

  2. ターミナルを開く

    Mac:Command+スペースで Terminal と入力 · Windows:PowerShell を開く

  3. このコマンドを貼り付けて Enter

    claude mcp add --transport http --scope user api-screenshot 'https://{host}/mcp' --header 'Authorization: Bearer {api_key}'

    Enter の前に「your-value」を自分のキーに書き換えてください

    キーはアプリの入力欄にだけ貼り付け、チャットに貼ったり人に送ったりしないでください

  4. Claude Code で /mcp と入力

    API Screenshot が一覧にあり、接続済みと表示されれば OK です

  5. 試してみる

    API Screenshot を使って、私に何ができるか教えて、1 つやってみせて

    ✓ Claude Code が API Screenshot を使っていると言うか、回答に API Screenshot のツール名が出れば接続成功です

メニュー名は 2026年11月11日 に Anthropic のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります

Cursor につなげますが、先に準備が必要です

API Screenshot のキーが必要です(提供元のサイトで作成) · アドレスに {…} の部分があり、先に自分の値に書き換える必要があります

  1. API Screenshot に登録してキーを作る

    提供元のサイトで登録し、次の手順で使う API キーを作ります。料金や無料プランは提供元のサイトで確認してください。

    API Screenshot のサイトを開く ↗

  2. Cursor の MCP 設定ファイルを開く

    ~/.cursor/mcp.json

    この設定を貼り付け、空いている値を入力して保存

    {
      "mcpServers": {
        "api-screenshot": {
          "url": "https://{host}/mcp",
          "headers": {
            "Authorization": "Bearer {api_key}"
          }
        }
      }
    }
  3. キーを入力

    API Screenshot の設定で Authorization が空です。自分のキーを入れて保存します

    キーはアプリの入力欄にだけ貼り付け、チャットに貼ったり人に送ったりしないでください

  4. Cursor の AI チャットを Agent モードで開く

  5. 試してみる

    API Screenshot を使って、私に何ができるか教えて、1 つやってみせて

    ✓ Cursor が API Screenshot を使っていると言うか、回答に API Screenshot のツール名が出れば接続成功です

メニュー名は 2026年11月11日 に Cursor のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります

VS Code につなげますが、先に準備が必要です

API Screenshot のキーが必要です(提供元のサイトで作成) · アドレスに {…} の部分があり、先に自分の値に書き換える必要があります

  1. API Screenshot に登録してキーを作る

    提供元のサイトで登録し、次の手順で使う API キーを作ります。料金や無料プランは提供元のサイトで確認してください。

    API Screenshot のサイトを開く ↗

  2. VS Code の MCP 設定ファイルを開く

    MCP: Open User Configuration

    この設定を貼り付け、空いている値を入力して保存

    {
      "servers": {
        "api-screenshot": {
          "type": "http",
          "url": "https://{host}/mcp",
          "headers": {
            "Authorization": "Bearer {api_key}"
          }
        }
      }
    }
  3. キーを入力

    API Screenshot の設定で Authorization が空です。自分のキーを入れて保存します

    キーはアプリの入力欄にだけ貼り付け、チャットに貼ったり人に送ったりしないでください

  4. VS Code の AI チャットを Agent モードで開く

  5. 試してみる

    API Screenshot を使って、私に何ができるか教えて、1 つやってみせて

    ✓ VS Code が API Screenshot を使っていると言うか、回答に API Screenshot のツール名が出れば接続成功です

メニュー名は 2026年11月11日 に VS Code のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります

Windsurf、Zed、Gemini CLI など MCP を使える他のアプリは追加方法がそれぞれ違います。アプリ一覧で確認してください

MCP を使えるアプリをすべて見る →

Web 経由でつなぐアプリ用のアドレス

アドレスhttps://{host}/mcp

JSON 設定は下の「開発者向け」にあります

つまずいたら?API Screenshot を使っている人に聞いてみましょう💬 ディスカッション →
開発者向け:ターミナルのコマンドと JSON 設定

Web 経由

Claude Code

claude mcp add --transport http --scope user api-screenshot 'https://{host}/mcp' --header 'Authorization: Bearer {api_key}'

Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "api-screenshot": {
      "url": "https://{host}/mcp",
      "headers": {
        "Authorization": "Bearer {api_key}"
      }
    }
  }
}

VS Code (mcp.json)

{
  "servers": {
    "api-screenshot": {
      "type": "http",
      "url": "https://{host}/mcp",
      "headers": {
        "Authorization": "Bearer {api_key}"
      }
    }
  }
}

パソコンにインストール

Claude Code

claude mcp add --scope user api-screenshot --env API_KEY=your-value -- docker run -i --rm -e API_KEY ghcr.io/matbrons/api-screenshot:0.1.2

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "api-screenshot": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "API_KEY",
        "ghcr.io/matbrons/api-screenshot:0.1.2"
      ],
      "env": {
        "API_KEY": "your-value"
      }
    }
  }
}

Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "api-screenshot": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "API_KEY",
        "ghcr.io/matbrons/api-screenshot:0.1.2"
      ],
      "env": {
        "API_KEY": "your-value"
      }
    }
  }
}

VS Code (mcp.json)

{
  "servers": {
    "api-screenshot": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "API_KEY",
        "ghcr.io/matbrons/api-screenshot:0.1.2"
      ],
      "env": {
        "API_KEY": "your-value"
      }
    }
  }
}

自分で入力する値

  • API_KEY 秘密 必須 env
    すべてのリクエストに含める必要があるキー(16 文字以上)。作成方法: openssl rand -hex 32
    英語の原文を見るKey every request must carry, 16 characters or more. Make one with: openssl rand -hex 32
  • PORT env
    API が待ち受けるポート
    英語の原文を見るPort the API listens on
  • Authorization 秘密 必須 HTTP header

説明は自動翻訳です。変数名は原文のままです。迷ったら原文を確認してください。

この設定は、作者のレジストリ登録情報から作成しています。READMEと違う場合は、READMEに従ってください。

ひと目でわかる

週あたりのダウンロードi
npm/PyPIにない
接続方法
パソコンでもクラウドでも
トランスポート
streamable-http
最新バージョンi
0.1.2
レジストリ公開日i
2026年11月16日
コードの最終更新i
2026年11月16日
最終確認
2026年11月16日
作者
matbrons
パッケージ
oci: ghcr.io/matbrons/api-screenshot:0.1.2
ウェブサイト
apiscreenshot.com
レジストリでの状態
有効

使えるアプリ

このサーバーのつなぎ方と、各アプリの公式ドキュメントに基づきます。2026年11月10日に確認。

インターネット経由でつなげるアプリ

ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatOpen WebUIRaycast

パソコン上で動かせるアプリ

ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast

すべてのアプリと長所・短所 →

できること

アドレスにあなた自身の値が必要なため、代わりにツール一覧を読み取ることはできません。

基本チェックi

誰でも見られる情報をチェックしており、コードは読んでいません。当てはまらない項目は数に入れていません。 · 2026年11月19日にチェック

  • ✓ 合格

    作者とリポジトリが一致

    レジストリ名は、リポジトリを所有するGitHubアカウント matbrons で確認済みです

  • ✓ 合格

    今もメンテナンスされている

    コードの最終更新:3 日前

  • ✓ 合格

    ライセンスがある

    MITを使用

  • – 対象外

    エンドポイントが応答する

    アドレスにあなた自身のアカウント情報が必要なため、代わりにチェックできません

  • – 対象外

    OAuthでサインイン

    アドレスにあなた自身のアカウント情報が必要なため、代わりにチェックできません

  • … 未チェック

    ツールの説明に隠れた指示がない

    まだチェックしていません。エンドポイントをチェックするときにツール一覧を読み取ります

公開済みの脆弱性(OSV.dev)

未確認:バージョン付きの npm と PyPI パッケージのみ確認できます

確認していること → · JSON

作者の方へ:再確認の依頼・情報の誤りの報告
作者向け:README にバッジを付ける

作者の方は、このコードを README に貼れます。バッジはこのページにリンクします。

[![Featured on PopNx MCP](https://mcp.popnx.com/badge/matbrons-api-screenshot.svg)](https://mcp.popnx.com/en/servers/matbrons-api-screenshot)

話し合い

質問、コツの共有、使えないことの報告ができます。「役に立った」の多い順です。

まだ投稿はありません。最初の質問や共有をどうぞ。

ここの投稿は利用者によるもので、PopNx チームのものではありません。

ログインして投稿

ユーザーレビュー

まだレビューはありません

ログインしてレビューを書く

ウェブ・ブラウザのほかのサーバーとの比較i

  • このカテゴリのほかの1613件のうち0%よりスターが多い
  • このカテゴリのほかの1613件のうち88%より最近レジストリに公開
  • 基本チェックの結果が、このカテゴリのほかの1613件のうち99%と同じかそれ以上

レジストリでこのカテゴリにある有効なすべてのサーバーと比較しています。スターは、公開者がリポジトリの所有者である場合だけ数えます。

よくある質問

API Screenshotは安全ですか?

当てはまる基本チェック3項目のうち3項目に合格しました。コードは読んでいません。キーやトークンを追加する前に、サーバーがどんなアクセスを求めているかを確認し、必要な権限だけを持つキーを使ってください。

どんなキーやコードが必要ですか?

入力が必要なもの:Authorization, API_KEY

パソコンで動きますか、それともクラウドですか?

どちらでも使えます。パソコンにインストールしても、クラウド版につないでもかまいません。

今もメンテナンスされていますか?

GitHubリポジトリの最終更新は3 日前、最新バージョン(0.1.2)がレジストリに届いたのは3 日前です。

どのアプリで使えますか?

Claude Desktop、Claude Code、Cursor、VS CodeなどのMCP対応アプリで使えます。URL で接続するので、リモート MCP を受け付けるアプリでも使えます。例:Web 版 ChatGPT(Business 以上はフル MCP、Pro は読み取りのみ)。

代わりに使えるものは?

同じカテゴリには:Browser Use, changedetection.io (official), Apify MCP Server, Pomerado, Actionbook

似た働きのほかの候補

同じカテゴリでほかの作者のもの。コマンドは確認済み。公式を先に、次にスター順。

カードの見方:↓ 週あたりのダウンロードi★ GitHubスターi3つの柱:レビュー · チェック · 利用状況i更新=最新バージョンをレジストリに公開した日i

Browser Use

Browser agents and stealth cloud browsers for AI: run web tasks, fill forms, extract data.

作者:browser-use広く使われている↓ 167.3万/週★ 12.1万29 日前更新

パソコンでもクラウドでも✓ 提供元 · browser-use.com

Apify MCP Server

Extract data from any website with thousands of scrapers, crawlers, and automations on Apify Store ⚡

作者:apify広く使われている★ 1.7万一昨日更新

クラウドで動く✓ 提供元 · apify.com

Pomerado

Connect your agents to any website. The cheaper, faster and more reliable alternative to browser use

作者:Pomerado成長中★ 1798昨日更新

クラウドで動く✓ 提供元 · pomerado.ai

Actionbook

Let your AI agent operate any website through a real, logged-in browser session.

作者:actionbook成長中★ 163131 日前更新

クラウドで動く✓ 提供元 · actionbook.app
似たものと比べる
これ
API Screenshot
Browser Usechangedetection.io (official)Apify MCP ServerPomeradoActionbook
動く場所クラウドでもパソコンにインストールでも使えるクラウドでもパソコンにインストールでも使えるクラウドで動き、インストール不要クラウドで動き、インストール不要クラウドで動き、インストール不要クラウドで動き、インストール不要
キーが必要はいはいいいえはいいいえいいえ
Claude で + から追加いいえはいいいえいいえいいえいいえ
基本チェック3/35/53/34/44/44/4
ライセンスMITMITApache-2.0MITMITApache-2.0
料金登録情報に費用の記載なし登録情報に費用の記載なし登録情報に費用の記載なし登録情報に費用の記載なし登録情報に費用の記載なし登録情報に費用の記載なし

作者のREADME

READMEを開く

作者のリポジトリから書かれたとおりにコピーしたものです。PopNx MCPは内容を確認・推奨していません。HTML、画像、スクリプトは取り除いています。リンクはこのサイトの外へ移動します。

api-screenshot

A screenshot API you run yourself. It takes full-page shots of real sites with the cookie banners, pop-ups, chat widgets and ads removed. It runs on your own Cloudflare account or on any server with Docker.

Examples and docs: apiscreenshot.com. Measured: how many shots Cloudflare's free plan gives and what a server needs to run it.

curl -H "Authorization: Bearer $API_KEY" \

"https://api-screenshot.your-subdomain.workers.dev/screenshot?url=https://www.theguardian.com&full_page=true" -o shot.png

  • Cookie banners, pop-ups, chat widgets and ads removed by default.
  • A captcha, bot check or error page comes back as an error that says so, never as a picture of it.
  • Safe to put on the internet: its own API key, a guard against requests to private addresses, and limits.
  • One API, on your Cloudflare account or on any server with Docker.

Contents: Run it (Cloudflare, your own server, safe by default) · Use it (JSON, signed URLs, caching, options, errors) · Use it from an AI agent · Settings · Ads, trackers and filter lists · Sites that block bots (retries) · Safety · Limits · Develop

Run it

On Cloudflare

The button asks you to sign in to Cloudflare and connect GitHub, then copies this repo to your GitHub account and deploys it to your Cloudflare account. It asks for one secret, API_KEY: paste a long random string, for example from openssl rand -hex 32, and keep it. Your API is then at https://api-screenshot. .workers.dev.

Or from a clone:

git clone https://github.com/matbrons/api-screenshot && cd api-screenshot

npm install npx wrangler login npx wrangler deploy API_KEY=$(openssl rand -hex 32); echo "Your API key: $API_KEY" echo "$API_KEY" | npx wrangler secret put API_KEY

On a new account, the first deploy asks you to pick your workers.dev subdomain. It also creates the KV namespace for the cache and writes its id into wrangler.jsonc, so that file shows as changed afterwards; keep the change. To check it all works (this takes one real shot):

APISHOT_TEST_URL=https://api-screenshot.<your-subdomain>.workers.dev APISHOT_TEST_KEY=$API_KEY ops/watch.sh

It uses Browser Rendering, which the free Workers plan includes with a daily limit (see Limits).

On your own server
API_KEY=$(openssl rand -hex 32); echo "Your API key: $API_KEY"

docker run -d --restart unless-stopped -p 3000:3000 -e API_KEY="$API_KEY" ghcr.io/matbrons/api-screenshot

The image runs on amd64 and arm64. It is published when a version is tagged, so it appears after the first release. To build it yourself instead: docker build -t api-screenshot .

Or without Docker, with Node 22.19 or newer and Chrome or Chromium installed:

npm install

API_KEY=$(openssl rand -hex 32); echo "Your API key: $API_KEY" API_KEY="$API_KEY" HOST=127.0.0.1 npm start

It finds Chrome or Chromium on its own; set CHROME_PATH if it doesn't. HOST=127.0.0.1 keeps it to your own machine; leave it out on a server, where it listens on every address.

The server path uses a real Chromium. Whether it gets past more bot walls than the Worker depends mostly on your server's IP address: see Sites that block bots.

Safe by default

A screenshot API on a public URL lets anyone spend your browser time. So until API_KEY (or SIGNING_SECRET, for signed URLs) is set, every screenshot request is refused with not_configured, and so is a key shorter than 16 characters or one copied from an example. If you really want it open, for example on a private network, set ALLOW_PUBLIC_ACCESS=true.

Use it

# GET with query options

curl -H "Authorization: Bearer $API_KEY" \ "http://localhost:3000/screenshot?url=https://example.com&full_page=true&format=jpeg" -o shot.jpg

POST with a JSON body

curl -X POST http://localhost:3000/screenshot \ -H "Authorization: Bearer $API_KEY" -H "content-type: application/json" \ -d '{"url": "https://example.com", "viewport_width": 390, "viewport_mobile": true}' -o shot.png

The key can also go in an X-API-Key header. It is never taken from the URL, where it would end up in logs and browser history: a request with access_key in the query is refused. To put a shot in an tag or a link, use a signed URL.

A shot comes back as the image (or PDF) itself, with these headers:

HeaderValue
x-final-urlThe URL after redirects
x-target-statusThe HTTP status the site answered with
x-removed-elementsHow many things were removed from the shot: the cookie banner, whether it was answered or hidden, plus each pop-up, backdrop, chat widget or ad that was showing. A banner and its own parts count as one. 0 when there was nothing to remove.
x-consent-managerThe consent tool behind the cookie banner that was removed (see below). Not sent when no banner was removed.
x-page-heightThe page's full height in CSS pixels
x-truncatedtrue when the shot was cut off: the page (or the selector element) was taller than full_page_max_height, or than 16384 device pixels (see Limits)
x-cacheHIT when the shot came from the cache, MISS when it was taken now and kept, BYPASS when the cache wasn't read (fresh, or caching off). See Caching.
ageOn a HIT: seconds since the shot was taken
x-overlay-remainingcookie_banner or popup when one is still on screen in the shot, after every attempt to remove it. Not sent when the shot is clean.

x-consent-manager is one of:

  • The tool's name, for the common ones: OneTrust, Cookiebot, Didomi, Usercentrics, Sourcepoint, TrustArc, Quantcast, consentmanager, CookieYes, Complianz, iubenda, Osano, Shopify and others.
  • For a site with a banner of its own, the name of autoconsent's rule for it, usually the site (airbnb).
  • generic: a banner recognised by its look and words, not by a known tool.

Before the shot, a last check looks for a cookie banner or pop-up that is still covering part of the screen. If it finds one, it presses Escape, then the banner's reject or close button (never accept), and cleans up again. One that survives all that is left in the shot and named in x-overlay-remaining, so you can retry or flag it. A site's own sticky header or menu doesn't count, even when it has a "Sign up" link.

JSON and page details

With response_type=json the answer is JSON instead of the file: the page's details plus the image or PDF in base64. response_type=metadata gives the details alone and skips the shot, which is quicker.

{

"url": "https://example.com/", "final_url": "https://example.com/", "status": 200, "title": "Example Domain", "description": null, "icon": "https://example.com/favicon.ico", "open_graph": { "title": "...", "image": "https://..." }, "page_height": 800, "removed_elements": 0, "consent_manager": null, "overlay_remaining": null, "truncated": false, "content_type": "image/png", "size": 18734, "image": "iVBORw0KGgo..." }

open_graph holds the page's og: tags without the prefix. icon is the page's own icon link, or /favicon.ico when it has none (which may not exist).

Signed URLs

To put a shot straight into an or og:image tag without giving away your key, sign the URL instead. Set a second secret, SIGNING_SECRET (16 characters or more, for example from openssl rand -hex 32; on Cloudflare echo "$SIGNING_SECRET" | npx wrangler secret put SIGNING_SECRET, or add it under the Worker's settings), then add a signature to each URL:

  1. Take every parameter, including expires if you want the link to stop working at some point (a Unix time in seconds).
  2. Sort them by name, percent-encode names and values (everything except A-Z a-z 0-9 - _ . ~) and join them as name=value&name=value.
  3. signature is the HMAC-SHA256 of that string with SIGNING_SECRET, in hex.

Anyone can read a signed URL, but changing, adding or removing any parameter breaks it. A wrong signature gets unauthorized with reason: signature_invalid, an expired one reason: signature_expired. Only GET requests can be signed. Make signed URLs on your server, never in the browser, so the secret stays with you.

In Node.js:

import { createHmac } from 'node:crypto';

const encode = (s) => encodeURIComponent(s).replace(/[!'()*]/g, (c) => %${c.charCodeAt(0).toString(16).toUpperCase()});

function signedUrl(base, options, secret) { const query = Object.keys(options).sort() .map((name) => ${encode(name)}=${encode(String(options[name]))}) .join('&'); const signature = createHmac('sha256', secret).update(query).digest('hex'); return ${base}/screenshot?${query}&signature=${signature}; }

signedUrl('https://api-screenshot.your-subdomain.workers.dev', { url: 'https://example.com', full_page: true, expires: Math.floor(Date.now() / 1000) + 7 * 24 * 3600, // optional: valid for a week }, process.env.SIGNING_SECRET);

In a shell, with the query already sorted and encoded:

QUERY='full_page=true&url=https%3A%2F%2Fexample.com'

SIG=$(printf '%s' "$QUERY" | openssl dgst -sha256 -hmac "$SIGNING_SECRET" -r | cut -d' ' -f1) echo "https://api-screenshot.your-subdomain.workers.dev/screenshot?$QUERY&signature=$SIG"

With only SIGNING_SECRET set and no API_KEY, the API takes signed URLs and nothing else.

Caching

A finished shot is kept for a day, so the same request again comes back at once and costs no browser time. Requests count as the same when their options are, after defaults are filled in: url=example.com and url=https://example.com/ share one shot. Only real shots are kept. A blocked, blank or any other error is never cached, so the next request tries again.

The cache is checked after the key or signature, so a cached shot never goes to someone who couldn't have asked for it. The x-cache header says whether a shot came from the cache. cache-control tells browsers how long they may keep it too: private for requests with the key, public for signed URLs (never past their expires), so a CDN in front can serve them.

On Cloudflare, shots are kept in Workers KV; the deploy creates the namespace for you. On a server they are kept in a folder, CACHE_DIR, up to CACHE_MAX_MB, and the shots used longest ago make room for new ones. In Docker that folder is /var/cache/api-screenshot; add -v api-screenshot-cache:/var/cache/api-screenshot to docker run to keep the shots when the container is replaced.

Options

Option names match the ones common to hosted screenshot APIs, so most requests written for one of those work here unchanged. An unknown option is refused, so a typo doesn't fail silently.

OptionDefaultWhat it does
urlrequiredThe page to shoot. https:// is added when missing.

| html | | Markup to

冒頭だけを表示しています。続きはリポジトリで読めます