This release is a pre-release and may not be stable for production use.
kagi-client
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.
Official Client Libraries
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.
API Status
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.
Pricing
See our API Pricing page for standard rates.
GitHub Discussions
This is the preferred venue for bug reports and feature requests.
Discord
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: 1
- Package version: 1.0.0rc3
- Generator version: 7.22.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://kagi.com/support
Requirements.
Python 3.10+
Installation & Usage
PyPI
pip install kagi-client
Note: If you're installing a prerelease version, add the
--preflag:pip install --pre kagi-client
Then import the package:
import kagi_client
From source
pip install git+https://github.com/kagisearch/kagi-openapi-python.git
Then import the package:
import kagi_client
Tests
Execute pytest to run the tests.
Getting Started
Please follow the installation procedure and then run the following:
import kagi_client
from kagi_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 = kagi_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 Bearer authorization: kagi
configuration = kagi_client.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with kagi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = kagi_client.ExtractApi(api_client)
extract_request = {"pages":[{"url":"https://example.com/article1"},{"url":"https://example.com/article2"}],"timeout":1.337,"format":"json"} # ExtractRequest |
try:
# Extract page content as markdown from URLs
api_response = api_instance.extract_content(extract_request)
print("The response of ExtractApi->extract_content:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling ExtractApi->extract_content: %s\n" % e)
Documentation for API Endpoints
All URIs are relative to https://kagi.com/api/v1
| Class | Method | HTTP request | Description |
|---|---|---|---|
| ExtractApi | extract_content | POST /extract | Extract page content as markdown from URLs |
| SearchApi | search | POST /search | Perform a web search |
Documentation For Models
- ErrorDetail
- ErrorEnvelope
- ExtractRequest
- ExtractResponse
- Meta
- PageInput
- PageOutput
- Search200Response
- Search200ResponseData
- SearchRequest
- SearchRequestExtract
- SearchRequestFilters
- SearchRequestLens
- SearchRequestPersonalizations
- SearchRequestPersonalizationsDomainsInner
- SearchRequestPersonalizationsRegexesInner
- SearchResult
- SearchResultImage
Documentation For Authorization
Authentication schemes defined for the API:
kagi
- Type: Bearer authentication
Author
Metadata
Release files for kagi_client 1.0.0rc3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| kagi_client-1.0.0rc3.tar.gz | 37.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kagi_client-1.0.0rc3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 115.0 kB
Release files / kagi_client-1.0.0rc3.tar.gz
| Download URL | kagi_client-1.0.0rc3.tar.gz |
|---|---|
| Size | 37.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8be7df4fe3439289a3e9cee35a3e70263a3d346075182fe481903fd98a9644e2
|
|
BLAKE2b-256 checksum How to use checksums |
60535169e9ae28f70af168fb48777bb2dea86e40665e611b512c6c0735b7b883
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / kagi_client-1.0.0rc3-py3-none-any.whl
| Download URL | kagi_client-1.0.0rc3-py3-none-any.whl |
|---|---|
| Size | 77.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7294e96d54cac268914f7b0a257b2225a4ff6c17b9e42c47237aa957abd4022
|
|
BLAKE2b-256 checksum How to use checksums |
bebc9381a88947c795e3b8841b071e0266a88a971f023dbdf30ccba62ea29595
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for kagi_client 1.0.0rc3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.