Llim.run

Permissions and access tokens

Permissions define what a credential can do. Use this reference when choosing API-key permissions, creating an access token, or assigning a workload role. The same permission syntax appears in all three places, but each accepts different grants.

Permission syntax

A permission is resource:target:action, such as android:android_euna_01h455vb4pex5vsknk084sn02q:all or asset:name/releases/app.ipa:read.

The fields have these meanings:

FieldMeaning
resourceA resource name from the tables below. Organization admin roles can also grant *:*:all.
targetA resource ID, * for all resources of that kind in the organization, or name/<name-or-pattern> for assets. Each credential type restricts which targets it accepts.
actionAn operation such as read or upload. all includes every action for that resource. The action wildcard is spelled all, never *.

Use IDs exactly as the API returns them. The first and last colons separate the fields, so an asset name can contain colons. Names are literal, without percent encoding. Asset patterns support case-sensitive * and ?, including across slashes and colons. See asset permission targets.

Instance types

Each instance type has its own permission resource. Xcode IDs use sandbox_, but their permission resource is xcode.

Instance typePermission resourceID prefixAccess-token grant
iOS simulatoriosios_ios:<instance-id>:stream or ios:<instance-id>:control
Android emulatorandroidandroid_android:<instance-id>:stream or android:<instance-id>:control
Xcode sandboxxcodesandbox_xcode:<instance-id>:control
Gradle sandboxgradlegradle_gradle:<instance-id>:control

Instance actions have different uses and issuance rules:

ActionInstance typesWhat it permitsAccepted by access-token create?
readAll fourRead instance records and supported persisted logs or snapshots, without control credentials.Yes.
streamiOS, AndroidInteractive screen streaming and supported viewer actions.Yes, for an instance ID or *.
controlAll fourRead the instance and use its runtime endpoints, without creating, updating, or deleting instance records.Yes, for an instance ID or *.
createAll fourCreate an instance. The response includes a control token for the new instance.Yes, with target *.
updateAll fourUpdate instance labels, role, secret references, or an Xcode cache key. Changing the role also requires authority over every supplied permission.Yes, for an instance ID or *.
deleteAll fourDelete an instance.Yes, for an instance ID or *.
allAll fourEvery supported instance action, including control and lifecycle management.Yes, for an instance ID or *.
workXcode, GradleStart a sandbox as a remote build worker, without general sandbox control.Yes.
tunneliOS, AndroidAccess the instance's destination tunnel endpoints, without device control or streaming.Yes.

The instance action tunnel differs from the resource permission tunnel:<tunnel-id>:connect, which lets a connector join a private tunnel. See Private tunnels.

Using reuseIfExists also requires control on the matched instance. A create-only credential receives 403 if a matching instance exists. Binding an Xcode cache key after creation requires xcode:<instance-id>:update; the default instance token cannot bind it.

The default status.token grants <resource>:<instance-id>:control. It can operate that instance and read its record, but cannot create, update, or delete instance records. read, update, and delete alone do not return control credentials. Existing all grants retain their full access.

An access token can use the same operations as an API key when its permissions cover the operation. A named instance grant permits only its specified action on that instance. control includes reads, runtime endpoints, streaming, and the applicable work or tunnel action. An ios:*:all grant also permits listing and creating iOS instances. Updating a role additionally requires authority to delegate its permissions. For example, ios:*:update cannot add secret:name/signing:read unless the caller also holds that secret permission. Secret references do not grant access themselves. A client that can run code in an instance can use secrets already granted to that instance. Member-session requirements for organization administration still apply.

For iOS and Android, stream grants interactive streaming: screen viewing, touch, typing, and other supported viewer actions. It does not grant app installation, explicit app launch or termination, the device API, or ADB. Supply the instance's status.endpointWebSocketUrl alongside the token to a streaming client. A stream grant does not permit fetching the instance record to discover this URL. control and all include stream.

The instance response also includes status.streamToken for streaming-only access. Use the returned expiry fields to determine its lifetime. Xcode and Gradle have no device screen stream.

Access-token permissions

POST /v1/access_tokens, lim access-token create, and lim.accessTokens.create() accept the following permissions when called with an API key, login session, or access token. Every permission must be covered by the caller's grants. The caller also needs accesstoken:*:all to create or revoke access tokens.

ResourceAccepted targetAccepted actionsWhat the token permits
iosiOS instance ID or *read, control, create, update, delete, stream, watch, tunnel, allcontrol operates the instance; lifecycle actions manage instance records.
androidAndroid instance ID or *read, control, create, update, delete, stream, watch, tunnel, allcontrol operates the instance; lifecycle actions manage instance records.
xcodeXcode instance ID or *read, control, create, update, delete, stream, work, allcontrol operates the instance; lifecycle actions manage instance records.
gradleGradle instance ID or *read, control, create, update, delete, stream, work, allcontrol operates the instance; lifecycle actions manage instance records.
assetAsset ID, name/<name-or-pattern>, or *read, create, upload, update, delete, allPerform the asset operations described below. create requires a name target or *.
device*installStart physical-device installation sessions. Also requires asset:<target>:read for the asset being installed.
applerelay*connectOpen the Apple Account authentication relay. Apple credentials remain separate.
remotecache*read, allRead Bazel cache entries and blobs; all also permits writing cache entries and blobs.
remoteexecution*allRun actions through the Bazel remote execution service.

Instance grants accept concrete IDs or *. Access tokens also accept secret, tunnel, and accesstoken grants when held by the caller. Asset permissions apply to assets used by any instance type. device refers to installation on physical devices, not iOS simulators or Android emulators. The cache and remote execution permissions belong to the organization's Bazel service, not to one sandbox.

These are the asset actions:

ActionEffect
readRead asset metadata and obtain download URLs. Listing requires a grant covering the requested selection.
createCreate an asset record at a name that does not yet exist. Does not permit uploading bytes by itself.
uploadObtain upload URLs and upload bytes to an asset. Add create if the asset may not exist yet.
updateChange asset metadata, such as its display name or expiry.
deleteDelete the asset.
allAll asset actions for the target.

Delegating an asset name pattern containing * or ? requires asset:*:<action> or a broader grant. A credential holding only a name pattern can delegate matching concrete names, but cannot delegate another pattern, even an identical one.

Create and revoke

The CLI supports repeated --permission flags:

lim access-token create \
  --permission "android:$INSTANCE_ID:control" \
  --ttl-seconds 900 \
  --json

lim access-token revoke "$TOKEN_ID"
# Or pass the token itself:
lim access-token revoke "$ACCESS_TOKEN"

--json returns the API response, including id, token, permissions, and expiresAt. Save id for revocation. --quiet prints only the token value; --quiet --json keeps the JSON response. CLI revocation accepts either the ID or the lim_st_... token value. For a token, it extracts the JWT jti and sends that ID to the API, authenticated with your API key or login. Tokens without a jti, such as status.token and status.streamToken, cannot be revoked this way. The SDK and REST revoke methods still take an ID.

To grant only interactive streaming, use stream for an iOS or Android instance:

lim access-token create \
  --permission "ios:$INSTANCE_ID:stream" \
  --ttl-seconds 900 \
  --json

The TypeScript SDK exposes the same operations:

import Limrun from '@limrun/api';

const lim = new Limrun(); // Reads LIM_API_KEY.
const access = await lim.accessTokens.create({
  permissions: [`xcode:${instance.metadata.id}:control`],
  ttlSeconds: 900,
});

// Supply instance.status.apiUrl and access.token to the sandbox client.
// When this credential is no longer needed:
await lim.accessTokens.revoke(access.id);

For REST clients, create with POST /v1/access_tokens and revoke with DELETE /v1/access_tokens/{id}. Authenticate both calls with your customer credential in the Authorization: Bearer ... header. The create body uses permissions and optional ttlSeconds.

Lifetime and revocation

Tokens created with an API key, login session, or access token default to 3,600 seconds and cannot outlive that credential. ttlSeconds accepts integers from 1 through 14,400. Limrun instance identity exchanges default to 600 seconds and accept only shorter lifetimes. External federation uses the binding lifetime, capped by the source JWT expiry.

Revocation applies to the individual token ID. It leaves the minting API key, other access tokens, and running instances unchanged. Already-issued child tokens remain valid, but each descendant is capped by its parent's expiry. Repeated delegation cannot extend the original token's lifetime. Repeating a revoke call is safe.

The management and registry APIs reject revoked tokens once the revocation has propagated. Instance endpoints verify tokens offline and do not check revocation. They continue accepting an otherwise valid access token until it expires or the instance terminates. Revocation does not close an existing connection. Choose the lifetime with these limits in mind.

A token can revoke itself with DELETE /v1/access_tokens at https://sts.limrun.com, using that token in the Authorization Bearer header. Self-revocation requires no accesstoken permission. Revoking another token by ID requires that permission.

Organization roles and API keys

Organization membership has three built-in roles: admin, member, and viewer. Admin has *:*:all. The following table lists each role's grants; all includes read where supported. A dash means the role has no grant for that resource.

ResourceWhat it governsAdminMemberViewer
ios, android, xcode, gradleInstance records, lifecycle, control, and supported logs or snapshotsallallread
assetAsset metadata and stored filesallallread
secretStored signing secrets; read lists metadata, all also reads secret contents and writes or deletes secretsallall—
apikeyList, create, and delete API keysallall—
accesstokenCreate and revoke access tokensallall—
devicePhysical-device installationinstallinstall—
applerelayApple Account relay connectionsconnectconnect—
remotecacheRead or write the organization's Bazel cacheallallread
remoteexecutionExecute Bazel actionsallall—
supportOrganization support tickets: open tickets, read conversations, and replyallallread
analyticsUsage analyticsreadreadread
organizationOrganization settings, domains, SSO, provisioning, and webhooksallreadread
memberOrganization members and invitationsallreadread
billingGrants no access. Billing access comes from billing account roles, not organization rolesall——
tunnelList private tunnels; all also creates, updates, deletes, and issues connector tokensallreadread
nodepoolList node pools; all also creates, resizes, and deletes themallreadread

API keys and CLI login credentials receive their creator's permission bundle without organization, member, billing, or API-key administration permissions, or a requested subset. They use * targets; per-instance IDs belong to access tokens. Explicit stream and tunnel actions are not accepted in API-key permission requests.

API keys and access tokens use the same operation permissions. API-key administration and organization membership operations require a member session, and billing operations require a signed-in console session. An API key cannot administer other API keys just because its bundle contains apikey:*:all.

The tunnel:<tunnel-id>:connect permission authorizes a private-tunnel connector. Tunnel credentials come from private-tunnel create and rotate operations, not the access-token create endpoint. Issuing them requires an API key or member session with the required tunnel permission. Access tokens cannot issue these long-lived credentials, including during tunnel creation.

Workload roles

All four instance types accept an inline spec.role.permissions array. This grants the workload access to other resources. It does not limit a separate credential supplied to a process, and it does not change who can control the instance.

Workload roles currently accept only the asset permissions listed above. Named role references such as admin or viewer are not supported. An explicit role: { permissions: [] } grants nothing. Omitting the role uses the organization's compatibility default, so use an explicit list to choose access deliberately.

Code inside a workload can exchange its identity for an access token carrying its current role or a nonempty subset. It cannot expand its role or renew using the access token alone. See Instance roles for creation, updates, and exchanges.

Compatibility names

Use accessTokens, /v1/access_tokens, and permissions in new integrations. The deprecated SDK property scopedTokens, REST path /v1/scoped_tokens, request field scopes, and permission resource scopedtoken remain compatibility aliases. They refer to access tokens. If a request supplies both permissions and scopes, their sets must match.