Skip to main content

Playspecs API

Manage Playspecs — blueprints that define your environment's services, configuration, and infrastructure.

Endpoints

MethodPathScopeDescription
GET/api/playspecsplayspecs:readList all Playspecs
GET/api/playspecs/:idplayspecs:readGet a single Playspec
POST/api/playspecsplayspecs:writeCreate a new Playspec
PATCH/api/playspecs/:idplayspecs:writeUpdate a Playspec (must be unlocked)
DELETE/api/playspecs/:idplayspecs:deleteDelete a Playspec (must be unlocked)
GET/api/playspecs/:id/servicesplayspecs:readGet service definitions
POST/api/playspecs/validate_composeplayspecs:readValidate a Docker Compose YAML
POST/api/playspecs/:id/add_mounted_fileplayspecs:writeAdd a mounted file
PATCH/api/playspecs/:id/update_mounted_fileplayspecs:writeUpdate a mounted file's configuration
DELETE/api/playspecs/:id/remove_mounted_fileplayspecs:writeRemove a mounted file
POST/api/playspecs/:id/add_registry_credentialplayspecs:writeAdd a private registry credential
DELETE/api/playspecs/:id/remove_registry_credentialplayspecs:writeRemove a registry credential

List Playspecs

GET /api/playspecs

Response:

[
{
"id": 1,
"name": "My Web Stack",
"description": "Rails + PostgreSQL + Redis",
"locked": true,
"persist_volumes": false,
"playground_count": 2,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z"
}
]

Get Playspec (Detailed)

GET /api/playspecs/:id

Returns the full Playspec including services, mounted files, and registry credentials:

{
"id": 1,
"name": "My Web Stack",
"description": "Rails + PostgreSQL + Redis",
"locked": false,
"persist_volumes": false,
"playground_count": 0,
"services": [
{
"name": "web",
"type": "dynamic",
"playzone_id": 1,
"dockerfile_path": "Dockerfile",
"env_file_path": ".env.example",
"workdir": "/app",
"exposure": {
"enabled": true,
"port": 3000,
"subdomain": "web",
"visibility": "external"
}
},
{
"name": "db",
"type": "static",
"image": "postgres:16",
"exposure": {
"enabled": false
}
}
],
"mounted_files": [],
"credentials": [],
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z"
}

Create Playspec

POST /api/playspecs

Request body:

{
"playspec": {
"name": "My Web Stack",
"description": "Rails + PostgreSQL + Redis",
"base_compose_yaml": "services:\n web:\n build: .\n ports:\n - \"3000:3000\"\n db:\n image: postgres:16",
"persist_volumes": false,
"services": [
{
"name": "web",
"type": "dynamic",
"playzone_id": 1,
"dockerfile_path": "Dockerfile",
"env_file_path": ".env.example",
"workdir": "/app",
"exposure": { "enabled": true, "port": 3000, "subdomain": "web", "visibility": "external" }
},
{
"name": "db",
"type": "static",
"image": "postgres:16",
"exposure": { "enabled": false }
}
]
}
}
Locked Playspecs

A Playspec becomes locked when any Playground references it. Locked Playspecs cannot be updated or deleted. See Locked Status.


Validate Compose

POST /api/playspecs/validate_compose

Validates a Docker Compose YAML without creating a Playspec.

Request body:

{
"compose_yaml": "services:\n web:\n build: .\n ports:\n - \"3000:3000\""
}

Response:

{
"valid": true,
"services": [
{ "name": "web", "ports": ["3000:3000"] }
],
"errors": [],
"warnings": []
}

Add Mounted File

POST /api/playspecs/:id/add_mounted_file
# Content-Type: multipart/form-data

Parameters:

ParameterTypeRequiredDescription
filefileYesFile to upload
mount_pathstringYesAbsolute path inside the container
target_services[]arrayNoServices that receive the mount (all if empty)
readonlybooleanNoWhether the mount is read-only (default: true)

Add Registry Credential

POST /api/playspecs/:id/add_registry_credential

Request body:

{
"registry_type": "docker_hub",
"registry_url": "https://index.docker.io/v1/",
"username": "myuser",
"secret": "mypassword"
}