Kagi API (1)

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.

See our API Pricing page for standard rates.

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.

In the future we will most likely offer more crafted API wrappers and spotlight clients and applications built by our community - feel free to send them to us!

MCP

We offer a hosted MCP server at: https://mcp.kagi.com/mcp

At this time, we do not support setup via OAuth2 flow, but this is on our roadmap. You will need to get your API key from the dashboard and plug it into your local client with Bearer HTTP authentication.

Here is an example to get started with Claude Code:

claude mcp add kagi https://mcp.kagi.com/mcp --transport http --header "Authorization: Bearer $(read -sp 'API key: ' k; echo $k)" --scope user

You can review and contribute to our MCP server on GitHub!

Support

For bug reports, feature requests, or billing related issues please reach out to developers@kagi.com and we will be happy to assist you.

To help us answer your reports efficiently, please be prepared to provide as much info as you can:

  • For bugs, include request trace IDs from the meta.trace response field or the X-Kagi-Trace response header.
  • If issues are easily reproduced in our playground, send us a link to the playground - the URL will contain parameters to configure the request so that we can reproduce ourselves.
  • Include any code snippets or precise descriptions of the request you are making, and full samples of the response bodies from the API
  • Include mention of which wrapper you are using if any, or links to relevant application code we can review
  • Include the email address associated with your Kagi login if it is not the one you are emailing from

Thank you!

Discord

Join our Discord! Good for quick questions or chatting about things you've made with our APIs!

In the server you will find the #api forum for API related inquiries.

Download OpenAPI description
Overview
API Support

developers@kagi.com

License

Apache-2.0

Languages
Servers
Mock server

https://redocly-api-docs.kagi.com/_mock/openapi/

Production api endpoint

https://kagi.com/api/v1/

Extract API

Extract contents from web pages, currently in markdown form. This endpoint accepts a list of URLs and returns the extracted markdown content for each page.

Operations

Extract page content as markdown from URLs

Request

Extracts markdown content from up to 10 HTTP(s) URLs. Each URL is processed and the extracted content is returned in the response.

Security
kagi
Bodyapplication/jsonrequired
pagesArray of objects(pageInput)[ 1 .. 10 ] itemsrequired

Array of pages to extract content from. Must contain 1-10 URLs. Each URL must be a valid HTTPS URL.

pages[].​urlstring(uri)required

The HTTPS URL of the page to extract content from. Must use HTTPS scheme with a valid host.

Example: "https://example.com/article"
timeoutnumber(float)[ 0.5 .. 10 ]

Optional timeout in seconds for the extraction operation. Out of range values will be clamped back within range.

All URLs are fetched concurrently. This timeout applies a time budget for the entire bulk fetch operation.

Example: 1.337
formatstring

(EXPERIMENTAL) Format to serialize the API response as. The exact contents and structure of markdown output is still being worked on - please send your feedback!

Default "json"
Enum"json""markdown"
curl -i -X POST \
  https://redocly-api-docs.kagi.com/_mock/openapi/extract \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "pages": [
      {
        "url": "https://example.com/article1"
      },
      {
        "url": "https://example.com/article2"
      }
    ],
    "timeout": 1.337,
    "format": "json"
  }'

Responses

Successful extraction

Body
metaobject(meta)required

This object is subject to change as it is provided for debugging purposes. Fields may be added or removed as required. Don't build any hard dependancies on any of this data.

meta.​tracestring

Trace ID that can be used to debug individual API requests. Provide this, if needed, when contacting Kagi support.

meta.​nodestring

The hostname of the node that fulfilled the request.

meta.​msinteger

how long the request took to fulfill, excluding round trip to the client.

meta.​property name*anyadditional property
dataArray of objects(pageOutput)required

Array of extracted page content

data[].​urlstring(uri)required

The URL of the extracted page

Example: "https://example.com/article"
data[].​markdownstring or null

Extracted markdown content of the page

Example: "# Article Title\n\nThis is the extracted content..."
errorsArray of objects(errorDetail)

Optional array of errors that occurred during extraction

Response
{ "meta": { "trace": "abc123def456", "ms": 1250, "node": "us-east-1" }, "data": [ {} ] }