An API key is the credential your server, script, or CI job uses to call Kernel without an interactive login. Treat it like a password: keep it out of client-side code, store it in a secret manager, and rotate it when access changes. Kernel only returns the plaintext key once, when you create it. Save theDocumentation Index
Fetch the complete documentation index at: https://kernel.sh/docs/llms.txt
Use this file to discover all available pages before exploring further.
key value immediately. After that, Kernel only shows the masked value.
Before you start
You need one existing Kernel credential to create another API key:- Set
KERNEL_API_KEYbefore running the SDK examples.
- Omit
project_idto create an org-scoped key that can access resources across your organization. - Set
project_idto create a project-scoped key that can only access resources in that project. - When you authenticate with a project-scoped key, you can only create another project-scoped key for the same project.
Create an API key
Use the SDKs when your backend needs to provision keys for environments, customers, or automation jobs.SDKs
List and inspect API keys
List keys to audit what exists. List and retrieve responses includemasked_key, project_id, project_name, created_by, and expiry metadata, but they don’t include the plaintext key.
Rename or delete an API key
Rename a key when the owner or purpose changes. Delete a key when the workload no longer needs access.Rotate a key
Rotate by creating the replacement first, then deleting the old key after your workload has switched over.- Create a new API key with the same scope.
- Store the new plaintext key in your secret manager.
- Deploy or restart the workload that uses
KERNEL_API_KEY. - Verify the workload can call Kernel.
- Delete the old API key.
Troubleshooting
| Error | What it means | What to do |
|---|---|---|
400 Bad Request | The name is missing, days_to_expire is outside 1-3650, or project_id is empty. | Send a name, choose a valid expiry, or omit project_id for an org-scoped key. |
401 Unauthorized | Kernel couldn’t authenticate the request. | Set a valid KERNEL_API_KEY. |
404 Not Found | The project doesn’t exist or the caller can’t access it. | Check the project ID. If you’re using a project-scoped key, create keys only for that same project. |