Skip to main content

Kagi API

Project description

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.0rc1
  • 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 --pre flag:

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

Documentation For Authorization

Authentication schemes defined for the API:

kagi

  • Type: Bearer authentication

Author

support@kagi.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kagi_client-1.0.0rc1.tar.gz (67.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kagi_client-1.0.0rc1-py3-none-any.whl (150.2 kB view details)

Uploaded Python 3

File details

Details for the file kagi_client-1.0.0rc1.tar.gz.

File metadata

  • Download URL: kagi_client-1.0.0rc1.tar.gz
  • Upload date:
  • Size: 67.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.11

File hashes

Hashes for kagi_client-1.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 5b424a3ba4194da5d95c332d54001ac69e36e68553b6bf5bccf3d7283eaac210
MD5 60443b6b7b3e98c3baa1a238ebfdb107
BLAKE2b-256 2f7e49c7589ba5d97f1e5fe9322f0bb14f64f4eb3778d296698f93e92b743840

See more details on using hashes here.

File details

Details for the file kagi_client-1.0.0rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for kagi_client-1.0.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 10779aa6ed2231627e2f052aab5f8914f16d472b45116f47b74dc520e6ffb56d
MD5 30fdc6a1237554e4aaae4841b4408edc
BLAKE2b-256 8ca3ead212376a406df40cf82c453538462fdb18b36c4180d77ab42e5b952e92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page