Pgyer Docs
API 2.0

Upload & Release

Endpoints for uploading apps to Pgyer via API, including the three-step fast upload flow, HarmonyOS cert and Hsp uploads, and the legacy upload endpoint.

Every API endpoint for uploading apps to Pgyer. Prefer the fast upload flow — it's faster and more reliable.

API publishing follows the same account storage and historical-build cleanup rules. When storage is exceeded, automatic policies attempt to clear existing overage first. If insufficient space can be freed, or manual cleanup is selected, the API returns a failure result. Check code, message, and the final publishing status; a completed file transfer is not a successful publication. Archive installers needed for long-term use.

For help choosing between the API, CLI, CI/CD plugins, MCP, and Agent Skill, see Automated App Uploads and CI/CD Integration.

Fast Upload (New)

Reference implementation: https://github.com/PGYER/upload-app-api-example

Get a pre-upload URL: call getCOSToken to get the upload URL and signing params.

Upload the app file: POST the app as multipart/form-data to the URL returned in the previous step.

Poll for release status: call buildInfo until it returns success or failure.

Get an Upload Token

Returns the pre-upload URL and the signing params.

POSThttps://www.pgyer.com/apiv2/app/getCOSToken

Request Parameters

ParameterTypeRequiredDescription
_api_keyStringYesAPI Key — see auth
buildTypeStringYesApp type: ios or ipa for iOS, android or apk for Android, harmonyos or hap for HarmonyOS
overseaIntegerNoUse overseas upload acceleration: 1 overseas, 2 mainland China; leave blank for auto-detect by IP
buildInstallTypeIntegerNoInstall method, default 1. 1: public; 2: password; 3: invite
buildPasswordStringNoInstall password — empty means public install
buildDescriptionStringNoApp description; pass empty or omit if none
buildUpdateDescriptionStringNoRelease notes; pass empty or omit if none
buildInstallDateIntegerNoDownload date window: 1 sets a window, 2 does not restrict download start or end dates; omit to keep the previous setting. This does not change historical-build retention rules
buildInstallStartDateStringNoInstall window start, e.g. 2018-01-01
buildInstallEndDateStringNoInstall window end, e.g. 2018-12-31
buildChannelShortcutStringNoChannel short URL to update. Channel must already exist; one at a time, e.g. abcd

Response

FieldTypeDescription
keyStringUnique storage key for the uploaded file
endpointStringURL to upload the file to
paramsObjectParams required by the upload: signature, x-cos-security-token, key
{
  "code": 0,
  "message": "",
  "data": {
    "endpoint": "https://upload-v7.upload.cos.ap-shanghai.myqcloud.com",
    "key": "apps/xxx/yyyy/zzzz.apk",
    "params": {
      "signature": "q-sign-algorithm=sha1&q-ak=...&q-signature=...",
      "x-cos-security-token": "...",
      "key": "apps/xxx/yyyy/zzzz.apk"
    }
  }
}

Upload the File to the Returned URL

Upload the app file to the endpoint returned by getCOSToken.

A successful upload triggers Pgyer's backend release queue — this step returning success doesn't mean the release is done. Publishing typically completes within a minute; poll buildInfo in the next step to check status.

POST<endpoint from the previous response>

Set Content-Type: multipart/form-data.

Request Parameters

ParameterTypeRequiredDescription
keyStringYesFrom the previous response
signatureStringYesFrom the previous response
x-cos-security-tokenStringYesFrom the previous response
x-cos-meta-file-nameStringNoOriginal filename, e.g. app-release.apk
fileFileYesLocal path to the app file

Response

  • Success: HTTP 204 No Content.
  • Failure: the corresponding error message.

Check Release Status

Check whether the app has finished publishing and fetch the release info.

GEThttps://www.pgyer.com/apiv2/app/buildInfo

Request Parameters

ParameterTypeRequiredDescription
_api_keyStringYesAPI Key — see auth
buildKeyStringYesThe key returned in step one

Response

Three possible outcomes:

FieldTypeDescription
buildKeyStringBuild Key, unique index ID for the app
buildTypeIntegerApp type (1: iOS; 2: Android)
buildIsFirstIntegerIs this the first build (1: yes; 2: no)
buildIsLastestIntegerIs this the latest version (1: yes; 2: no)
buildFileSizeIntegerInstaller size
buildNameStringApp name
buildVersionStringVersion number, default 1.0 (the version shown to users, e.g. 1.1, 8.2.1)
buildVersionNoStringBuild version in the uploaded installer, default 1 (Android's Version Code; iOS is string, Android is integer, e.g. 1001, 28)
buildBuildVersionIntegerPgyer-generated build number used to distinguish historical versions
buildIdentifierStringApp package identifier — BundleId on iOS, package name on Android
buildIconStringApp icon key. Access URL is https://cdn-app-icon2.pgyer.com/<buildIconPath>/<buildIcon>?x-oss-process=image/resize,m_lfit,h_120,w_120/format,jpg; buildIconPath is the first 5 chars of buildIcon joined by /. For buildIcon = 123abcdefaaa, buildIconPath = 1/2/3/a/b
buildDescriptionStringApp description
buildUpdateDescriptionStringRelease notes
buildScreenShotsStringScreenshot key; access URL is https://www.pgyer.com/image/view/app_screenshots/<screenshot_key>
buildShortcutUrlStringApp short URL
buildQRCodeURLStringApp QR code URL
buildCreatedStringUpload time
buildUpdatedStringUpdate time
{
  "code": 0,
  "message": "",
  "data": {
    "buildKey": "a1b2c3d4e5f6",
    "buildType": 2,
    "buildIsFirst": 2,
    "buildIsLastest": 1,
    "buildFileSize": 12345678,
    "buildName": "Sample App",
    "buildVersion": "1.1",
    "buildVersionNo": "28",
    "buildBuildVersion": 5,
    "buildIdentifier": "com.example.app",
    "buildIcon": "123abcdefaaa",
    "buildDescription": "Sample description",
    "buildUpdateDescription": "Various bug fixes",
    "buildScreenShots": "",
    "buildShortcutUrl": "abcd",
    "buildQRCodeURL": "https://www.pgyer.com/app/qrcode/abcd",
    "buildCreated": "2025-01-01 10:00:00",
    "buildUpdated": "2025-01-01 10:05:00"
  }
}
FieldTypeDescription
codeIntegerError code, 1247 — app is still publishing
messageStringHuman-readable message
{
  "code": 1247,
  "message": "App is publishing"
}
FieldTypeDescription
codeIntegerError code, 1216 — publishing failed
messageStringHuman-readable message
{
  "code": 1216,
  "message": "App publish failed"
}

When you get code = 1247 (still publishing), retry every 3–5 seconds until you see success or failure.

Upload HarmonyOS App p12 Certificate

When releasing a HarmonyOS .hap, upload the p12 signing certificate.

POSThttps://upload.pgyer.com/apiv2/app/uploadHarmonyCert

Set Content-Type: multipart/form-data.

Request Parameters

ParameterTypeRequiredDescription
_api_keyStringYesAPI Key — see auth
fileFileYesThe .p12 file to upload
passwordStringYesPassword for the p12
buildKeyStringYesSee buildKey

The build referenced by buildKey must contain signing information. Upload a build signed with an internal testing or enterprise profile first.

Response

FieldTypeDescription
codeInteger0 when the certificate is saved; anything greater — see the error codes below
messageStringThe reason on failure. When code is 0 and message is not empty, the certificate was saved but does not match the build's signing certificate
dataStringsuccess when saved

If the P12 does not match the signing certificate of the build, it is still saved and the response is code: 0, but message explains the mismatch and testers may not be able to install. Upload the P12 that was used to sign the build.

Error Codes

CodeMeaning
3001buildKey is empty or the build was not found
3002No permission for this app
3003Not a HarmonyOS app
3004No certificate file was uploaded
3005The file extension is not .p12
3006The P12 certificate is not yet valid or has expired; message includes the time
3008Incorrect P12 password, or the file is not a valid P12 certificate
3009No private key in the P12, or the private key entry could not be read; export the P12 again
3010The certificate could not be saved; try again later
3011The certificate file is larger than 10 MB
3012The certificate file is empty
3013Invalid certificate file format
3014The build has no signing information (unsigned or unreadable); upload a build signed with an internal testing or enterprise profile first

Upload HarmonyOS Hsp File

When a HarmonyOS .hap has .hsp dependencies, upload each .hsp.

POSThttps://upload.pgyer.com/apiv2/app/uploadHarmonyHsp

Set Content-Type: multipart/form-data.

Request Parameters

ParameterTypeRequiredDescription
_api_keyStringYesAPI Key — see auth
fileFileYesThe Hsp file to upload
buildKeyStringYesSee buildKey

Response

FieldTypeDescription
codeInteger0 on success; anything greater — see error codes

Upload App (Legacy)

This endpoint is slow — use Fast Upload instead.

POSThttps://upload.pgyer.com/apiv2/app/upload

Request Parameters

ParameterTypeRequiredDescription
_api_keyStringYesAPI Key — see auth
fileFileYesThe ipa or apk to upload
buildInstallTypeIntegerNoInstall method, default 1. 1: public; 2: password; 3: invite
buildPasswordStringNoInstall password — empty means public install
buildUpdateDescriptionStringNoRelease notes; pass empty or omit if none
buildInstallDateIntegerNoWhether to set a validity window: 1 with window, 2 forever; omit to leave the previous setting
buildInstallStartDateStringNoInstall window start, e.g. 2018-01-01
buildInstallEndDateStringNoInstall window end, e.g. 2018-12-31
buildChannelShortcutStringNoChannel short URL to update; one at a time, e.g. abcd

Response

FieldTypeDescription
buildKeyStringBuild Key, unique index ID for the app
buildTypeIntegerApp type (1: iOS; 2: Android)
buildIsFirstIntegerIs this the first build (1: yes; 2: no)
buildIsLastestIntegerIs this the latest version (1: yes; 2: no)
buildFileSizeIntegerInstaller size
buildNameStringApp name
buildVersionStringVersion number, default 1.0
buildVersionNoStringBuild version in the uploaded installer, default 1
buildBuildVersionIntegerPgyer-generated build number used to distinguish historical versions
buildIdentifierStringApp package identifier — BundleId on iOS, package name on Android
buildIconStringApp icon key. Access URL is https://cdn-app-icon2.pgyer.com/<buildIconPath>/<buildIcon>?x-oss-process=image/resize,m_lfit,h_120,w_120/format,jpg; buildIconPath is the first 5 chars of buildIcon joined by /
buildDescriptionStringApp description
buildUpdateDescriptionStringRelease notes
buildScreenShotsStringScreenshot key; access URL is https://www.pgyer.com/image/view/app_screenshots/<screenshot_key>
buildShortcutUrlStringApp short URL
buildQRCodeURLStringApp QR code URL
buildCreatedStringUpload time
buildUpdatedStringUpdate time

On this page