Mirra
Mirra APITemplates

Template Endpoints

This page documents all available operations for creating, building, installing, and managing templates on the Mirra platform.

Create Template

Create a new template from a Git repository.

Endpoint

POST /api/sdk/v1/templates

Request Body

{
  "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"]
}

Response

{
  "success": true,
  "data": {
    "id": "template_abc123",
    "name": "Crypto Dashboard",
    "status": "draft",
    "createdAt": "2025-11-15T12:00:00Z"
  }
}

Build Template

Build the template to prepare it for publishing. The build process compiles the Next.js page, bundles dependencies, and uploads to CDN.

Endpoint

POST /api/sdk/v1/templates/{templateId}/build

Request Body

{
  "version": "1.0.0"
}

Response

{
  "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"
    ]
  }
}

Check Installation Requirements

Verify whether a user can install a template and view estimated costs.

Endpoint

POST /api/sdk/v1/templates/{templateId}/check-requirements

Response

{
  "success": true,
  "data": {
    "canInstall": true,
    "missingResources": [],
    "estimatedCost": {
      "setup": 0,
      "monthly": 5.0,
      "perUse": 0.01
    },
    "requirements": {
      "scripts": ["fetchPrices", "calculatePortfolio"],
      "resources": ["crypto-price-api"]
    }
  }
}

Install Template

Install a template with custom configuration values.

Endpoint

POST /api/sdk/v1/templates/{templateId}/install

Request Body

{
  "customization": {
    "branding.primaryColor": "#FF6B6B",
    "api.refreshInterval": 30,
    "features.notifications": true
  }
}

Response

{
  "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 Template

Publish a template to the marketplace with pricing configuration.

Endpoint

POST /api/sdk/v1/templates/{templateId}/publish

Request Body

{
  "pricing": {
    "setupFee": 10.0,
    "monthlyFee": 5.0,
    "estimatedUsageCost": {
      "perUse": 0.01,
      "perMonth": 10.0
    }
  }
}

Publishing Requirements

  • Template successfully built with valid CDN URL
  • All resource dependencies available in marketplace
  • Complete metadata (name, description, version)

Unpublish Template

Remove a template from the marketplace. Unpublishing prevents new installations but does not affect existing installations.

Endpoint

POST /api/sdk/v1/templates/{templateId}/unpublish

Response

{
  "success": true,
  "data": {
    "id": "template_abc123",
    "status": "draft"
  }
}

Create Template Version

Create a new version of a template.

Endpoint

POST /api/sdk/v1/templates/{templateId}/versions

Request Body

{
  "version": "1.1.0",
  "gitHash": "def456",
  "changelog": "Added notification support"
}

Response

{
  "success": true,
  "data": {
    "versionId": "version_789",
    "version": "1.1.0",
    "createdAt": "2025-11-15T13:00:00Z"
  }
}

Update Template

Update template metadata or configuration.

Endpoint

PATCH /api/sdk/v1/templates/{templateId}

Request Body

{
  "description": "Updated description",
  "tags": ["crypto", "portfolio", "dashboard"]
}

Delete Template

Permanently delete a template. Templates with active installations cannot be deleted.

Endpoint

DELETE /api/sdk/v1/templates/{templateId}

Response

{
  "success": true,
  "message": "Template deleted successfully"
}

List User Templates

Get all templates created by the authenticated user.

Endpoint

GET /api/sdk/v1/templates

Response

{
  "success": true,
  "data": {
    "templates": [
      {
        "id": "template_123",
        "name": "Crypto Dashboard",
        "status": "published",
        "version": "1.0.0",
        "installCount": 45,
        "createdAt": "2025-11-15T12:00:00Z"
      }
    ]
  }
}

List Marketplace Templates

Browse available templates in the marketplace.

Endpoint

GET /api/sdk/v1/templates/marketplace

Query Parameters

  • 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)

Response

{
  "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
  }
}

See Also

On this page