API Docs

Base URL: https://dgen.uk/snapmeta/api/v1 · Auth: Authorization: Bearer <your key>

Your first API call

  1. Create an account, open the newest verification email and confirm it. Pending accounts cannot use the API.
  2. Save the key shown once after verification in your password manager. A browser login is not an API Bearer key. If you lose a key, sign in to the dashboard to create a replacement and revoke the lost key.
  3. Save the Python 3 example below as first_call.py and run python first_call.py in a terminal. Paste your key at the hidden prompt. It reads usage, fetches metadata, then reads usage again; no extra packages are needed.
import getpass
import json
from urllib.error import HTTPError
from urllib.parse import urlencode
from urllib.request import Request, urlopen

base_url = "https://dgen.uk/snapmeta"
api_key = getpass.getpass("Snapmeta API key: ").strip()
paths = ["usage", "metadata?" + urlencode({"url": "https://example.com"}), "usage"]
try:
    for path in paths:
        request = Request(base_url + "/api/v1/" + path,
                          headers={"Authorization": "Bearer " + api_key})
        with urlopen(request, timeout=30) as response:
            print(json.dumps(json.load(response)))
except HTTPError as error:
    print("HTTP", error.code, error.read().decode())
    raise SystemExit(1)

Expect three JSON lines: your plan and UTC month, metadata for Example Domain, then usage with one more metadata unit. Reading usage costs no units; even a cached metadata response uses one. Screenshots, PDFs and markdown require a paid plan and share its render allowance. Download an artifactUrl with your Bearer key within 24 hours.

Keep keys out of source code, shared screenshots, shell history and support messages. The example does not retry: each admitted retry can use another unit. For recovery, use the error guide or Support.

Agent authentication

Use your existing API key, or follow auth.md to grant an agent limited access. Sign in with a verified account, enter the code shown by your agent, review its resource and scopes, then approve. Grants expire after one hour; tokens last at most 15 minutes. Revoke any time from Agent access.

OAuth scopes are metadata:read, render:execute, usage:read and artifacts:read. Use resource https://dgen.uk/snapmeta/ for REST or https://dgen.uk/snapmeta/mcp for MCP. The same account, plan, quota and artifact-ownership checks apply. Registered OAuth clients may also use authorization code with S256 PKCE.

Interactive API explorer

Try the public endpoints below, rendered from the live OpenAPI schema.

Monthly usage

Every account has one metadata allowance and one shared render allowance for screenshots, PDFs and markdown. All API keys and MCP tools use those same allowances. Months start at 00:00 UTC on the first day; a request belongs to the month in which it is admitted, even if it finishes later.

One unit is reserved when a request is admitted, including cache hits. Successful requests, blocked URLs, fetch/render failures, cancellations and interrupted requests count. Invalid parameters or authentication, unavailable paid features, rate limits, a full render queue and disabled rendering do not count. In-flight reservations are included in usage. Requests with an unknown outcome stay charged; retrying is a new request. A quota rejection uses HTTP 402 (an MCP tool error for MCP calls).

Endpoints

GET /metadata all plans

curl "https://dgen.uk/snapmeta/api/v1/metadata?url=https://example.com" \
  -H "Authorization: Bearer sk_live_..."

Params: url (required), refresh=true (bypass 24h cache, paid plans). Returns title, description, image, favicon, siteName, type, language, canonical, jsonLd, statusCode.

GET /screenshot

curl "https://dgen.uk/snapmeta/api/v1/screenshot?url=https://example.com&width=1280&height=720&full_page=true&format=png" \
  -H "Authorization: Bearer sk_live_..."

Params: width 320 to 1920, height 240 to 1080, full_page, format png|webp. Returns artifactUrl (valid 24h); download it with the same Bearer key.

GET /pdf

curl "https://dgen.uk/snapmeta/api/v1/pdf?url=https://example.com&format=A4&landscape=false" \
  -H "Authorization: Bearer sk_live_..."

GET /markdown

curl "https://dgen.uk/snapmeta/api/v1/markdown?url=https://example.com" \
  -H "Authorization: Bearer sk_live_..."

Main-content extraction as clean markdown, ideal as LLM context.

GET /usage all plans

curl "https://dgen.uk/snapmeta/api/v1/usage" -H "Authorization: Bearer sk_live_..."

MCP (AI agents)

JSON-RPC endpoint: POST https://dgen.uk/snapmeta/mcp with the same Bearer key. Tools: get_metadata, get_screenshot, get_pdf, get_markdown. Add to Claude Desktop or Cursor:

{
  "mcpServers": {
    "snapmeta": {
      "url": "https://dgen.uk/snapmeta/mcp",
      "headers": { "Authorization": "Bearer sk_live_..." }
    }
  }
}

Errors and recovery

Check the HTTP status and response body before retrying. Application errors normally include status and detail; parameter-validation errors use a detail list. A proxy may return another format. MCP tool failures can arrive in an HTTP 200 JSON-RPC response: inspect the tool result's isError and message.

StatusMeaning and next step
401Key missing, invalid or revoked, or account unverified/inactive. Send Authorization: Bearer <key>, complete email verification and check the dashboard. Replace a lost key and revoke it; contact support for a restricted account. Do not keep retrying the same credentials.
402Allowance exhausted or a paid feature requested on Free (including refresh=true). Check /usage, remove refresh for a free metadata call, or use a paid plan. Monthly allowances reset at 00:00 UTC on the first day; changing keys does not reset usage. Checkout alone does not establish an active paid entitlement.
422Missing/invalid parameters or a blocked URL/redirect. Check the validation detail, scheme and parameter limits; use an allowed public HTTP(S) URL. Private targets remain blocked. A blocked URL admitted for fetching counts; invalid parameters do not.
429Account rate limit or render queue full. Wait at least the Retry-After seconds, then retry a bounded number of times with backoff; reduce concurrency. All keys share the account limits. This rejected request does not consume allowance.
502Target fetch/render failed or returned an error. Check the target yourself and try later with bounded backoff. An admitted failure counts; repeated retries can exhaust allowance. Share only a redacted target description with support.
503Rendering or enforcing infrastructure temporarily unavailable. Honour Retry-After if present; stop a retry loop and contact support if it persists. This pre-work rejection does not consume allowance.
404 / 410Artifact missing, not owned by your account or expired. Use the same account's key and the exact returned URL within 24 hours. Regenerating an artifact is a new render request and uses allowance when admitted.

Rate limits: 10 req/s metadata, 1 render per 2s, 4 concurrent renders max (429 + Retry-After beyond that).