mpod

Every call of Pod's API from your terminal, with the mpod command

mpod is Pod's command line. It comes with Pod Console: install the desktop app or the headless install as Add your machines shows, and mpod is on your path. Its Pod Console commands are in the CLI reference; mpod sandboxes is the API.

export POD_API_KEY=pod_test_…
mpod sandboxes create --system linux
mpod sandboxes list
mpod sandboxes exec sbx_… -- uname -a

mpod reads the key from POD_API_KEY and the address from POD_API_URL, https://api.pod.mapier.ai by default. It keeps no store of keys, and never prints or logs one.

Output

A table for people; the API's own JSON with --json, or when its output is a pipe. files read writes the file's bytes, and exec the command's output, either way.

Waiting and retries

A command that changes a sandbox waits for the change, 60 seconds by default and 300 at most (--wait-timeout-s); --no-wait prints the operation instead. Every command that changes something sends one idempotency key, and sends the call again with it after an error the error list allows, up to --retries times. --idempotency-key gives your own, to repeat a command safely.

exec leaves with the command's exit code as its own, or 128 plus the signal's number when a signal ended it. Ctrl-C sends INT to the command; a second one leaves at once.

Errors

An error prints its name from the error list, its message with the request_id, and a hint. The exit code is 3 for not_found, 5 for unavailable, 2 for a mistake in the command, and 1 for the rest.

Commands

CommandWhat it does
mpod sandboxes healthCheck that the API answers
mpod sandboxes catalogList the sizes, systems, classes and regions on offer
mpod sandboxes listList sandboxes
mpod sandboxes createCreate a sandbox
mpod sandboxes get <sandbox>Get a sandbox
mpod sandboxes delete <sandbox>Delete a sandbox
mpod sandboxes sleep <sandbox>Put a sandbox to sleep
mpod sandboxes wake <sandbox>Wake a sandbox
mpod sandboxes stop <sandbox>Stop a sandbox
mpod sandboxes start <sandbox>Start a stopped sandbox
mpod sandboxes resize <sandbox> <size>Change a sandbox's size
mpod sandboxes extend <sandbox> <time_limit_s>Set the time a running sandbox has left
mpod sandboxes activity <sandbox>Report activity, for idle sleep
mpod sandboxes snapshot <sandbox>Snapshot a sandbox
mpod sandboxes fork <sandbox>Fork a running sandbox into copies
mpod sandboxes exec <sandbox> -- <program>Run a command in a sandbox
mpod sandboxes commands get <sandbox> <operation>Get a command's status
mpod sandboxes commands kill <sandbox> <operation>End a command
mpod sandboxes commands attachAttach to a command's output and input
mpod sandboxes commands ticket <sandbox> <operation> --origin <origin>Make a ticket that lets a browser open a command's stream
mpod sandboxes files read <sandbox> <path>Read a file
mpod sandboxes files write <sandbox> <path>Write a file
mpod sandboxes files rm <sandbox> <path>Remove a file or folder
mpod sandboxes files list <sandbox> <path>List a folder
mpod sandboxes files mv <sandbox> <from> <to>Move or rename a file or folder
mpod sandboxes files mkdir <sandbox> <path>Make a folder
mpod sandboxes snapshots listList snapshots
mpod sandboxes snapshots get <snapshot>Get a snapshot
mpod sandboxes snapshots delete <snapshot>Delete a snapshot
mpod sandboxes operations get <operation>Get an operation started by a 202
mpod sandboxes usageRead metered usage
mpod sandboxes keys listList API keys
mpod sandboxes keys createMake an API key
mpod sandboxes keys revoke <key>Revoke an API key
mpod sandboxes projects listList projects
mpod sandboxes projects create <name>Make a project