Skip to main content
Use a Box API key for Docker images, servers, CI jobs, and hosted workers. Create and store the key as BOX_API_KEY; see API Keys for setup, rotation, and deletion.

Docker image

Install the Box CLI and OpenSSH client in the image. Authenticate at runtime.
Debian / Ubuntu
Alpine

Runtime login

Run box login before the first Box command in your process:
For a Railway start command, use the same pattern:
If your app starts Boxes directly, keep login in the entrypoint:
box login "$BOX_API_KEY" --json emits:
For scripts, prefer --json on login too. It keeps stdout machine-readable and makes failed auth return the standard JSON error line. See API Keys for key setup guidance.

JSON and JSONL

Most read/update commands emit one JSON object:
Long-running commands emit JSON Lines:
Each line is a complete JSON object with an event field. Most runtime failures in --json mode emit a final {"event":"error",...} line. Argument parsing errors can still be emitted by the CLI parser on stderr before Box’s JSON error handler runs. See Use in Code for exact schemas, error formats, and parsers. When every user of your product needs a Box with the same stack pre-installed, build it once and fork it per user. See Template Boxes. For secrets used inside Boxes, see Secrets & Setup.