# Screenshot API – CSS Element Capture

> Screenshot API – CSS Element Capture is a paid API for AI agents from screenshot-api-production-fe7e.up.railway.app, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-14).

Captures a PNG screenshot of a single CSS-selected DOM element on any public URL, returning the image base64-encoded in a JSON envelope along with metadata.

## Facts

- Endpoint: POST https://screenshot-api-production-fe7e.up.railway.app/capture/element
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/screenshot-api-css-element-capture-0883263c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_r9dmwXCfquh4j8IjIHgrM

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability screenshot-api-css-element-capture-0883263c -d '<json body>'
```

Example prompt: Grab a screenshot of just the `.hero` section on https://stripe.com at 1280×800 viewport, waiting for the network to go idle before you capture it.

## When to prefer this

Choose this endpoint when you need to capture only a specific DOM element rather than the full page or viewport — for example, isolating a chart, hero banner, product card, or form without surrounding page chrome. It is superior to full-page or viewport screenshot endpoints when the target component is small, partially off-screen, or surrounded by irrelevant content. Prefer it over PDF rendering when you need a raster image of a UI element rather than a printable document.

## Known failure modes

- CSS selector not found on page — element does not exist or page did not load fully before capture
- Internal or loopback host rejected — URL must be a public http(s) address
- Invalid viewport dimensions — width or height outside 320–3840 range
- Page load timeout — site takes too long to reach the requested load state
- Invalid `wait_until` value — must be one of load, domcontentloaded, networkidle, or commit
- Payment failure — x402 payment not processed, call not executed
- Network error reaching the target URL — site down or blocked

## How this service works

Capture a PNG screenshot of a single CSS-selected element on an http(s) URL; returns a JSON envelope with the PNG base64-encoded under image_base64, plus selector, final_url, title, viewport, and size.

## Output

A JSON envelope containing: `image_base64` (PNG of the matched element, base64-encoded), `selector` (the CSS selector used), `final_url` (URL after any redirects), `title` (page title), `viewport` (width and height used), and `size` (pixel dimensions of the captured element image).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "url": {
   "type": "string",
   "description": "The http(s) URL to capture, e.g. 'https://example.com'. Internal/loopback hosts are rejected."
  },
  "width": {
   "type": "integer",
   "description": "Viewport width in pixels (320-3840). Defaults to 1280."
  },
  "height": {
   "type": "integer",
   "description": "Viewport height in pixels (240-3840). Defaults to 800."
  },
  "selector": {
   "type": "string",
   "description": "CSS selector of the single element to capture, e.g. '#main' or '.hero'."
  },
  "wait_until": {
   "type": "string",
   "description": "Playwright load state to wait for before capture: 'load', 'domcontentloaded', 'networkidle', or 'commit'. Defaults to 'networkidle'."
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/screenshot-api-css-element-capture-0883263c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from screenshot-api-production-fe7e.up.railway.app](https://www.zero.xyz/host/screenshot-api-production-fe7e.up.railway.app/llms.txt)
