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.
| Scope | What it allows |
|---|---|
sandboxes:read | Get and list sandboxes, their groups and operations; read the catalog; list a sandbox's ports and what listens, and read its SSH endpoint. |
sandboxes:write | Create, 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:exec | Run, 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:read | Read and list a sandbox's files. |
files:write | Write, move, remove files and make folders in a sandbox. |
snapshots:write | Make, list and delete snapshots. |
usage:read | Read metered usage. |
keys:write | List 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:write | List and make projects. |
members:read | Read the organization, its members, their roles and its invitations, and the list of roles. |
end_users:read | Get and list end users and their limits. |
end_users:write | Make or find an end user by your own id, and set its limits. |
screen:read | Describe a sandbox's screen, take screenshots, read its accessibility tree, watch its stream, and list its watch links and recordings. |
screen:write | Send actions to a sandbox's screen, take it over (a person), make and revoke watch links, and start and stop recordings. |
webhooks:read | List and get webhooks and read each one's delivery log. |
webhooks:write | Make, change and remove webhooks, rotate a webhook's secret and replay its events. |
permissions:read | Read policies, connected tools, bindings and approval requests; check a change and run the connection test. |
permissions:write | Bind 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:records | Query and export the record. |
ci:read | Read Pod CI's repositories, runs, jobs, runners and CI usage. |
ci:write | Change Pod CI through its API: start and stop QA runs, delete cache entries and connect GitHub (a person). |
network:read | Read the network settings and entitlements, custom domains, static addresses, private ranges, proxies and a sandbox’s way out. |
network:write | Claim, 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.
| Preset | What it is for | Scopes |
|---|---|---|
read_only | Reads 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_sandbox | Makes, 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 |
ci | What 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 |
admin | Every 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:
| Role | What it may do |
|---|---|
owner | Everything an admin can do, and owners themselves: makes, changes and removes owners. An organization always keeps one. |
admin | Every call in every project. Invites, changes and removes admins, members and viewers, never an owner. |
member | Every call in the projects they are given, or every project when none are named. Revokes only keys they made. |
viewer | Reads 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.