Keys and projects

Test and live keys, scopes, projects, members and roles

Keys

Every call carries a key except four: Check that the API answers, the catalog, starting a sign-up and reporting abuse. A key goes in Authorization:

curl "https://api.pod.mapier.ai/v1/sandboxes" -H "Authorization: Bearer $POD_API_KEY"

A key belongs to one project and comes in two modes. A test key starts pod_test_ and sees only test sandboxes; a live key starts pod_live_ and sees only live ones. Keep both out of your code and out of any page a browser loads: the SDKs and mpod read POD_API_KEY from the environment.

Make keys in the dashboard. Making one needs a signed-in person with a fresh second factor, so no key can make another. Pod keeps only a hash: a key is shown once. Revoke one and it stops working everywhere within a minute.

Rotating a key

Rotate a key to give it a new secret without changing its id, scopes or project. The new secret is shown once. The old secret keeps working for an hour by default (overlap_s), up to 7 days; 0 ends it at once. Deploy the new secret within that time and nothing is refused in between. Each key shows when it was last used, to the minute, so you can tell a key nobody uses before you revoke it.

Scopes

A key holds only the scopes it was given. A call names the one it needs on its page, and a key without it is refused with forbidden.

ScopeWhat it allows
sandboxes:readGet and list sandboxes, their groups and operations; read the catalog; list a sandbox's ports and what listens, and read its SSH endpoint.
sandboxes:writeCreate, delete, sleep, wake, stop, start, resize, extend, fork and report activity; set a port's visibility and name, make its token and share links.
sandboxes:execRun, read and end commands in a sandbox, and make stream tickets for their streams; connect to its ports (the tunnel, a port URL opened with a key) and sign in by SSH.
files:readRead and list a sandbox's files.
files:writeWrite, move, remove files and make folders in a sandbox.
snapshots:writeMake, list and delete snapshots.
usage:readRead metered usage.
keys:writeList and revoke keys, and make, list and revoke a sandbox's keys. Making a person's key also needs a person with a fresh second factor.
projects:writeList and make projects.
members:readRead the organization, its members, their roles and its invitations, and the list of roles.
end_users:readGet and list end users and their limits.
end_users:writeMake or find an end user by your own id, and set its limits.
screen:readDescribe a sandbox's screen, take screenshots, read its accessibility tree, watch its stream, and list its watch links and recordings.
screen:writeSend actions to a sandbox's screen, take it over (a person), make and revoke watch links, and start and stop recordings.
webhooks:readList and get webhooks and read each one's delivery log.
webhooks:writeMake, change and remove webhooks, rotate a webhook's secret and replay its events.
permissions:readRead policies, connected tools, bindings and approval requests; check a change and run the connection test.
permissions:writeBind a policy to a new sandbox, add rules for one sandbox beneath the ceiling, narrow a running sandbox, revoke a tool, pull the cut-off switch and ask for a draft.
permissions:recordsQuery and export the record.
ci:readRead Pod CI's repositories, runs, jobs, runners and CI usage.
ci:writeChange Pod CI through its API: start and stop QA runs, delete cache entries and connect GitHub (a person).
network:readRead the network settings and entitlements, custom domains, static addresses, private ranges, proxies and a sandbox’s way out.
network:writeClaim, point, check and remove custom domains; take and release static addresses; register and remove private ranges in your own cell; add, replace and remove proxies; set a sandbox’s way out.

Presets

The Create key dialog, the presets call and the SDKs offer ready-made sets. A preset only fills in the scopes: the key keeps its scopes, not the preset's name.

PresetWhat it is forScopes
read_onlyReads sandboxes, files, usage, members, end users, policies and CI runs. Changes nothing.sandboxes:read, files:read, usage:read, members:read, end_users:read, permissions:read, ci:read
full_sandboxMakes, runs and changes sandboxes, their files and snapshots. No keys, projects or members.sandboxes:read, sandboxes:write, sandboxes:exec, files:read, files:write, snapshots:write
ciWhat a CI job needs: sandboxes, commands, files and snapshots, and reading CI runs.sandboxes:read, sandboxes:write, sandboxes:exec, files:read, files:write, snapshots:write, ci:read
adminEvery scope offered now. Use it for a key that manages the project itself.sandboxes:read, sandboxes:write, sandboxes:exec, files:read, files:write, snapshots:write, usage:read, keys:write, projects:write, members:read, end_users:read, end_users:write, screen:read, screen:write, webhooks:read, webhooks:write, permissions:read, permissions:write, permissions:records, ci:read, ci:write, network:read, network:write

Sandbox keys

A program inside a sandbox often needs to manage that sandbox: read and write its files, sleep it, fork it, open its ports. Give it a sandbox key instead of your own:

  • It holds at most the scopes of the key or person that made it, and only scopes on a sandbox (sandboxes:*, files:*, snapshots:write).
  • It is taken only from that sandbox and reaches only it and the sandboxes forked from it.
  • It lives from 60 seconds to 30 days, 24 hours by default, and is revoked with its sandbox, with the key that made it, and by hand (revoke one).

Making one needs keys:write but no second factor, so a platform makes one for each sandbox it creates. Pass it in the environment of the commands you run there, as POD_SANDBOX_KEY: the SDKs and mpod read POD_API_KEY first, then POD_SANDBOX_KEY, so the program needs no argument. Environment values are never logged.

Projects

A project groups sandboxes, keys and usage. Each key sees only its own project's sandboxes; a signed-in person sees every project their role reaches. Make a project for each app or environment you want to keep apart, and set its default idle time there. Change a project to rename it or change the idle time of sandboxes made from then on. Deleting a project revokes its keys; see Data and privacy.

Members and roles

People join an organization by invitation, from the dashboard. Each member has one role:

RoleWhat it may do
ownerEverything an admin can do, and owners themselves: makes, changes and removes owners. An organization always keeps one.
adminEvery call in every project. Invites, changes and removes admins, members and viewers, never an owner.
memberEvery call in the projects they are given, or every project when none are named. Revokes only keys they made.
viewerReads sandboxes, files, usage, members, end users, webhooks, policies, CI runs and network settings in their projects. Makes no key and changes nothing.

Changing members, roles and invitations is for people only, each time with a fresh second factor. No API key can do it, whatever its scopes: such calls answer person_required.

An owner or admin can also cap one member: how many sandboxes they may hold and keep awake. The sandboxes a member made, with a key they made or signed in, count against it.

A browser never holds a key

A page that shows a command's output opens its stream with a stream ticket: your server, which holds the key, asks for a single-use ticket bound to that one stream and to your page's origin, and hands only the ticket to the page. A ticket lives 30 seconds by default, 60 at most, and opens its stream once. See Make a stream ticket and the SDK guides.