Skip to content

Environment Management API Reference

advanced
📜Advancedcms

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


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.


GET /projects

Returns 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 /projects/{projectId}

Returns detailed information about a project including environment status and deployment history summary.


POST /projects/{projectId}/deployments
Content-Type: multipart/form-data

Uploads a deployment package and triggers a deployment.

Form fields:

FieldTypeRequiredDescription
filefileYesDeployment package (.zip)
targetEnvironmentstringYesTarget environment name
descriptionstringNoDeployment description

Response (202 Accepted):

{
"id": "dep-789",
"status": "queued",
"targetEnvironment": "Integration",
"createdAt": "2026-03-25T14:00:00Z",
"statusUrl": "/projects/abc123/deployments/dep-789"
}
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

GET /projects/{projectId}/deployments?environment={name}&limit={n}

Query parameters:

ParameterTypeDefaultDescription
environmentstringallFilter by environment
limitinteger10Number of results (max 100)
offsetinteger0Pagination offset
POST /projects/{projectId}/deployments/{deploymentId}/promote
Content-Type: application/json

Request body:

{
"targetEnvironment": "Preproduction"
}

Response (202 Accepted): Returns a new deployment object for the target environment.

POST /projects/{projectId}/environments/{environment}/rollback

Rolls back to the previous successful deployment.

Response (202 Accepted): Returns a new deployment object.


GET /projects/{projectId}/environments/{environment}/variables

Returns all environment variables. Sensitive values are masked.

Response:

{
"variables": [
{
"name": "MY_SETTING",
"value": "my-value",
"isSecret": false
},
{
"name": "API_KEY",
"value": "********",
"isSecret": true
}
]
}
PUT /projects/{projectId}/environments/{environment}/variables/{name}
Content-Type: application/json

Request body:

{
"value": "new-value",
"isSecret": false
}

Response (200 OK): Returns the updated variable.

DELETE /projects/{projectId}/environments/{environment}/variables/{name}

Response (204 No Content)


GET /projects/{projectId}/environments/{environment}/database

Returns database connection details and size information.

Response:

{
"server": "server.database.windows.net",
"database": "myproject_inte",
"sizeMB": 1024,
"maxSizeMB": 5120,
"backupRetentionDays": 35
}
POST /projects/{projectId}/environments/{environment}/database/export

Initiates 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"
}
POST /projects/{projectId}/environments/{environment}/database/import
Content-Type: application/json

Request body:

{
"sourceEnvironment": "Production"
}

Imports a database from another environment. The target database is replaced.


POST /projects/{projectId}/environments/{environment}/cdn/purge
Content-Type: application/json

Request 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
}

GET /projects/{projectId}/environments

Response:

{
"environments": [
{
"name": "Integration",
"url": "https://myproject.inte.optimizely.cloud",
"status": "running",
"lastDeployment": "2026-03-25T14:03:22Z"
}
]
}
POST /projects/{projectId}/environments/{environment}/restart

Restarts the application without redeploying.

Response (202 Accepted)


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:

CodeHTTP StatusDescription
UNAUTHORIZED401Invalid or expired API key
FORBIDDEN403API key lacks required permissions
NOT_FOUND404Project, environment, or deployment not found
DEPLOYMENT_FAILED422Build or deployment error
CONFLICT409Another deployment is in progress
RATE_LIMITED429Too many requests; retry after delay

The API enforces the following rate limits:

OperationLimit
Read operations (GET)100 requests per minute
Write operations (POST/PUT/DELETE)20 requests per minute
Deployment operations5 per hour per environment

Rate-limited responses include Retry-After header indicating seconds to wait.