Spinly API
Use Spinly as the control plane for ephemeral infrastructure workflows.
The Spinly API lets scripts, tools, and AI agents launch and manage infrastructure workflows programmatically. Authenticate with an API key, then work with templates, launchpacks, environments, and attached runbooks from one control plane.
Overview
Spinly is infrastructure workflows, not just infrastructure provisioning. A typical workflow combines:
Template
Infrastructure baseline
Spinner
Automation step
Runbook
Guided instructions
Launchpack
Reusable infrastructure workflow
Environment
Running instance
Authentication
Create an API key in /account/api, copy it once, and send it as a bearer token.
Authorization: Bearer sply_<prefix>_<secret>Keys can be scoped to read-only, full access, or admin. Spinly stores only the hashed secret server-side.
Endpoints
| Method | Path | Purpose |
|---|---|---|
| GET | /api/templates | List reusable infrastructure baselines. |
| GET | /api/launchpacks | List reusable infrastructure workflows available to the caller. |
| GET | /api/environments | List the caller’s environments. |
| GET | /api/environments/{id} | Inspect a single environment. |
| POST | /api/environments/launch | Launch from a template or launchpack. |
| POST | /api/environments/{id}/extend | Extend TTL for the environment workspace. |
| POST | /api/environments/{id}/terminate | Terminate an environment. |
Example workflows
Launch a reusable infrastructure workflow, poll the environment, extend TTL if needed, then terminate it when work is done.
curl -X POST "$SPINLY_API/api/environments/launch" \
-H "Authorization: Bearer $SPINLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"launchpack_slug": "ceph-cluster-demo",
"ssh_public_key": "ssh-ed25519 AAAA..."
}'import requests
resp = requests.post(
f"{api_base}/api/environments/launch",
headers={"Authorization": f"Bearer {api_key}"},
json={"template_slug": "jumpbox-baseline", "ssh_public_key": public_key},
timeout=30,
)
resp.raise_for_status()
print(resp.json())const response = await fetch(`${apiBase}/api/environments/${environmentId}/terminate`, {
method: 'POST',
headers: { Authorization: `Bearer ${apiKey}` },
})Using Spinly from AI agents
Give the agent a scoped API key, store it securely, and let it launch or inspect infrastructure workflows through the same control plane used by humans. A common flow is: create key, launch a launchpack, poll environment state, open the runbook if returned, then terminate the environment when finished.
Error handling and guardrails
The API enforces the same TTL limits, launch guardrails, workspace quotas, and asset ownership checks as the web app. Invalid credentials return 401, scope failures return 403, and quota or policy rejections return the same backend error messages used by the UI.
Default API key limits
- Read endpoints: 30 requests per minute per API key
- Write endpoints: 15 requests per minute per API key
- Launch endpoint: 5 launches per hour per API key