Ana içeriğe geç

Export Keystore File

Endpoint​

GET /apiops/projects/{projectName}/keystores/{keystoreName}/export-file/
Info

This is the raw file download. To move a keystore between Apinizer installations, use Export Keystore instead — that produces an Apinizer package which Import Keystore can read back.

Authentication​

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request​

Headers​

HeaderValueRequired
AuthorizationBearer {token}Yes

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
keystoreNamestringYesKeystore name

Query Parameters​

ParameterTypeRequiredDefaultDescription
environmentNamestringNo—Returns only this environment's keystore file. Without it, every environment's keystore is returned in one ZIP

Response​

Success Response (200 OK)​

With environmentName, the response is the keystore file itself.

  • Content-Type: application/octet-stream
  • Content-Disposition: attachment; filename="<keystoreName>-<environmentName>.p12"

Without it, the response is a ZIP archive.

  • Content-Disposition: attachment; filename="<keystoreName>-keystores.zip"
  • One entry per environment

The extension follows the file the keystore was uploaded with, so a keystore uploaded as .pfx comes back as .pfx. When no file name was recorded, the keystore type decides: .p12 for PKCS12, .jks otherwise.

Error Response (400 Bad Request)​

{
"status": "FAILURE",
"resultMessage": "Keystore (name: partner-store) is not found!"
}

or

{
"status": "FAILURE",
"resultMessage": "(partner-store) has no material for environment (prod)! Available: test, uat"
}

or

{
"status": "FAILURE",
"resultMessage": "(partner-store) carries no environment material to export!"
}

Error Response (401 Unauthorized)​

{
"status": "FAILURE",
"resultMessage": "Token is not valid!"
}

cURL Example​

Example 1: Download One Environment's Keystore​

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/keystores/partner-store/export-file/?environmentName=Production" \
-H "Authorization: Bearer YOUR_TOKEN" \
--output partner-store.p12

Example 2: Download Every Environment's Keystore​

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/keystores/partner-store/export-file/" \
-H "Authorization: Bearer YOUR_TOKEN" \
--output partner-store-keystores.zip

Example 3: Verify the Downloaded File​

keytool -list -keystore partner-store.p12 -storetype PKCS12 -storepass YOUR_PASSWORD

Notes and Warnings​

  • The file is the original: the bytes that were uploaded are returned unchanged, so the download opens in any tool that could open the original.
  • The extension is preserved: it is often what the consuming tool uses to pick its reader, so a .pfx upload is never handed back as .jks.
  • The password is not in the file name or the response: it stays where it was configured. Supply it yourself when opening the keystore.
  • A missing environment is an error, not an empty file: asking for an environment the keystore has no material in returns 400 and names the environments that do have it.
  • This distributes private key material: keep the token that can call this endpoint tightly scoped, and store the downloaded file securely.
  • No new exposure over the package export: Export Keystore already writes the same decrypted material into its package.

Permissions​

  • User must have SECRETS + EXPORT_IMPORT permission in the project