Agent Skills: Capture CLI

Capture screenshots, generate PDFs, and extract content from any URL using the Capture CLI. Use when the user wants to screenshot a website, create a PDF of a page, extract text content, get metadata from a URL, or record an animated GIF.

UncategorizedID: techulus/capture-skills/capture-cli

Install this agent skill to your local

pnpm dlx add-skill https://github.com/techulus/capture-skills/tree/HEAD/skills/capture-cli

Skill Files

Browse the full folder contents for capture-cli.

Download Skill

Loading file tree…

skills/capture-cli/SKILL.md

Skill Metadata

Name
capture-cli
Description
Capture screenshots, generate PDFs, extract content, fetch metadata, record animated GIFs, and drive stateful browser sessions using the Capture CLI and Sessions API. Use when the user wants to capture a URL, automate a browser flow, log in, click through pages, query dynamic content, or use Capture from an agent or shell.

Capture CLI

Capture screenshots, generate PDFs, extract content, fetch metadata, record animated GIFs, and drive stateful browser sessions using the Capture CLI.

Prerequisites

The Capture CLI must be installed and configured with environment variables:

  • CAPTURE_KEY - Your Capture API key
  • CAPTURE_SECRET - Your Capture API secret

Install via Homebrew:

brew tap techulus/tap && brew install capture

Or via Go:

go install github.com/techulus/capture-go/cmd/capture@latest

Screenshot

capture screenshot <url> -o <file.png>

Options (pass with -X key=value):

| Option | Default | Description | |--------|---------|-------------| | vw | 1440 | Viewport width | | vh | 900 | Viewport height | | scaleFactor | 1 | Screen scale factor (dpr) | | fullPage | false | Capture full page | | darkMode | false | Dark mode screenshot | | delay | 0 | Delay in seconds before capturing | | waitFor | - | Wait for CSS selector to appear | | waitForId | - | Wait for element ID to appear | | selector | - | Screenshot element matching this selector | | selectorId | - | Screenshot element matching this ID | | top | 0 | Top offset for clipping | | left | 0 | Left offset for clipping | | width | viewport | Clipping width | | height | viewport | Clipping height | | blockCookieBanners | false | Dismiss cookie consent banners | | blockAds | false | Block ads | | bypassBotDetection | false | Bypass bot detection / solve captchas | | transparent | false | Transparent background | | emulateDevice | - | Emulate device (iphone_14, iphone_15_pro, ipad, pixel_8, etc.) | | type | png | Image type: png, jpeg, or webp | | resizeWidth | - | Resize image width | | resizeHeight | - | Resize image height | | userAgent | - | Custom user agent (base64url encoded) | | httpAuth | - | HTTP Basic Auth (base64url of username:password) | | fresh | false | Take fresh screenshot instead of cached |

Example:

capture screenshot https://example.com -X vw=1920 -X vh=1080 -X fullPage=true -X darkMode=true -o screenshot.png

PDF

capture pdf <url> -o <file.pdf>

Options (pass with -X key=value):

| Option | Default | Description | |--------|---------|-------------| | format | A4 | Paper format: Letter, Legal, Tabloid, Ledger, A0-A6 | | width | - | Custom paper width (with units, e.g., 8.5in) | | height | - | Custom paper height (with units) | | landscape | false | Landscape orientation | | scale | 1 | Scale of webpage rendering | | printBackground | false | Print background graphics | | marginTop | - | Top margin (with units) | | marginRight | - | Right margin (with units) | | marginBottom | - | Bottom margin (with units) | | marginLeft | - | Left margin (with units) | | delay | 0 | Delay in seconds before capturing | | userAgent | - | Custom user agent (base64url encoded) | | httpAuth | - | HTTP Basic Auth (base64url of username:password) |

Example:

capture pdf https://example.com -X format=A4 -X landscape=true -X printBackground=true -o document.pdf

Content

capture content <url> --format <markdown|html>

Options (pass with -X key=value):

| Option | Default | Description | |--------|---------|-------------| | delay | 0 | Delay in seconds before capturing | | waitFor | - | Wait for CSS selector to appear | | waitForId | - | Wait for element ID to appear | | userAgent | - | Custom user agent (base64url encoded) | | httpAuth | - | HTTP Basic Auth (base64url of username:password) |

CLI options:

  • --format markdown - Output as markdown (preferred for readability)
  • --format html - Output as HTML
  • -o <file> - Save to file

Example:

capture content https://example.com --format markdown

Metadata

capture metadata <url> --pretty

CLI options:

  • --pretty - Pretty-print JSON output
  • -o <file> - Save to file

Returns JSON with: title, description, author, logo, language, image, publisher, url, and Open Graph data.

Example:

capture metadata https://example.com --pretty

Animated

capture animated <url> -o <file.gif>

Options (pass with -X key=value):

| Option | Default | Description | |--------|---------|-------------| | duration | 5 | Recording duration in seconds (1-30) | | vw | 1440 | Viewport width | | vh | 900 | Viewport height | | scaleFactor | 1 | Device scale factor | | delay | 0 | Seconds to wait before starting (0-25) | | waitFor | - | Wait for CSS selector to appear | | waitForId | - | Wait for element ID to appear | | darkMode | false | Enable dark mode | | hideScrollbars | true | Hide scrollbars | | blockCookieBanners | false | Dismiss cookie consent banners | | blockAds | false | Block ads | | emulateDevice | - | Emulate device (iphone_15_pro, ipad, pixel_8, etc.) | | userAgent | - | Custom user agent (base64url encoded) | | httpAuth | - | HTTP Basic Auth (base64url of username:password) |

Example:

capture animated https://example.com -X duration=10 -X darkMode=true -o recording.gif

Browser Sessions

Use browser sessions when a task needs interaction or shared state across multiple steps: logging in, filling forms, clicking through pages, waiting for dynamic content, querying the DOM after interaction, or taking a screenshot after a workflow.

Sessions keep a real browser open across requests. Close sessions as soon as the workflow is done: sessions are billed by duration at 1 credit per elapsed minute, rounded up, when they close or expire. A session can stay open for up to 15 minutes, and a user can have up to 5 active sessions at once.

Sessions CLI

The CLI derives Sessions API Bearer authentication from CAPTURE_KEY and CAPTURE_SECRET.

# Create a session. Returns JSON with session.id and expiresAt.
capture sessions create --max-ttl-seconds 300 --pretty

# Optionally route through the user's configured proxy or stealth browser.
capture sessions create --max-ttl-seconds 300 --proxy --bypass-bot-detection --pretty

# Get session metadata.
capture sessions get sess_123 --pretty

# Navigate and keep browser state for later actions.
capture sessions action sess_123 goto --payload-json '{"url":"https://example.com"}'

# Run an action using key=value payload options.
capture sessions action sess_123 screenshot -X fullPage=true --pretty

# Close the session to stop billing.
capture sessions close sess_123 --pretty

Sessions CLI options:

| Command | Option | Description | |---------|--------|-------------| | sessions create | --max-ttl-seconds | Maximum session lifetime in seconds, capped at 900 | | sessions create | --proxy | Use the authenticated user's configured browser proxy | | sessions create | --bypass-bot-detection | Use Capture's bot-detection bypass browser when available | | sessions get / close / action | --pretty | Pretty-print JSON output | | sessions action | --payload-json | Pass the action payload as a JSON object | | sessions action | -X key=value | Pass action payload options; can be repeated |

Sessions REST API

Base URL: use either https://api.capture.page or https://edge.capture.page. Prefer https://edge.capture.page when you want the nearest edge endpoint.

Session endpoints use Bearer authentication:

Authorization: Bearer <base64(userId:secret)>

The secret can be the primary Capture secret or an API secret.

# Create a browser session.
curl -X POST "https://edge.capture.page/v1/sessions" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"maxTtlSeconds":300}'

# Execute an action in the session.
curl -X POST "https://edge.capture.page/v1/sessions/{sessionId}/actions" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"type":"goto","payload":{"url":"https://example.com"}}'

# Close the session.
curl -X DELETE "https://edge.capture.page/v1/sessions/{sessionId}" \
  -H "Authorization: Bearer <token>"

REST endpoints:

| Method | Path | Purpose | |--------|------|---------| | POST | /v1/sessions | Create a browser session | | GET | /v1/sessions/{sessionId} | Get session metadata | | POST | /v1/sessions/{sessionId}/actions | Execute a browser action | | DELETE | /v1/sessions/{sessionId} | Close a session |

Create options:

| Option | Description | |--------|-------------| | maxTtlSeconds | Maximum session lifetime in seconds, capped at 900 | | proxy | Use the authenticated user's configured browser proxy | | bypassBotDetection | Use Capture's bot-detection bypass browser when available |

Session Actions

Action requests use this shape:

{
  "type": "goto",
  "payload": {
    "url": "https://example.com"
  }
}

Action types:

| Category | Actions | |----------|---------| | Navigation | goto, back, forward, reload | | Interaction | click, type, type_text, fill, select, check, press, hover, scroll, move_mouse, drag_mouse | | Reading | snapshot, content, query, title, url, console, errors, cursor_position | | Waiting | wait_for_selector, wait_for_timeout | | Capture | screenshot | | Multi-step | batch |

Useful action payload details:

  • content supports format values text, markdown, or html; default is cleaned text.
  • query supports selector, fields, attributes, visibleOnly, and limit; limit is capped at 500 and requested attributes are returned under each element's attributes object.
  • Navigation actions support waitUntil values load, domcontentloaded, or commit; default is domcontentloaded.
  • wait_for_timeout accepts timeoutMs, capped at 2500.
  • Selector-based click and hover responses include diagnostics such as whether an element matched, visibility, element text, bounding box, and interaction point.
  • Any successful action response for an existing session includes expiresInSeconds.
  • batch runs multiple actions in one round-trip via payload.actions; nested batch actions are capped at 25.

Example multi-step flow:

capture sessions create --max-ttl-seconds 300 --pretty
capture sessions action sess_123 goto --payload-json '{"url":"https://example.com/login"}'
capture sessions action sess_123 fill --payload-json '{"selector":"input[name=email]","text":"user@example.com"}'
capture sessions action sess_123 fill --payload-json '{"selector":"input[name=password]","text":"secret"}'
capture sessions action sess_123 click --payload-json '{"selector":"button[type=submit]"}'
capture sessions action sess_123 wait_for_selector --payload-json '{"selector":"main"}'
capture sessions action sess_123 content --payload-json '{"format":"markdown"}' --pretty
capture sessions close sess_123 --pretty

Global CLI Options

| Option | Description | |--------|-------------| | -o | Output file path (required for screenshot, pdf, animated) | | -X | Pass API options (e.g., -X vw=1920) | | --edge | Use edge mode for faster response | | --dry-run | Preview the API URL without executing |

Tips

  • Use --edge for faster responses when latency matters
  • Use --dry-run to preview the API URL without executing
  • Prefer --format markdown for content extraction (more readable)
  • Always specify output file with -o for screenshot, pdf, and animated commands
  • Common devices for emulation: iphone_14, iphone_15_pro, ipad, pixel_8
  • For full-page screenshots, use -X fullPage=true
  • For dark mode, use -X darkMode=true
  • Use browser sessions for multi-step or authenticated workflows; use one-shot screenshot, pdf, content, metadata, or animated commands for stateless captures
  • Always close browser sessions with capture sessions close <session-id> when finished