Request
POST /api/platform/initEnv
Body Parameters
Service type: "slack" or "linear"
Template to clone from (e.g., "slack_default", "linear_expanded").
Required if testId is not provided.
Test ID to get template configuration from. If provided, templateService and templateName are inferred.
User ID the agent will act as. Required if testId is not provided.
Email of the user to impersonate. Alternative to impersonateUserId.
Time-to-live in seconds. Environment auto-deletes after this time.
Example Request
curl -X POST https://api.agentdiff.dev/api/platform/initEnv \
-H "X-API-Key: ad_live_sk_..." \
-H "Content-Type: application/json" \
-d '{
"templateService": "slack",
"templateName": "slack_default",
"impersonateUserId": "U01AGENBOT9",
"ttlSeconds": 3600
}'
Response
Unique environment identifier
Base URL for service API calls
PostgreSQL schema name for this environment
ISO 8601 timestamp when environment will auto-delete
Service type (slack or linear)
Example Response
{
"environmentId": "abc123def456",
"environmentUrl": "/api/env/abc123def456/services/slack",
"schemaName": "state_pool_abc123",
"expiresAt": "2025-11-26T16:00:00Z",
"templateSchema": "slack_default",
"service": "slack"
}
Errors
| Error | Status | Description |
|---|
template_not_found | 404 | Template doesn’t exist |
missing_impersonate | 400 | impersonateUserId or impersonateEmail required |
invalid_service | 400 | Unknown service type |
SDK Usage
env = client.init_env(
templateService="slack",
templateName="slack_default",
impersonateUserId="U01AGENBOT9",
ttlSeconds=3600
)