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.
policy separately limits which actions and resources it can access inside that boundary. Both organization- and project-scoped keys can have policies.
Create an API key
Use the SDKs when your backend needs to provision keys for environments, customers, or automation jobs.SDKs
Scope a key to specific resources
A personal API key without a policy is unrestricted within its organization or project. Add apolicy when you create a key to limit what it can do. Keys created without policy work exactly as before.
Use scoped keys when you hand a credential to code you trust less than your backend, such as an AI agent or a short-lived job.
How policies work
A policy is a list of statements. Each statement allows one action on one resource, and the key is denied everything no statement allows.- A resource selects one project-owned object, such as
projects/{project_id}/extensions/{extension_id}, an organization-owned object, such ascredential_providers/{provider_id}, or a container such asprojects/{project_id}/*ororganizations/{org_id}/*. - An action is an exact name such as
browsers:use,extensions:read, orapi_keys:create. A container wildcard grants that action throughout the container, not every action. To grant several actions at once, see action wildcards.
browsers:create and browsers:use on the project, plus profiles:use on that profile. See API key permissions for every action and what each operation requires.
Policies cover browsers, profiles, vaults, proxies, extensions, telemetry destinations, browser pools, tasks and reports, apps, managed auth, credentials, organization/project administration, API keys, audit logs, and the configuration registry. Start with a policy example for your workload.
Create a scoped key
This key can create and control browsers in one project, only with profileprof_7h2kq9x4m1 or no profile, and expires in one hour:
Expiry and revocation
- Use
expires_atinstead ofdays_to_expirefor an exact expiry. When creating a key with a policy, follow the issuer expiry rule. - Expired and deleted keys can’t authenticate new API requests.
- Deleting a key through the API or dashboard, or rotating it with
expire_in_days: 0, also ends browser sessions associated with that key, including pool browsers it acquired and hasn’t released. Cleanup runs asynchronously and discards unsaved profile changes. - Grace-period expiry and natural expiry do not end existing browsers. Delete those browsers explicitly if you need to stop them.
- Connection URLs (CDP, WebDriver, live view) stop working when their browser ends, not when the key stops authenticating.
- If browser cleanup can’t be scheduled, deletion or immediate rotation fails without committing the key change.
- Rotating a scoped key keeps its policy.
Automatic cleanup only covers browsers associated with the key. Some browsers created before this behavior was introduced may not have that association. Delete those browsers directly. Cleanup doesn’t undo profile changes you’ve already saved, delete browser pools, or stop app invocations or deployments.
Delegate a narrower key
You can use a scoped key to create another scoped key:- Grant the issuer
api_keys:createon the new key’s project or organization container. - Supply a
policywhose statements are covered by the issuer’s policy, and keep the new key inside the issuer’s organization/project boundary. - If the issuer expires, set the child’s expiry no later than the issuer’s. To issue a longer-lived child, the issuer needs
api_keys:issue_beyond_expiryon the new key’s container and must request a finite lifetime of at most 3650 days. Kernel returns400rather than shortening a disallowed lifetime. When rotating with a scoped key, the same expiry rule applies, but Kernel checks the permission on the existing key.
api_keys:create and browsers:use on a project can issue a key with only browsers:use on one browser in that project. Use the same SDK creation call shown above with the narrower policy.
Use api_keys:read to inspect keys, api_keys:write to rename them, api_keys:delete to revoke them, and api_keys:rotate to replace them. Grant these actions separately from key issuance.
Allow longer-lived child keys
Use an unscoped credential to issue a trusted key withapi_keys:issue_beyond_expiry. This permission doesn’t grant creation, rotation, or resource access by itself.
issuer.key to create a child with days_to_expire: 365 and only browsers:use on this project. Its expiry is one year, not silently shortened to the issuer’s 30 days. Without the special permission, that request returns 400.
Scoped callers cannot create or rotate keys whose policies contain api_keys:issue_beyond_expiry, so the child can’t inherit this authority. Add api_keys:rotate separately to let the issuer rotate other keys.
Limit a key to your IP ranges
Add acondition to a statement to restrict where requests can come from. The source_ip condition allows the statement only when the request’s client address is inside one of its CIDR networks:
403 before they touch your data.
How conditions evaluate:
- Each entry in
valuesmust be a CIDR network (203.0.113.0/24). A bare address without a mask, an entry with host bits set, and an IPv4 network written in IPv6 notation are rejected with400at creation—so a mistyped mask can’t silently grant a whole block. - Requests from outside every listed network get
403withinsufficient_scope, and the denial is recorded in your audit logs with the client IP, so you can widen the list from evidence. - A condition only narrows its own statement. If you want a key that only works from your network, add the same condition to every statement in its policy.
- Kernel evaluates the address the trusted edge proxy reports, not a client-supplied header value, so a request can’t spoof its way in.
Add an IP allowlist to an existing key
You don’t need to rotate a key to add, change, or remove IP rules. Update the key with apolicy, and the credential, name, project, and expiry stay the same—your consumers keep the same secret:
api_keys:set_policy on the target key. You must cover both its current and replacement policies; you can’t convert an unrestricted key this way. To change its name in the same request, you also need api_keys:write.
Updating policy fully replaces the key’s permissions, so send the complete policy, not just the statements you’re changing. The new policy takes effect within the authorization cache (~10 seconds) and applies only to new requests—already-open browser connections keep running.
Attaching a policy to a key that doesn’t have one makes the key scoped: every action and resource the policy doesn’t list is denied. There’s no way to remove a policy from a key and go back to unrestricted—if you no longer need a scoped key, delete it.
A key used through a hosted MCP server is evaluated against the MCP server’s egress address, so an IP-restricted key is denied everywhere until MCP support ships. If you route keys through a hosted MCP server, leave
source_ip conditions off those keys for now.App runtime policy
An app’s runtime policy controls which Kernel API calls that version can make. Set it when you deploy. Your app keeps those permissions if the key you used to deploy expires or is revoked; you don’t need to redeploy or store a key for the app. Default: When you deploy with a scoped key and omitruntime_policy, the app gets invocations:write on projects/{project_id}/* so it can report results. It also gets browsers:create, browsers:use, and browsers:delete on projects/{project_id}/* for each one your deploying key holds on the whole project, so an app that opens browsers works on its first run. A grant on a single browser doesn’t count. These grants are project-wide: the app can update other apps’ invocations and use or delete any browser in the project, not only ones it created. Put apps that don’t trust each other in separate projects.
To keep an app callback-only, deploy it with an explicit runtime_policy that has only invocations:write on projects/{project_id}/*.
To grant more access, send runtime_policy as a JSON form field on POST /deployments. The SDKs don’t accept runtime_policy yet, so these examples call the API directly. Set KERNEL_PROJECT_ID to your project ID and KERNEL_API_KEY to your deploying key, and put main.py and its dependency manifest at the root of app.zip:
invocations:write grant and any additional permissions your app needs. The policy must fit within the app’s project and your own permissions, reference existing resources, and exclude api_keys:issue_beyond_expiry.
To deploy with a scoped key, grant it container-wide deployments:create, deployments:delete, and invocations:write, plus any additional permissions in the app’s policy. To run the app with a scoped key, grant it invocations:create on the container and every permission in the app’s policy. For an app deployed with the default policy, that includes the browser permissions it received. If the invoking key is missing any, the 403 names them as action on resource. Permissions on individual resources appear as specific resources.
Kernel supplies a short-lived KERNEL_API_KEY with the app’s permissions for each run. Moving a deployment to another host preserves the policy. Stopping it prevents new runs; it doesn’t revoke keys already issued. KERNEL_API_KEY is a reserved environment variable. To supply a credential for your own API calls, pass it under another name.
See the app policy example for separate deployer, runtime, and invoker permissions.
Existing deployments
A deployment keeps the runtime policy it was created with. To change an app’s permissions, redeploy it. Deploying with an unrestricted credential and omittingruntime_policy creates a shared key; it doesn’t migrate the app to per-invocation keys. If the shared key has a policy, it must be live, its permissions must be covered by the caller, and it must expire no later than the caller. Host moves preserve these rules; superseded deployments keep their shared key until in-flight runs drain.
List and inspect API keys
UseGET /org/api_keys to list keys and GET /org/api_keys/{id} to inspect one. List and retrieve responses include masked_key, project_id, project_name, created_by, expiry metadata, and policy for scoped keys, but they don’t include the plaintext key. If policy is absent, the key is unrestricted within its project or organization.
The list returns active keys by default: keys that are neither deleted nor expired. Pass status to see the others, and combine these filters to narrow the list:
In the dashboard, filter the list by Created by, Linked account, and Project, and switch between Active, Expired, and Deleted.
Rename, update permissions, or delete an API key
Rename a key when the owner or purpose changes. Update itspolicy to add, change, or remove IP rules and permissions without rotating the credential. Delete a key when the workload no longer needs access.
Rotate a key
rotate issues a replacement key in a single call and keeps the old key working for a short grace period, so your workload can switch over without downtime. The new key copies the rotated key’s name, project scope, and policy, and—like create—Kernel returns the plaintext key only once.
Two optional parameters control the timing:
days_to_expiresets the new key’s lifetime in days (1-3650). Omit it to give the new key the same lifetime the rotated key originally had, or to never expire if the old key never did.expire_in_dayssets how long the old key keeps working before it expires. Use0to revoke it immediately, or omit it for the default 7-day grace window. The old key stops authenticating automatically once the window passes—you don’t need to delete it.
api_keys:issue_beyond_expiry.
If the key you rotate with has a policy, it needs api_keys:rotate on the target and must cover the target’s policy. The issuer expiry rule applies even when you omit days_to_expire and reuse the old lifetime. A scoped caller can’t rotate a key that itself carries api_keys:issue_beyond_expiry.
- 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 before the grace window ends.
expire_in_days: 0. The old key stops working, its associated browsers are ended asynchronously, and unsaved profile changes in those browsers are discarded. With a grace period, existing browsers keep running after the old key expires.