Skip to main content
POST
/
api
/
platform
/
templates
Create Template
curl --request POST \
  --url https://api.example.com/api/platform/templates \
  --header 'Content-Type: application/json' \
  --data '
{
  "environmentId": "<string>",
  "service": "<string>",
  "name": "<string>",
  "description": "<string>",
  "visibility": "<string>"
}
'
{
  "templateId": "<string>",
  "name": "<string>",
  "location": "<string>"
}

Request

POST /api/platform/templates

Body Parameters

environmentId
string
required
Environment ID to create template from
service
string
required
Service type: "slack" or "linear"
name
string
required
Template name (must be unique, lowercase, no spaces)
description
string
Template description
visibility
string
default:"private"
"public" or "private"

Example Request

curl -X POST https://api.agentdiff.dev/api/platform/templates \
  -H "X-API-Key: ad_live_sk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "environmentId": "abc123def456",
    "service": "slack",
    "name": "my_custom_template",
    "description": "Custom workspace with extra channels",
    "visibility": "private"
  }'

Response

templateId
string
New template identifier
name
string
Template name
location
string
Schema location

Example Response

{
  "templateId": "template-789",
  "name": "my_custom_template",
  "location": "my_custom_template",
  "service": "slack",
  "visibility": "private"
}

Use Case

Create custom templates with specific seed data:
  1. Create environment from base template
  2. Make API calls to add/modify data
  3. Save as new template
  4. Use new template for tests
# 1. Start with base template
env = client.init_env(
    templateService="slack",
    templateName="slack_default",
    impersonateUserId="U01AGENBOT9"
)

# 2. Add custom data
import requests
requests.post(f"{env.environmentUrl}/conversations.create", json={
    "name": "my-custom-channel"
})

# 3. Save as template
template = client.create_template_from_environment(
    environmentId=env.environmentId,
    service="slack",
    name="my_workspace",
    description="Workspace with custom channel",
    visibility="private"
)

# 4. Use in future tests
env2 = client.init_env(
    templateService="slack",
    templateName="my_workspace",
    impersonateUserId="U01AGENBOT9"
)

Errors

ErrorStatusDescription
environment_not_found404Environment doesn’t exist
template_name_exists400Template name already taken
invalid_template_name400Invalid characters in name

SDK Usage

template = client.create_template_from_environment(
    environmentId=env.environmentId,
    service="slack",
    name="my_custom_template",
    description="Custom workspace",
    visibility="private"
)
print(f"Created template: {template.templateId}")