Skip to main content

kagi extract

Extract the readable content of a web page as markdown using Kagi’s Extract API.

Synopsis

kagi extract <URL>

Description

The kagi extract command sends one HTTPS URL to Kagi’s v1 Extract API and prints the extracted page markdown to stdout. It is useful when a search result, article, or documentation page needs full-page text instead of a search snippet. The command uses JSON mode internally because that is the stable envelope returned by the API, then prints the first page’s markdown field. If Kagi returns no page markdown, the CLI reports the Extract API error details and trace id when available.

Authentication

Required: KAGI_API_KEY Extract is part of Kagi’s current /api/v1 paid API surface, uses Bearer auth, and consumes API credit per request.

Arguments

<URL> (Required)

The HTTPS URL of the page to extract.
kagi extract "https://example.com/article"
Only https:// URLs with a valid host are accepted.

Output

The command prints markdown directly:
# Article title

Extracted page content...

Examples

Save an Article

kagi extract "https://example.com/article" > article.md

Pipe into Another Tool

kagi extract "https://example.com/article" | sed -n '1,80p'

Exit Codes

CodeMeaning
0Success - markdown extracted
1Error - see stderr
Common errors:
  • Missing API key
  • Non-HTTPS or invalid URL
  • Insufficient API credit
  • Kagi returns no extractable content
  • Network error