kagi extract
Extract the readable content of a web page as markdown using Kagi’s Extract API.
Synopsis
Description
Thekagi extract command sends one HTTPS URL to Kagi’s v1 Extract API and prints the extracted page markdown to stdout by default. 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. Use --format json or --format compact to print the full response envelope, including retained link metadata when Kagi returns it. If Kagi returns no page markdown, the CLI reports the Extract API error details and trace id when available.
Use --filter for pipelines that already have one URL per line. Filter mode ignores the single-URL markdown default and prints one compact JSON record per input line in the same order. Successful records include the Extract API response under response. Failed records include an error envelope on stdout and the command exits nonzero after all inputs are processed.
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.
https:// URLs with a valid host are accepted.
Omit <URL> when using --filter.
--filter
Read one URL per stdin line and print JSONL records.
--format <FORMAT>
Output format. Default: markdown.
Supported values:
markdown- print the first page’s markdown content onlyjson- print the full Extract API response envelopecompact- print the full response envelope as compact JSON
Output
The command prints markdown directly:--format json, the command prints the full response envelope:
--filter, stdout is JSONL:
Examples
Save an Article
Pipe into Another Tool
Inspect Retained Links
Extract Search Results
Exit Codes
Common errors:
- Missing API key
- Non-HTTPS or invalid URL
- Insufficient API credit
- Kagi returns no extractable content
- Network error