---
title: "Agent mandate or API key? Which is safer"
url: https://knowyouragent.ch/en/knowledge/comparison/mandate-or-api-key
lang: en
updated: 2026-10-17
license: © Innopulse Consulting GmbH
---

# Agent mandate or API key? Which is safer

An API key is the quickest way to connect an agent to a system, and the riskiest. It allows everything the account allows and leaves no evidence of what was intended on someone&#x27;s behalf.

[Leutrim Miftaraj](https://knowyouragent.ch/en/about/leutrim-miftaraj), Founder, Innopulse Consulting GmbH
Published 17 October 2026

## Key points

- An API key allows everything the account allows and acts like [blanket authority](https://knowyouragent.ch/en/knowledge/glossary/blanket-authority).
- A mandate limits actions, binds them to the agent and can be revoked individually.
- The first step is small: one key per agent, then mandates for actions with consequences.

## What this is about

API keys are long, secret strings that open access. Whoever knows the key can use the interface with all rights of the related account. Many agents are connected this way today: the key sits in a configuration, and the agent calls tools with it.

An [agent mandate](https://knowyouragent.ch/en/knowledge/glossary/agent-mandate) describes the instruction with limits and is bound to the agent&#x27;s key. It can be revoked without changing the access of all other systems, and together with decision and receipt it forms verifiable evidence.

## The comparison

| Feature | API key | Agent mandate |
|---|---|---|
| Scope | All rights of the account | Defined action types and limits |
| Binding | To possession of the key | To the key of a specific agent |
| Passing on | Possible by copying | Worthless without the private key |
| Revocation | Regenerate the key, update all systems | Single mandate through a status list |
| Evidence | The provider&#x27;s access log | Mandate, decision and receipt, independently verifiable |
| Behavior under manipulation | Every instruction is executed | Actions outside the limits are denied |

## Why keys are especially risky for agents

An agent processes content from many sources. A hidden instruction on a website or in an email can lead it to use its key&#x27;s rights for third-party purposes ([prompt injection](https://knowyouragent.ch/en/knowledge/glossary/prompt-injection)). With a blanket key, there is no limit at which this fails. Keys also easily end up in logs, error messages or configuration files and can be reused from there.

A key without limits is therefore [blanket authority](https://knowyouragent.ch/en/knowledge/glossary/blanket-authority): far-reaching, hard to limit and barely provable afterwards.

## From key to mandate

- Inventory: which agents work with which keys, with which rights?
- One key per agent instead of shared keys, so actions become attributable.
- For actions with consequences, introduce a mandate with limits and a gateway that checks before execution.
- Gradually restrict blanket keys to read access or replace them entirely.

The principle of [least privilege](https://knowyouragent.ch/en/knowledge/glossary/least-privilege) guides every step.

## The role of KYA

KYA verifies the evidence a mandate produces: the mandate itself, the decision before execution and the receipt afterwards. For actions carried out with an API key alone, there is nothing to verify, and that is exactly the problem.

## Common misconceptions

- **“A secret key is secure enough.”** Secrecy protects against outsiders, not against your own agent being manipulated.
- **“Keys with few rights solve the problem.”** They reduce the damage but limit no single action and prove nothing.
- **“The access log is enough as evidence.”** It shows that a key was used, not on whose behalf and within which limits.

## Decision guide in three questions

- Does the agent only read, or does it trigger actions with consequences? For actions with consequences, a key is not enough.
- Do several agents share one key? Then actions cannot be attributed.
- Would you have to update all systems after an incident? Then targeted revocation is missing.

## Frequently asked questions

### Are API keys forbidden for AI agents?

No. For read access without consequences, they can be acceptable. For actions with consequences, they lack limits, binding to the agent and verifiable evidence.

### What happens if an API key is lost?

Whoever has it can use all rights of the account until the key is replaced. A mandate, by contrast, is bound to the agent&#x27;s private key and worthless without it.

### Can I combine API keys and mandates?

Yes. The key opens technical access, and a gateway checks every action with consequences against the mandate before it is executed.

### How much effort is the switch?

The first step, one key per agent, is small. Mandates with a gateway can then be introduced use case by use case, starting with payments.

### How do I store API keys for agents securely?

In a managed secrets store, never in code or prompts, with one key per agent and regular rotation. For actions with consequences, a mandate with a gateway is added.

### What do security standards say about keys for agents?

Guidelines such as the OWASP list for applications with language models explicitly warn against excessive rights. The principle of least privilege requires that an agent has only the rights a task needs.

### How do I find out whether my agents use blanket keys?

Check for every agent which access it uses and which rights come with it. If several agents share one key or a key has write rights without limits, it is a blanket key.

## Sources

- NIST: Least Privilege: [https://csrc.nist.gov/glossary/term/least_privilege](https://csrc.nist.gov/glossary/term/least_privilege)
- OWASP: LLM01 Prompt Injection: [https://genai.owasp.org/llmrisk/llm01-prompt-injection/](https://genai.owasp.org/llmrisk/llm01-prompt-injection/)

---
Quelle: https://knowyouragent.ch/en/knowledge/comparison/mandate-or-api-key · KYA – Know Your Agent
