Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6bd8ecb
Document expanded scoped API key permissions
sjmiller609 Nov 5, 2026
970230e
Document permission to issue longer-lived API keys
sjmiller609 Nov 10, 2026
a285f16
Merge remote-tracking branch 'origin/main' into hypeship/expand-scope…
sjmiller609 Nov 10, 2026
511e7f4
Document projects:delete for project archive and restore
sjmiller609 Nov 10, 2026
e7a3f2c
Limit rotation expiry checks to callers with policies
sjmiller609 Nov 10, 2026
6745c32
Clarify API key expiry limits for callers with policies
sjmiller609 Nov 10, 2026
9ad9386
Note that action-limited OAuth tokens can't manage API keys
sjmiller609 Nov 10, 2026
a79f46d
Clarify which OAuth tokens can't manage API keys
sjmiller609 Nov 10, 2026
19be78b
Describe policy-mode OAuth tokens' API key restriction
sjmiller609 Nov 10, 2026
0b20a45
Merge remote-tracking branch 'origin/main' into hypeship/expand-scope…
sjmiller609 Nov 17, 2026
f9a6f34
Align scoped-key docs with runtime and resource checks
sjmiller609 Nov 17, 2026
230b126
Document explicit deployment runtime policies
sjmiller609 Nov 17, 2026
a3deec1
Document minimal scoped runtime defaults
sjmiller609 Nov 18, 2026
b7e82b5
Explain deployment policies and per-invocation key expiry
sjmiller609 Nov 19, 2026
952830a
Reconcile scoped permissions docs with current API and rollout
sjmiller609 Nov 23, 2026
6f50d86
Keep internal search permissions out of public docs
sjmiller609 Nov 23, 2026
734927d
Document scoped deployments without rollout prerequisites
sjmiller609 Nov 24, 2026
b20b9a3
Explain runtime permissions from the app’s perspective
sjmiller609 Nov 24, 2026
53a66f0
Preserve links to the former deployment key section
sjmiller609 Nov 24, 2026
37f82be
Clarify scoped permissions and testable API examples
sjmiller609 Nov 24, 2026
b7312fe
Document CLI project selection by name or ID
sjmiller609 Nov 24, 2026
a4fade1
Document action wildcards in API key policies
sjmiller609 Nov 24, 2026
8a50819
Note revocation delay when deleting API keys
sjmiller609 Nov 24, 2026
0071f0a
Use TypeScript and Python examples for app runtime policies
sjmiller609 Nov 25, 2026
5dcfaba
Clarify scoped app permissions and key delegation
sjmiller609 Nov 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apps/deploy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ kernel deploy github \
- The CLI automatically downloads and extracts the GitHub source code and uploads your app for deployment.
- For private repositories, provide a `--github-token` or set the `GITHUB_TOKEN` environment variable.

## Use a scoped API key

When you run `kernel deploy` with a scoped API key, the app gets only project-wide `invocations:write` to report results. Deployment succeeds, but browser calls from the app return `403`. The CLI has no runtime policy flag. To grant browser access, [deploy through the API with an explicit app runtime policy](/info/api-keys#app-runtime-policy).

## Environment variables

You can set environment variables for your app using the `--env` flag. For example:
Expand All @@ -71,7 +75,7 @@ kernel deploy my_app.py --env-file .env

Kernel injects a few environment variables into every deployment and its invocations. These names are **reserved** — if you set them via `--env` or `--env-file`, Kernel overrides your value, so setting them has no effect:

- `KERNEL_API_KEY` — a per-deployment API key Kernel mints at deploy time (see [Deployment API keys](/info/api-keys#deployment-api-keys)). The SDKs read it from the environment by default, so your app authenticates with this key automatically.
- `KERNEL_API_KEY` — the SDK uses this key automatically. For apps with a runtime policy, the key grants only the [app runtime permissions](/info/api-keys#app-runtime-policy).
- `ENTRYPOINT_RELPATH` — set by the platform to locate your entrypoint.

#### Using a different key for your app's calls
Expand Down
4 changes: 3 additions & 1 deletion browsers/telemetry/export.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Events are exported as OTLP **logs**. Kernel appends `/v1/logs` to your endpoint

## How export works

You create a **destination** - an OTLP/HTTP endpoint plus the headers your backend expects - and select it when you create a browser. Destinations belong to your organization, so a browser in any project can export to them.
You create a **destination** - an OTLP/HTTP endpoint plus the headers your backend expects - and select it when you create a browser. Use organization-scoped authentication to create the destination in the browser’s project. For a non-default project, set `X-Kernel-Project-Id` (CLI: `--project`). A key bound to that project can select the destination but can’t create it.

Kernel's relay forwards the session's events to the destination and attaches your headers at export time. Headers are encrypted at rest and never reach the browser VM, so a session can export to your backend without ever holding your ingestion key.

Expand Down Expand Up @@ -62,6 +62,8 @@ You can also manage destinations in the dashboard under **Telemetry Destinations

Creating, updating, and deleting a destination requires organization-scoped authentication, such as an organization-wide API key or the dashboard; a project-scoped API key gets a `403`. Project-scoped keys can still list and retrieve destinations, and select one when creating a browser.

For a key with a policy, grant `telemetry_destinations:read` to inspect a destination and `telemetry_destinations:use` to select it for export. Management uses the separate `create`, `write`, and `delete` actions. See the [telemetry policy example](/info/api-key-policy-examples) and [permission reference](/info/api-key-permissions#telemetry-destinations).

Header values are write-only. API, SDK, and CLI responses show each header name with an empty value, and the dashboard shows only header names: to change a stored value there, enter a replacement, or leave the field blank to keep the current value.

An organization can have up to 50 destinations. Names must match `^[a-zA-Z0-9._-]{1,255}$`, must be unique within the organization, and can't look like a Kernel ID. A destination can have up to 32 headers, with names and values totaling at most 8,192 bytes.
Expand Down
1 change: 1 addition & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@
},
"info/api-keys",
"info/api-key-permissions",
"info/api-key-policy-examples",
"info/audit-logs",
"info/network-access"
]
Expand Down
250 changes: 224 additions & 26 deletions info/api-key-permissions.mdx

Large diffs are not rendered by default.

269 changes: 269 additions & 0 deletions info/api-key-policy-examples.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
---
title: "API Key Policy Examples"
description: "Policies for browser automation, pools, managed auth, app execution, and administration"
---

Start with the example closest to your workload and keep only the permissions you need. Each snippet defines a `policy` value to pass to the [API key creation call](/info/api-keys#create-a-scoped-key). TypeScript and Python examples grant the same permissions.

The IDs below represent resources you've already created. Replace them with IDs returned by your own API requests; exact resource IDs are validated when you issue a key. Most examples fit a project-scoped key with `project_id: 'proj_staging_9f3k'`. Examples that include organization resources require an organization-scoped key.

For every available action and its prerequisites, see [API key permissions](/info/api-key-permissions).

<AccordionGroup>

<Accordion title="Manage one project">
Use an organization-scoped key to read organization limits and view or update one project. Omit `project_id` when issuing this key.

<CodeGroup>
```typescript TypeScript
const policy = {
statements: [
{ action: 'organizations:read', resource: 'organizations/org_8f3k9m2q' },
{ action: 'projects:read', resource: 'projects/proj_staging_9f3k' },
{ action: 'projects:write', resource: 'projects/proj_staging_9f3k' },
],
};
```

```python Python
policy = {
"statements": [
{"action": "organizations:read", "resource": "organizations/org_8f3k9m2q"},
{"action": "projects:read", "resource": "projects/proj_staging_9f3k"},
{"action": "projects:write", "resource": "projects/proj_staging_9f3k"},
],
}
```
</CodeGroup>

Add `projects:delete` on `projects/proj_staging_9f3k` to archive or restore the project. Create additional projects with `projects:create` on `organizations/org_8f3k9m2q/*`.
</Accordion>

<Accordion title="Create browsers with a saved extension">
Create and control browsers in the staging project using one saved extension.

<CodeGroup>
```typescript TypeScript
const policy = {
statements: [
{ action: 'browsers:create', resource: 'projects/proj_staging_9f3k/*' },
{ action: 'browsers:use', resource: 'projects/proj_staging_9f3k/*' },
{ action: 'extensions:use', resource: 'projects/proj_staging_9f3k/extensions/ext_9k4m2q7s' },
],
};
```

```python Python
policy = {
"statements": [
{"action": "browsers:create", "resource": "projects/proj_staging_9f3k/*"},
{"action": "browsers:use", "resource": "projects/proj_staging_9f3k/*"},
{"action": "extensions:use", "resource": "projects/proj_staging_9f3k/extensions/ext_9k4m2q7s"},
],
}
```
</CodeGroup>

Pass `ext_9k4m2q7s` in the browser request's `extensions` list. Include `extensions:use` on every saved extension attached to a browser you access.
</Accordion>

<Accordion title="Export browser telemetry">
Create browsers in staging and send their telemetry to one saved destination.

<CodeGroup>
```typescript TypeScript
const policy = {
statements: [
{ action: 'browsers:create', resource: 'projects/proj_staging_9f3k/*' },
{ action: 'browsers:use', resource: 'projects/proj_staging_9f3k/*' },
{ action: 'telemetry_destinations:read', resource: 'projects/proj_staging_9f3k/telemetry_destinations/tdst_8k2q4m6r' },
{ action: 'telemetry_destinations:use', resource: 'projects/proj_staging_9f3k/telemetry_destinations/tdst_8k2q4m6r' },
],
};
```

```python Python
policy = {
"statements": [
{"action": "browsers:create", "resource": "projects/proj_staging_9f3k/*"},
{"action": "browsers:use", "resource": "projects/proj_staging_9f3k/*"},
{"action": "telemetry_destinations:read", "resource": "projects/proj_staging_9f3k/telemetry_destinations/tdst_8k2q4m6r"},
{"action": "telemetry_destinations:use", "resource": "projects/proj_staging_9f3k/telemetry_destinations/tdst_8k2q4m6r"},
],
}
```
</CodeGroup>

When creating the browser, enable at least one telemetry source (for example, set `telemetry.browser.console.enabled` to `true`) and set `telemetry.export.otlp.destination` to `{"id": "tdst_8k2q4m6r"}`. Export without capture returns `400`. See the [complete browser request](/browsers/telemetry/export#export-a-sessions-telemetry).
</Accordion>

<Accordion title="Acquire pooled browsers">
Acquire and release browsers from one pool that uses a saved profile.

<CodeGroup>
```typescript TypeScript
const policy = {
statements: [
{ action: 'browser_pools:use', resource: 'projects/proj_staging_9f3k/browser_pools/pool_6m2k9q4s' },
{ action: 'browsers:use', resource: 'projects/proj_staging_9f3k/*' },
{ action: 'profiles:use', resource: 'projects/proj_staging_9f3k/profiles/prof_7h2kq9x4m1' },
],
};
```

```python Python
policy = {
"statements": [
{"action": "browser_pools:use", "resource": "projects/proj_staging_9f3k/browser_pools/pool_6m2k9q4s"},
{"action": "browsers:use", "resource": "projects/proj_staging_9f3k/*"},
{"action": "profiles:use", "resource": "projects/proj_staging_9f3k/profiles/prof_7h2kq9x4m1"},
],
}
```
</CodeGroup>

Use pool `pool_6m2k9q4s`, configured with profile `prof_7h2kq9x4m1`. If its browsers also carry vaults or saved extensions, grant use of those resources too. An acquire-time profile that saves changes also needs `profiles:write`.
</Accordion>

<Accordion title="Run an existing auth connection">
Read a connection and start logins using its saved profile and credential, including saving updated credential values.

<CodeGroup>
```typescript TypeScript
const policy = {
statements: [
{ action: 'auth_connections:read', resource: 'projects/proj_staging_9f3k/auth_connections/mconn_5k3m8q2r' },
{ action: 'auth_connections:use', resource: 'projects/proj_staging_9f3k/auth_connections/mconn_5k3m8q2r' },
{ action: 'profiles:use', resource: 'projects/proj_staging_9f3k/profiles/prof_7h2kq9x4m1' },
{ action: 'profiles:write', resource: 'projects/proj_staging_9f3k/profiles/prof_7h2kq9x4m1' },
{ action: 'credentials:use', resource: 'projects/proj_staging_9f3k/credentials/cred_4q8m2k6s' },
{ action: 'credentials:write', resource: 'projects/proj_staging_9f3k/credentials/cred_4q8m2k6s' },
],
};
```

```python Python
policy = {
"statements": [
{"action": "auth_connections:read", "resource": "projects/proj_staging_9f3k/auth_connections/mconn_5k3m8q2r"},
{"action": "auth_connections:use", "resource": "projects/proj_staging_9f3k/auth_connections/mconn_5k3m8q2r"},
{"action": "profiles:use", "resource": "projects/proj_staging_9f3k/profiles/prof_7h2kq9x4m1"},
{"action": "profiles:write", "resource": "projects/proj_staging_9f3k/profiles/prof_7h2kq9x4m1"},
{"action": "credentials:use", "resource": "projects/proj_staging_9f3k/credentials/cred_4q8m2k6s"},
{"action": "credentials:write", "resource": "projects/proj_staging_9f3k/credentials/cred_4q8m2k6s"},
],
}
```
</CodeGroup>

Use connection `mconn_5k3m8q2r`, configured with profile `prof_7h2kq9x4m1` and credential `cred_4q8m2k6s`. Provider-backed connections additionally require `credential_providers:use` on the organization-owned provider, so they need an organization-scoped key. If the connection must create a credential, grant container-wide `credentials:create`, `credentials:use`, and `credentials:write` instead of exact-ID credential grants.
</Accordion>

<Accordion title="Deploy and invoke an app">
Deploy and run an app in staging, and read its deployment and invocation results.

<CodeGroup>
```typescript TypeScript
const policy = {
statements: [
{ action: 'deployments:create', resource: 'projects/proj_staging_9f3k/*' },
{ action: 'deployments:delete', resource: 'projects/proj_staging_9f3k/*' },
{ action: 'deployments:read', resource: 'projects/proj_staging_9f3k/*' },
{ action: 'invocations:create', resource: 'projects/proj_staging_9f3k/*' },
{ action: 'invocations:write', resource: 'projects/proj_staging_9f3k/*' },
{ action: 'invocations:read', resource: 'projects/proj_staging_9f3k/*' },
],
};
```

```python Python
policy = {
"statements": [
{"action": "deployments:create", "resource": "projects/proj_staging_9f3k/*"},
{"action": "deployments:delete", "resource": "projects/proj_staging_9f3k/*"},
{"action": "deployments:read", "resource": "projects/proj_staging_9f3k/*"},
{"action": "invocations:create", "resource": "projects/proj_staging_9f3k/*"},
{"action": "invocations:write", "resource": "projects/proj_staging_9f3k/*"},
{"action": "invocations:read", "resource": "projects/proj_staging_9f3k/*"},
],
}
```
</CodeGroup>

Use this key to deploy and invoke the app. If you omit `runtime_policy`, the [app runtime policy](/info/api-keys#app-runtime-policy) grants only project-wide `invocations:write`, not the rest of the deploying key’s permissions. The next example adds browser access.
</Accordion>

<Accordion title="Invoke without deployment-management permissions">
Use an explicit runtime policy to give the app browser access without deployment-management permissions. This app creates browsers without saved profiles or other attached resources.

<CodeGroup>
```typescript TypeScript
const runtimePolicy = {
statements: [
{ action: 'invocations:write', resource: 'projects/proj_staging_9f3k/*' },
{ action: 'browsers:create', resource: 'projects/proj_staging_9f3k/*' },
{ action: 'browsers:use', resource: 'projects/proj_staging_9f3k/*' },
],
};

const invokerPolicy = {
statements: [
{ action: 'invocations:create', resource: 'projects/proj_staging_9f3k/*' },
...runtimePolicy.statements,
],
};
```

```python Python
runtime_policy = {
"statements": [
{"action": "invocations:write", "resource": "projects/proj_staging_9f3k/*"},
{"action": "browsers:create", "resource": "projects/proj_staging_9f3k/*"},
{"action": "browsers:use", "resource": "projects/proj_staging_9f3k/*"},
],
}

invoker_policy = {
"statements": [
{"action": "invocations:create", "resource": "projects/proj_staging_9f3k/*"},
*runtime_policy["statements"],
],
}
```
</CodeGroup>

Send the runtime policy as JSON in the `runtime_policy` multipart field of `POST /deployments`. The deploying key needs every runtime permission plus `deployments:create` and `deployments:delete` on the project. Issue a separate key with the invoker policy to start actions without deployment-management access.

A supplied runtime policy with only `browsers:create` and `browsers:use` is rejected with `400`: it must explicitly include project-wide `invocations:write`. Permissions aren't silently added.

A key with only `invocations:create` can't invoke this app: it doesn't cover the runtime's browser and callback permissions. Add `invocations:read` to read results and `deployments:read` as well to read the event stream.
</Accordion>

<Accordion title="Inspect keys and audit activity">
Read staging API-key metadata, read organization audit logs, and look up browser configuration recommendations. Issue this as an organization-scoped key by omitting `project_id`. For configuration registry requests, send `X-Kernel-Project-Id: proj_staging_9f3k` to select the project named in the policy.

<CodeGroup>
```typescript TypeScript
const policy = {
statements: [
{ action: 'api_keys:read', resource: 'projects/proj_staging_9f3k/*' },
{ action: 'audit_logs:read', resource: 'organizations/org_8f3k9m2q/*' },
{ action: 'config_registry:read', resource: 'projects/proj_staging_9f3k/*' },
],
};
```

```python Python
policy = {
"statements": [
{"action": "api_keys:read", "resource": "projects/proj_staging_9f3k/*"},
{"action": "audit_logs:read", "resource": "organizations/org_8f3k9m2q/*"},
{"action": "config_registry:read", "resource": "projects/proj_staging_9f3k/*"},
],
}
```
</CodeGroup>

API-key reads return metadata and policies. Creating delegated keys requires `api_keys:create` on their container plus the permissions you intend to delegate; rotating keys requires `api_keys:rotate` and coverage of their policy.
</Accordion>
</AccordionGroup>
Loading
Loading