What it is
A canary token is a tripwire. You create something that looks valuable, such as an API key, a spreadsheet named "passwords," or a web address, and you hide it where only a snoop would look. Real users have no reason to touch it. So when it gets used, opened or visited, you get an alert, and you know someone is where they should not be.
The name comes from the canary in the coal mine: a small warning that something is wrong before the damage is done.
How it works
Each token is unique. That is the whole trick. The token carries a hidden identifier that points back to a server the defender controls. When someone uses a fake cloud key, tries a fake login, opens a decoy document or loads a tracked URL, the server records which token fired, when, and from what network address.
Common types include:
- Credential tokens: fake keys or passwords that look real. Using one on a real service trips the alarm.
- URL tokens: a link that notifies you when it is fetched.
- Document tokens: a file that phones home when it is opened.
- DNS tokens: a hostname that alerts you when something looks it up.
Because each token lives in exactly one place, an alert also tells you where the intruder was looking.
Why it matters with AI
Prompts, logs and an agent's context window often hold real secrets. If a provider stores or leaks them, you may never know. A canary token fixes that blind spot. Put a fake key in a test prompt, or in the files an AI agent can read, and any later use of it shows that the data left its intended path.
Security researchers use the same idea to audit AI services. They send prompts that each carry a unique fake credential, then watch for who tries to use them. It is a way to test whether a zero data retention promise holds up.
An example
You paste a fake cloud access key into a prompt sent through a third-party router. Weeks later the key is used from an address you do not recognize. You now know the prompt was stored or read downstream, and which route it took.
Limits
A canary token detects a problem. It does not prevent one. It only works if the attacker actually uses the bait, and a careful one may avoid it. It is a complement to secrets management and least privilege, not a replacement.