Template Endpoints
This page documents all available operations for creating, building, installing, and managing templates on the Mirra platform.
Create a new template from a Git repository.
POST /api/sdk/v1/templates
{
"repository": "mirra-templates",
"templatePath": "crypto-dashboard",
"gitHash": "main",
"name": "Crypto Dashboard",
"description": "Real-time cryptocurrency portfolio tracker",
"version": "1.0.0",
"category": "crypto",
"tags": ["crypto", "dashboard", "portfolio"]
}
{
"success": true,
"data": {
"id": "template_abc123",
"name": "Crypto Dashboard",
"status": "draft",
"createdAt": "2025-11-15T12:00:00Z"
}
}
Build the template to prepare it for publishing. The build process compiles the Next.js page, bundles dependencies, and uploads to CDN.
POST /api/sdk/v1/templates/{templateId}/build
{
"success": true,
"data": {
"buildStatus": "success",
"buildOutput": "Built successfully",
"cdnUrl": "https://cdn.getmirra.app/templates/crypto-dashboard-v1",
"logs": [
"Installing dependencies...",
"Building Next.js app...",
"Uploading to CDN...",
"Build completed"
]
}
}
Verify whether a user can install a template and view estimated costs.
POST /api/sdk/v1/templates/{templateId}/check-requirements
{
"success": true,
"data": {
"canInstall": true,
"missingResources": [],
"estimatedCost": {
"setup": 0,
"monthly": 5.0,
"perUse": 0.01
},
"requirements": {
"scripts": ["fetchPrices", "calculatePortfolio"],
"resources": ["crypto-price-api"]
}
}
}
Install a template with custom configuration values.
POST /api/sdk/v1/templates/{templateId}/install
{
"customization": {
"branding.primaryColor": "#FF6B6B",
"api.refreshInterval": 30,
"features.notifications": true
}
}
{
"success": true,
"data": {
"installationId": "inst_123",
"templateId": "template_456",
"pageUrl": "https://crypto-dashboard.user.getmirra.app",
"installedScripts": ["fetchPrices", "calculatePortfolio"],
"installedResources": ["crypto-price-api"],
"customization": {
"branding.primaryColor": "#FF6B6B",
"api.refreshInterval": 30,
"features.notifications": true
}
}
}
Publish a template to the marketplace with pricing configuration.
POST /api/sdk/v1/templates/{templateId}/publish
{
"pricing": {
"setupFee": 10.0,
"monthlyFee": 5.0,
"estimatedUsageCost": {
"perUse": 0.01,
"perMonth": 10.0
}
}
}
- Template successfully built with valid CDN URL
- All resource dependencies available in marketplace
- Complete metadata (name, description, version)
Remove a template from the marketplace. Unpublishing prevents new installations but does not affect existing installations.
POST /api/sdk/v1/templates/{templateId}/unpublish
{
"success": true,
"data": {
"id": "template_abc123",
"status": "draft"
}
}
Create a new version of a template.
POST /api/sdk/v1/templates/{templateId}/versions
{
"version": "1.1.0",
"gitHash": "def456",
"changelog": "Added notification support"
}
{
"success": true,
"data": {
"versionId": "version_789",
"version": "1.1.0",
"createdAt": "2025-11-15T13:00:00Z"
}
}
Update template metadata or configuration.
PATCH /api/sdk/v1/templates/{templateId}
{
"description": "Updated description",
"tags": ["crypto", "portfolio", "dashboard"]
}
Permanently delete a template. Templates with active installations cannot be deleted.
DELETE /api/sdk/v1/templates/{templateId}
{
"success": true,
"message": "Template deleted successfully"
}
Get all templates created by the authenticated user.
GET /api/sdk/v1/templates
{
"success": true,
"data": {
"templates": [
{
"id": "template_123",
"name": "Crypto Dashboard",
"status": "published",
"version": "1.0.0",
"installCount": 45,
"createdAt": "2025-11-15T12:00:00Z"
}
]
}
}
Browse available templates in the marketplace.
GET /api/sdk/v1/templates/marketplace
category (string, optional) - Filter by category
tags (string[], optional) - Filter by tags
search (string, optional) - Search by name or description
limit (number, optional) - Results per page (default: 10)
offset (number, optional) - Pagination offset (default: 0)
{
"success": true,
"data": {
"templates": [
{
"id": "template_456",
"name": "Crypto Dashboard",
"description": "Real-time cryptocurrency portfolio tracker",
"category": "crypto",
"pricing": {
"setupFee": 10.0,
"monthlyFee": 5.0
},
"rating": 4.8,
"installCount": 234
}
],
"total": 50,
"limit": 10,
"offset": 0
}
}