## TL;DR

Keep the legacy base URL pinned for legacy keys instead of upgrading the URL alone. Match your base URL to your key generation: current keys use https://kagi.com/api/v1, and a legacy v0 key only works against the v0 endpoint.

## Steps

1. Match your base URL to your key generation: current keys use https://kagi.com/api/v1, and a legacy v0 key only works against the v0 endpoint. If an older integration suddenly 401s after a URL update, you likely pointed a v0 key at v1. Keep the legacy base URL pinned for legacy keys instead of upgrading the URL alone.

## When to use

You are seeing this: Mixing a v0 key with the v1 base URL fails. Use this skill when you run into "Legacy v0 keys only work on the v0 endpoint - match base URL to key".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Sources

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