The Kagi API provides programmatic access to data that powers our search results & more.
Get started on the API Dashboard to set up billing, manage API keys, and more.
We offer the following libraries you can use to interact with the Kagi API. These are generated from an OpenAPI spec. If you have a language you would like to use and it's not in the list, send us a message and we will add it to the list if it is supported. Or you can use the spec to build your own custom library.
The v1 API is currently in preview to early access testers.
Our existing API, the "v0" beta API, is being replaced with a new version that will be available publicly soon. As changes are made, we will be updating the documentation below when the new features become available.
See the Support and Community section for details.
See our API Pricing page for standard rates.
This is the preferred venue for bug reports and feature requests.
Join our Discord! Good for quick questions or chatting about things you've made with our APIs!
https://redocly-api-docs.kagi.com/_mock/openapi/
https://kagi.com/api/v1/
The Search API is a feature-rich endpoint for search products and agents. It gives programmable access to Kagi's premium search results pulled from many different sources - including our in-house indexes - and re-ranked to surface accurate answers and interesting finds. You can read about our approach towards search on our blog.
The API supports most of the features that we offer through our web UI, including Lenses.
You can also request full markdown extraction of the top results in a single API request.
Type of results to return.
(EXPERIMENTAL) Format to serialize the API response as. The exact contents and structure of markdown output is still being worked on - please send your feedback!
Lens to apply to the search. Can be a built-in lens's identifier or a lens ID as shown on https://kagi.com/settings/lenses when a lens is set to be shareable. Can be just the ID portion of the URL (https://kagi.com/lenses/ID) or the full URL.
Inline description of a lens to apply to the search. Options supplied by the lens take precedence over those supplied by the user in their search terms (e.g., site: operators), allowing you to restrict the scope of the search to return more relevant results in specific applications.
Number of seconds to allow for collecting search results. Lower values will return results more quickly, but may be lower quality or inconsistent between calls. If omitted, will use the latest recommended value by Kagi.
Maximum number of results to return. Must be between 1 and 1024. NOTE: This does not change the amount of results requested, it only limits the maximum amount returned. If omitted, the API always gives you the most results we can get in a single pass.
Filters to apply to search results for more targeted queries.
NOTE: Any parameter here that overlaps with lenses will take priority over the lens.
Configuration for extracting page content from search results. When provided, the API will fetch and extract the content from the specified number of result pages.
The resulting page markdown will update the value of the snippet field on the respective result item.
NOTE: Use of this option incurs additional cost, billed at your account's rate for the Extract API based on the number of units requested. You will not be charged if there were no results to extract.
https://redocly-api-docs.kagi.com/_mock/openapi/search
https://kagi.com/api/v1/search
curl -i -X POST \
https://redocly-api-docs.kagi.com/_mock/openapi/search \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"query": "steve jobs",
"workflow": "search"
}'Success
This object is subject to change as it is provided for debugging purposes. Fields may be added or removed as required. Don't build any hard dependancies on any of this data.
Holds all the search results for the query specified. As results have different types and sources, they are separated into different fields within this object. For example image results are stored under data.image while news results are stored under data.news. All results will have the same main structure, but additional data might be stored under the data.{name}[].props path. Please look at each different type of result for more information about this.
{ "meta": { "trace": "69c3f5c4168f66b860e951c585550f1c", "node": "us-central1", "ms": 213, "query": { … } }, "data": { "search": [ … ], "video": [ … ], "web_archive": [ … ], "infobox": [ … ], "adjacent_question": [ … ] } }