1p is an independent Go CLI for remotely operating one or more 1Panel V2 instances through /api/v2. 1pctl manages the local 1Panel process; 1p manages panel resources over HTTP.
Build with Go 1.26 or newer:
make test
go install github.com/liyown/1panel-cli@latestCreate an API key in the 1Panel API settings, then keep it out of shell history:
1p context add production --server https://panel.example.com --api-key-stdin
1p context use productionThe key is stored in the system Keychain when available. The fallback is a separate credentials.yaml with mode 0600; it is never written into config.yaml.
1p version
1p context list
1p node list
1p website list --all
1p website restart example.com
1p container inspect nginx -o json
1p container logs nginx --tail 100 --follow
1p app search redis
1p app install redis --name redis-main --set port=6379 --wait
1p task wait TASK_ID --logs
1p api get /api/v2/dashboard/base/os --query key=valueUse --node node-01 to target a remote node. Resource resolvers require an exact ID or name and reject ambiguity. Query output supports table, json, yaml, name, and Go template; stdout contains results only, while errors and warnings use stderr.
CLI flags override ONEPANEL_CONTEXT, ONEPANEL_BASE_URL, ONEPANEL_API_KEY, ONEPANEL_NODE, ONEPANEL_TIMEOUT, ONEPANEL_INSECURE_SKIP_TLS_VERIFY, and ONEPANEL_OUTPUT, which override the current Context. JSON remains suitable for jq. Dangerous future operations require --yes when stdin is not a TTY.
TLS verification is enabled by default. --insecure-skip-tls-verify permits man-in-the-middle attacks and should only be used for controlled development systems.
Container follow uses the server's real SSE endpoint and stops immediately when its context is canceled. The current website-log API is paged JSON and does not support --follow or --since; the CLI reports that limitation instead of simulating an unreliable stream.
Compatibility was verified against 1Panel dev-v2 commit 97d383ed122c (2026-07-28). Multi-node listing is a Pro/Core endpoint; Community installations can still operate the local Agent resources.
make generate
make test
make vet
make buildOptional non-destructive integration tests use ONEPANEL_TEST_BASE_URL and ONEPANEL_TEST_API_KEY. See architecture, API compatibility, command design, and development.