API keys overview
Manage your APIs
Scopes define what permissions an API key has when making requests to your API. You can create and define custom scopes when you register your API in Kinde, then assign them for each API key you create.
This topic is about strategies and considerations when assigning scopes to API keys.
The scopes you set will be related to what your app is and does. These are just some examples for AI apps.
read:ai_chatswrite:ai_chatread:ai_analyticswrite:ai_analyticsread:ai_workflowsWhen a user API key is used with an MCP connection, each selected scope maps to one MCP tool. Tools without a matching scope are hidden from the MCP client.
Grant only the scopes needed for the AI workflow. Because API keys are immutable, create a new key with updated scopes if you need to change which tools are available.
API keys are immutable, so you can’t update the scopes of an existing API key. You can only create a new API key with the desired scopes.
When your application receives a token, validate that it has the required scopes:
function hasRequiredScope(scopes, requiredScope) { return Array.isArray(scopes) && scopes.includes(requiredScope);}
// Example usage (after verifying the API key)if (!hasRequiredScope(verification.scopes, "write:users")) { return res.status(403).json({ error: "Insufficient scope" });}