Ana içeriğe geç

Export API Proxy

Endpoint

GET /apiops/projects/{projectName}/apiProxies/{apiProxyName}/export/

Authentication

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request

Headers

HeaderValueRequired
AuthorizationBearer {token}Yes
X-Apinizer-Package-PassphraseBase64 of the UTF-8 passphraseOnly when encrypt=true

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
apiProxyNamestringYesAPI Proxy name

Query Parameters

ParameterTypeRequiredDefaultDescription
encryptbooleanNofalseWhen true, encrypts the entire export package — including object names — with the passphrase supplied in the X-Apinizer-Package-Passphrase header
withDependenciesbooleanNofalseWhen true, the package also includes every object the proxy references (global policies, policy groups, certificates, credentials, connections, LLM providers, environment variables, etc.), which the import binds to same-named objects in the target project. When false (default), only the proxy itself is exported (previous behavior)

Response

Success Response (200 OK)

The response is a ZIP file containing the API Proxy export.

Headers

  • Content-Type: application/octet-stream
  • Content-Disposition: attachment; filename="<apiProxyName>.zip"

Response Body

  • Binary ZIP file containing:
    • API Proxy JSON definition file
    • All associated policies
    • All configurations and settings

ZIP File Contents

  • {apiProxyName}.json - Complete API Proxy definition in JSON format
  • Contains all endpoints, policies, settings, routing configurations, etc.

Error Response (400 Bad Request)

{
"status": "FAILURE",
"resultMessage": "projectName value can not be empty!"
}

or

{
"status": "FAILURE",
"resultMessage": "apiProxyName value can not be empty!"
}

or

{
"status": "FAILURE",
"resultMessage": "ApiProxy (name: MyAPI) was not found!"
}

or

{
"status": "FAILURE",
"resultMessage": "Package encryption requested but no passphrase was supplied."
}

or

{
"status": "FAILURE",
"resultMessage": "Export package could not be encrypted."
}

Common Causes

  • Empty projectName or apiProxyName
  • API Proxy does not exist in the project
  • Project does not exist or user does not have access
  • encrypt=true was requested but the X-Apinizer-Package-Passphrase header was not provided
  • The package could not be encrypted with the supplied passphrase

Error Response (401 Unauthorized)

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

cURL Example

Example 1: Export API Proxy

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/export/" \
-H "Authorization: Bearer YOUR_TOKEN" \
--output apiProxyExportFile.zip

Example 2: Export API Proxy with Custom Filename

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/export/" \
-H "Authorization: Bearer YOUR_TOKEN" \
--output my-api-export.zip

Example 3: Export an Encrypted API Proxy Package

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/export/?encrypt=true" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "X-Apinizer-Package-Passphrase: $(printf '%s' 'my-passphrase' | base64)" \
--output apiProxyExportFile.zip

Example 4: Export an API Proxy with its Dependencies

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/export/?withDependencies=true" \
-H "Authorization: Bearer YOUR_TOKEN" \
--output apiProxyExportFile.zip

Notes and Warnings

  • Export Format:

    • Exported file is a ZIP archive
    • Contains JSON file with complete API Proxy definition
    • Includes all policies, endpoints, settings, and configurations
  • File Naming:

    • The download is named after the API Proxy, for example MyAPI.zip
    • The name is sanitized, so a proxy whose name contains a slash or another reserved character still produces a valid file name
    • You can rename the downloaded file as needed
  • Complete Export:

    • Export includes all API Proxy configurations
    • Includes all associated policies
    • Includes routing, cache, CORS, and other settings

Permissions

  • User must have API_MANAGEMENT + EXPORT_IMPORT permission in the project

  • Alternatively, user can have project admin role

  • File Size:

    • Export file size depends on API Proxy complexity
    • Large API Proxies with many policies may result in larger files
  • Import Compatibility:

    • Exported files can be imported using Import endpoints
    • Compatible with Import without Override and Import with Override endpoints
  • Security:

    • By default, export files are unencrypted and contain sensitive configuration data
    • Set encrypt=true with a passphrase to encrypt the entire package
    • Store exported files securely
    • Do not share exported files publicly
    • Share the passphrase through a channel separate from the exported file
  • Package Encryption:

    • Encryption is optional and fully backward compatible — when encrypt is omitted or false, the package is produced as a plain ZIP file, byte-compatible with earlier Apinizer versions
    • When encrypt=true, the entire package — including object names — is encrypted with the supplied passphrase, so nothing about its contents can be observed from the outside
    • The encryption key is derived from the passphrase; the passphrase itself is never written into the package
    • The passphrase is never stored and cannot be recovered — if it is lost, the encrypted package can no longer be opened
    • The same passphrase must be supplied when importing the encrypted package
  • API Proxy State:

    • Export includes current state of API Proxy
    • Includes deployed and undeployed configurations
    • Deployment status is preserved in export
  • Dependency Bundling (withDependencies):

    • When omitted or false, only the proxy itself is exported (default, previous behavior)
    • When true, every object the proxy references — global policies, policy groups, certificates, credentials, connections, LLM providers, environment variables, and more — is bundled into the same package
    • On import, the target project's withDependencies=true resolves bundled objects against same-named objects already in the target project
    • Has no effect on the proxy itself; it only controls whether referenced objects are packaged alongside it