The Kagi API provides programmatic access to data that powers our search results & more.
Quick start for all APIs:
We have the following APIs available.
- Kagi Search API (invite only at the moment)
- Web and News Enrichment API (public, exposes Kagi's own indexes Teclis and TinyGem)
- Universal Summarizer API (public)
- FastGPT API (public)
- Kagi Small Web RSS feed (public)
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.
There also exist third party libraries for interacting with the Kagi API.
- kagigo for Go - FastGPT & Universal Summarizer
- kagi-api for Rust
- kagi-api for Ruby
- kagi-dotnet for C#/.NET
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.
We are in the process of moving all APIs to a post-paid tiered system, where each tier has a limit on the number of requests that can be made. If an API has a pricing section, then it is still being migrated over to the new billing system.
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!
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 0.1.0
- Package version: 1.0.0
- Generator version: 7.14.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://kagi.com/support
Python 3.9+
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/kagisearch/kagi-api-python.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/kagisearch/kagi-api-python.git
)
Then import the package:
import openapi_client
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import openapi_client
Execute pytest
to run the tests.
Please follow the installation procedure and then run the following:
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://kagi.com/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "https://kagi.com/api/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: kagi
configuration.api_key['kagi'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['kagi'] = 'Bearer'
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.EnrichmentApi(api_client)
q = 'steve jobs' # str | Query to enrich
type = web # str | Enrich with 'web' results or 'news' results (default to web)
try:
# Get enriched search results
api_response = api_instance.enrich_search(q, type)
print("The response of EnrichmentApi->enrich_search:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling EnrichmentApi->enrich_search: %s\n" % e)
All URIs are relative to https://kagi.com/api/v1
Class | Method | HTTP request | Description |
---|---|---|---|
EnrichmentApi | enrich_search | GET /enrich/{type} | Get enriched search results |
FastGPTApi | fast_gpt | POST /fastgpt | Answer a query. |
SearchApi | search | POST /search | Perform a search of the web. |
SummarizerApi | summarize_text | POST /summarize | Upload text to summarize. |
SummarizerApi | summarize_url | GET /summarize | Get a summary for a URL |
TranslateApi | translate | POST /api/translate | Text Translation |
TranslateApi | translate_alternatives | POST /alternative-translations | Alternative Translations |
TranslateApi | translate_detect | POST /api/detect | Language Detection |
TranslateApi | translate_dictionary | POST /api/dictionary | Dictionary |
TranslateApi | translate_list_languages | GET /api/list-languages | List Supported Languages |
TranslateApi | translate_romanize | GET /api/romanize | Text Romanization |
TranslateApi | translate_word_insights | POST /api/word-insights | Word Insights |
- EnrichSearch200Response
- ExampleError
- ExampleErrorError
- FastGPT200Response
- FastGPT200ResponseData
- FastGPTRequest
- Meta
- MetaQuery
- MetaQueryFieldsInner
- Search200Response
- Search200ResponseData
- SearchObject
- SearchRequest
- SearchResult
- SearchResultImage
- Summary
- SummaryData
- Translate200Response
- Translate200ResponseOneOf
- Translate200ResponseOneOf1
- Translate200ResponseOneOfDefinition
- Translate200ResponseOneOfDefinitionDefinitionsInner
- Translate200ResponseOneOfDefinitionDefinitionsInnerMeaningsInner
- Translate200ResponseOneOfDetectedLanguage
- Translate400Response
- Translate500Response
- TranslateAlternatives200Response
- TranslateAlternatives200ResponseElementsInner
- TranslateAlternatives401Response
- TranslateAlternatives402Response
- TranslateAlternatives500Response
- TranslateDetect200Response
- TranslateDetect400Response
- TranslateDetectRequest
- TranslateDictionary200Response
- TranslateDictionary200ResponseDefinition
- TranslateDictionary200ResponseDefinitionPrimaryMeaning
- TranslateDictionary200ResponseDefinitionSecondaryMeaningsInner
- TranslateDictionary200ResponseLanguage
- TranslateDictionary400Response
- TranslateDictionary500Response
- TranslateDictionaryRequest
- TranslateListLanguages200ResponseInner
- TranslateRequest
- TranslateRequestText
- TranslateRomanize200Response
- TranslateWordInsights200Response
- TranslateWordInsights200ResponseInsightsInner
- TranslateWordInsights200ResponseInsightsInnerVariationsInner
- TranslateWordInsights400Response
- TranslateWordInsights500Response
- UploadText
Authentication schemes defined for the API:
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header
- Type: Bearer authentication