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.0rc2
  • 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.0rc2.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.0rc2-py3-none-any.whl (77.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kagi_client-1.0.0rc2.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.0rc2.tar.gz
Algorithm Hash digest
SHA256 90ba0545ea42c35d6889a83c6888b516a1a7304dd2b20175eebf9fb50b540a2a
MD5 90e68f86428e28e75bba9f179cd0d6c4
BLAKE2b-256 c6ed735dc6fd56793f3f59ed2c95b93d3c8b672aa87a930d5e5bd1385a7d2bd2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kagi_client-1.0.0rc2-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.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 b9a53532d27723f8dbebb7ee83e43a0209fdb75f4a6c8812ca5975fed8db35e0
MD5 07e4c7985580baef74fa4423e42faffa
BLAKE2b-256 fc9165b5a76e0066cdf8cb2e2da92e772adfe241e679af40a76c3d9bd939d406

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