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.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 --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.0rc3.tar.gz (37.7 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.0rc3-py3-none-any.whl (77.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kagi_client-1.0.0rc3.tar.gz
  • Upload date:
  • Size: 37.7 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for kagi_client-1.0.0rc3.tar.gz
Algorithm Hash digest
SHA256 8be7df4fe3439289a3e9cee35a3e70263a3d346075182fe481903fd98a9644e2
MD5 30fa38e164f87c8ae512c6fb2bc2d621
BLAKE2b-256 60535169e9ae28f70af168fb48777bb2dea86e40665e611b512c6c0735b7b883

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kagi_client-1.0.0rc3-py3-none-any.whl
  • Upload date:
  • Size: 77.3 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for kagi_client-1.0.0rc3-py3-none-any.whl
Algorithm Hash digest
SHA256 c7294e96d54cac268914f7b0a257b2225a4ff6c17b9e42c47237aa957abd4022
MD5 ce6e965f27184a32c8f495bd0d6bec43
BLAKE2b-256 bebc9381a88947c795e3b8841b071e0266a88a971f023dbdf30ccba62ea29595

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