Environment Management API Reference
Overview
Section titled “Overview”The Environment Management API provides programmatic access to Optimizely Cloud operations. Use this API to automate deployments, manage environment configuration, and integrate with external CI/CD pipelines.
Base URL: https://paasportal.episerver.net/api/v1.0
Authentication
Section titled “Authentication”All API requests require a Bearer token in the Authorization header.
Authorization: Bearer <api-key>Generate API keys in the management portal under Settings > API Keys. Keys are scoped to a project and can be limited to specific operations.
Projects
Section titled “Projects”List projects
Section titled “List projects”GET /projectsReturns all projects accessible to the authenticated user.
Response:
{ "projects": [ { "id": "abc123", "name": "My CMS Site", "environments": ["Integration", "Preproduction", "Production"], "createdAt": "2025-06-15T10:30:00Z" } ]}Get project details
Section titled “Get project details”GET /projects/{projectId}Returns detailed information about a project including environment status and deployment history summary.
Deployments
Section titled “Deployments”Create deployment
Section titled “Create deployment”POST /projects/{projectId}/deploymentsContent-Type: multipart/form-dataUploads a deployment package and triggers a deployment.
Form fields:
| Field | Type | Required | Description |
|---|---|---|---|
file | file | Yes | Deployment package (.zip) |
targetEnvironment | string | Yes | Target environment name |
description | string | No | Deployment description |
Response (202 Accepted):
{ "id": "dep-789", "status": "queued", "targetEnvironment": "Integration", "createdAt": "2026-03-25T14:00:00Z", "statusUrl": "/projects/abc123/deployments/dep-789"}Get deployment status
Section titled “Get deployment status”GET /projects/{projectId}/deployments/{deploymentId}Response:
{ "id": "dep-789", "status": "succeeded", "targetEnvironment": "Integration", "startedAt": "2026-03-25T14:00:05Z", "completedAt": "2026-03-25T14:03:22Z", "commitId": "a1b2c3d", "commitMessage": "Add new landing page template"}Status values: queued, building, deploying, succeeded, failed, rolled-back
List deployments
Section titled “List deployments”GET /projects/{projectId}/deployments?environment={name}&limit={n}Query parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
environment | string | all | Filter by environment |
limit | integer | 10 | Number of results (max 100) |
offset | integer | 0 | Pagination offset |
Promote deployment
Section titled “Promote deployment”POST /projects/{projectId}/deployments/{deploymentId}/promoteContent-Type: application/jsonRequest body:
{ "targetEnvironment": "Preproduction"}Response (202 Accepted): Returns a new deployment object for the target environment.
Rollback
Section titled “Rollback”POST /projects/{projectId}/environments/{environment}/rollbackRolls back to the previous successful deployment.
Response (202 Accepted): Returns a new deployment object.
Environment variables
Section titled “Environment variables”List variables
Section titled “List variables”GET /projects/{projectId}/environments/{environment}/variablesReturns all environment variables. Sensitive values are masked.
Response:
{ "variables": [ { "name": "MY_SETTING", "value": "my-value", "isSecret": false }, { "name": "API_KEY", "value": "********", "isSecret": true } ]}Set variable
Section titled “Set variable”PUT /projects/{projectId}/environments/{environment}/variables/{name}Content-Type: application/jsonRequest body:
{ "value": "new-value", "isSecret": false}Response (200 OK): Returns the updated variable.
Delete variable
Section titled “Delete variable”DELETE /projects/{projectId}/environments/{environment}/variables/{name}Response (204 No Content)
Database operations
Section titled “Database operations”Get database info
Section titled “Get database info”GET /projects/{projectId}/environments/{environment}/databaseReturns database connection details and size information.
Response:
{ "server": "server.database.windows.net", "database": "myproject_inte", "sizeMB": 1024, "maxSizeMB": 5120, "backupRetentionDays": 35}Export database
Section titled “Export database”POST /projects/{projectId}/environments/{environment}/database/exportInitiates a database export. Returns a status URL to poll for completion.
Response (202 Accepted):
{ "exportId": "exp-456", "status": "in-progress", "statusUrl": "/projects/abc123/environments/Production/database/exports/exp-456"}Import database
Section titled “Import database”POST /projects/{projectId}/environments/{environment}/database/importContent-Type: application/jsonRequest body:
{ "sourceEnvironment": "Production"}Imports a database from another environment. The target database is replaced.
CDN operations
Section titled “CDN operations”Purge cache
Section titled “Purge cache”POST /projects/{projectId}/environments/{environment}/cdn/purgeContent-Type: application/jsonRequest body (purge URL):
{ "type": "url", "value": "https://www.example.com/en/page/"}Request body (purge path prefix):
{ "type": "path", "value": "/en/blog/*"}Request body (full purge):
{ "type": "all"}Response (202 Accepted):
{ "purgeId": "prg-321", "status": "in-progress", "estimatedCompletionSeconds": 30}Environment management
Section titled “Environment management”List environments
Section titled “List environments”GET /projects/{projectId}/environmentsResponse:
{ "environments": [ { "name": "Integration", "url": "https://myproject.inte.optimizely.cloud", "status": "running", "lastDeployment": "2026-03-25T14:03:22Z" } ]}Restart environment
Section titled “Restart environment”POST /projects/{projectId}/environments/{environment}/restartRestarts the application without redeploying.
Response (202 Accepted)
Error responses
Section titled “Error responses”All error responses follow a consistent format:
{ "error": { "code": "DEPLOYMENT_FAILED", "message": "Build failed: compilation error in MyProject.csproj", "details": "error CS1061: 'ContentData' does not contain..." }}Common error codes:
| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Invalid or expired API key |
FORBIDDEN | 403 | API key lacks required permissions |
NOT_FOUND | 404 | Project, environment, or deployment not found |
DEPLOYMENT_FAILED | 422 | Build or deployment error |
CONFLICT | 409 | Another deployment is in progress |
RATE_LIMITED | 429 | Too many requests; retry after delay |
Rate limits
Section titled “Rate limits”The API enforces the following rate limits:
| Operation | Limit |
|---|---|
| Read operations (GET) | 100 requests per minute |
| Write operations (POST/PUT/DELETE) | 20 requests per minute |
| Deployment operations | 5 per hour per environment |
Rate-limited responses include Retry-After header indicating seconds to wait.