Feature: Play Custom App Publishing API integration (playcustomapp/v1)
Summary
Add support for the Google Play Custom App Publishing API (playcustomapp/v1), enabling creation and publishing of permanently private Android apps to managed Google Play for enterprise customers directly from the CLI.
Why this is applicable to Google Play
The Play Custom App Publishing API serves a distinct enterprise use case: managed Google Play for organizations using EMM (Enterprise Mobility Management). Custom apps are permanently private apps that can only be distributed within a specific organization's managed Google Play store. Unlike the standard Android Publisher API workflow, custom apps go through a streamlined verification process and appear in the managed Play Store within ~5 minutes of publishing. This API is used by EMMs, IT admins, and enterprise developers who need to deploy internal-only apps without touching the Play Console UI.
Problem
The gplay CLI currently covers the standard Android Publisher API (androidpublisher/v3) comprehensively — tracks, releases, bundles, APKs, listings, etc. However, there is no support for the Custom App Publishing API, which is a separate Google API (playcustomapp/v1) with its own endpoint (playcustomapp.googleapis.com). Enterprise users who manage custom/private apps for their organizations must fall back to the Play Console UI or write custom scripts. Adding this closes the gap for enterprise/managed Google Play workflows.
Goals
- Provide a
gplay custom-appscommand group for managing custom enterprise apps - Support creating (publishing) a new custom app with APK upload in a single command
- Support scoping custom apps to specific organizations
- Follow existing CLI patterns (JSON-first output,
--dry-run, upload timeouts, flag validation) - Introduce a dedicated client wrapper for the
playcustomapp/v1API alongside the existingplayclient
Proposed Commands
gplay custom-apps create
Create and publish a new permanently private custom app to managed Google Play.
gplay custom-apps create \
--account <developer-account-id> \
--title "My Internal App" \
--language en-US \
--apk /path/to/app.apk \
--organization-id <org-id> \
--organization-name "Acme Corp" \
--output json
Flags:
| Flag | Required | Description |
|---|---|---|
--account |
Yes | Developer account ID (numeric, from Play Console URL) |
--title |
Yes | App title (must be unique within the developer account) |
--language |
No | Default listing language in BCP 47 format (default: en-US) |
--apk |
Yes | Path to APK file to upload (max 100 MB) |
--organization-id |
No | Organization ID to grant access (repeatable for multiple orgs) |
--organization-name |
No | Human-readable org name (paired with --organization-id) |
--output |
No | Output format: json (default), table, markdown |
--pretty |
No | Pretty-print JSON output |
Output (JSON):
{
"packageName": "com.example.internal.app",
"title": "My Internal App",
"languageCode": "en-US",
"organizations": [
{
"organizationId": "C0123wxyz",
"organizationName": "Acme Corp"
}
]
}
gplay custom-apps (group)
Parent command that lists subcommands.
gplay custom-apps --help
Note on updates: Updating an existing custom app (uploading a new APK version) uses the standard Android Publisher API edits workflow, which is already supported via
gplay release,gplay edits,gplay bundles upload, andgplay apks upload. Theplaycustomapp/v1API only handles initial creation. The--helptext forcustom-appsshould mention this and cross-reference the existing commands.
Implementation Details
API Endpoints
- Upload URI (multipart):
POST https://playcustomapp.googleapis.com/upload/playcustomapp/v1/accounts/{account}/customApps - Metadata URI:
POST https://playcustomapp.googleapis.com/playcustomapp/v1/accounts/{account}/customApps - Upload protocol: Multipart (
uploadType=multipart) — APK binary + JSON metadata in a single request - Max upload size: 100 MB
- Accepted MIME types:
application/octet-stream,application/vnd.android.package-archive
Authentication Requirements
- OAuth2 scope:
https://www.googleapis.com/auth/androidpublisher(same scope already used byplayclient) - The service account must have "Create and publish private apps" permission granted in Play Console
- The existing credential resolution in
playclientcan be reused since the scope is identical
New Packages/Files
internal/
├── cli/
│ └── customapps/
│ ├── customapps.go # Command group definition
│ ├── customapps_test.go # Command group tests
│ ├── create.go # Create subcommand
│ └── create_test.go # Create subcommand tests
├── customappclient/
│ ├── client.go # playcustomapp/v1 service wrapper
│ └── client_test.go # Client tests
Client Implementation Notes
Create internal/customappclient/client.go as a thin wrapper around the Go client library:
import "google.golang.org/api/playcustomapp/v1"
- The
playcustomapp/v1package is part ofgoogle.golang.org/api(already at v0.272.0 ingo.mod), so no new top-level dependency is needed — just import the sub-package - Mirror the
playclient.Servicepattern: struct wrapping the API service + config, with aNewService(ctx)constructor - Reuse
playclient's credential resolution logic (extract the HTTP client creation into a shared helper, or call intoplayclientfor the authenticated*http.Client) - Support
--dry-runby wrapping the transport withshared.DryRunTransport, same asplayclient
Upload Handling
- Use
shared.ContextWithUploadTimeoutfor the upload context (respectsGPLAY_UPLOAD_TIMEOUT) - The Go client's
AccountsCustomAppsCreateCall.Media(r io.Reader)handles multipart upload automatically - Validate APK file exists and is readable before initiating the API call
- Validate file size does not exceed 100 MB
- Validate file extension is
.apk(the API does not support AAB for custom apps)
Output Format
- JSON (minified) by default — serialize the returned
CustomAppobject - Table format: single row with columns
Package Name,Title,Language,Organizations - Markdown format: same columns as table
- Use existing
shared.PrintResult/ output formatting helpers
Registry Registration
Add to internal/cli/registry/registry.go:
import "github.com/tamtom/play-console-cli/internal/cli/customapps"
// In Subcommands():
customapps.CustomAppsCommand(),
Acceptance Criteria
- [ ]
gplay custom-apps --helpdisplays the command group with available subcommands - [ ]
gplay custom-apps create --helpdisplays all flags with descriptions - [ ]
gplay custom-apps createvalidates required flags (--account,--title,--apk) and prints actionable errors to stderr - [ ]
gplay custom-apps createuploads an APK and creates a custom app via theplaycustomapp/v1API - [ ]
gplay custom-apps create --organization-idcorrectly scopes the app to the specified organization(s) - [ ]
gplay custom-apps create --dry-runlogs the request to stderr without executing - [ ]
gplay custom-apps create --output tableand--output markdownproduce formatted output - [ ]
gplay custom-apps create --prettypretty-prints JSON output - [ ] APK file validation: rejects missing files, non-
.apkextensions, and files exceeding 100 MB - [ ] Upload uses
shared.ContextWithUploadTimeoutto respectGPLAY_UPLOAD_TIMEOUT - [ ]
customappclient.NewServicereuses existing credential resolution (service account / OAuth) - [ ] Unit tests cover flag validation, error paths, and output formatting
- [ ] Integration test structure exists (can be skipped in CI without credentials)
- [ ] Command registered in
registry.go - [ ]
gplay docs generateincludes the new command group
References
Implementation Checklist
Command & Registration
- [ ] Command group
gplay custom-appsininternal/cli/customapps/ - [ ] Registered in
internal/cli/registry/registry.go - [ ]
UsageFunc: shared.DefaultUsageFuncset on command and subcommands - [ ] Dedicated client wrapper for
playcustomapp/v1API (separate fromplayclient) - [ ] Required flags validated with stderr error messages
- [ ]
shared.ContextWithUploadTimeoutused for APK upload calls
Tests
- [ ] CLI black-box tests in
internal/cmdtest/custom_apps_test.go - [ ] Package-level unit tests for flag validation and org-id pairing logic
- [ ] Error paths: missing
--account, missing--title, missing--apk, invalid APK path, conflicting flags
Docs & Help
- [ ]
--helpoutput follows existing conventions - [ ] Command docs regenerated:
gplay docs generate
Validation (before opening PR)
make format
make lint
make test
make build
/tmp/gplay custom-apps --help
/tmp/gplay custom-apps create --help
/tmp/gplay custom-apps create # missing required flags → stderr error
/tmp/gplay custom-apps create --account 123 --title "Test" --apk /bad/path # invalid APK
Addendum to checklist above — docs CI gate:
The PR CI now runs make check-docs on every PR. This means:
- After implementing the command, run
make docsto regenerateGPLAY.md - Commit the updated
GPLAY.mdalongside your code changes - If you forget, the PR check will fail with: "GPLAY.md is out of date"
This ensures every user-facing command, flag, and help text is always reflected in the reference docs.
Shipped in #244 (v0.7.0). Try it: gplay custom-apps create --help. Tracking future related work in the roadmap: #245.