Skip to main content

Templates API

Manage Import Templates — reusable, versioned environment blueprints that can be shared via Stargate or My Fleet.

Endpoints

MethodPathScopeDescription
GET/api/import_templatesimport_templates:readList all templates
GET/api/import_templates/search?query=railsimport_templates:readSearch templates
GET/api/import_templates/:idimport_templates:readGet a single template
POST/api/import_templatesimport_templates:writeCreate a new template
PATCH/api/import_templates/:idimport_templates:writeUpdate template metadata
DELETE/api/import_templates/:idimport_templates:writeDelete a template
GET/api/import_templates/:id/versionsimport_templates:readList template versions
POST/api/import_templates/:id/create_versionimport_templates:writeCreate a new version
DELETE/api/import_templates/:id/destroy_versionimport_templates:writeDelete a version
PATCH/api/import_templates/:id/toggle_publicimport_templates:writeToggle a version's public visibility
POST/api/import_templates/:id/launchimport_templates:readLaunch a playground directly from a template

List Templates

GET /api/import_templates

Search Templates

GET /api/import_templates/search?query=rails

Full-text search across template names and descriptions. Returns up to 10 results with fuzzy matching.


Categories

Template categories are managed by platform administrators. You can list all available categories to use during template creation or search, but you cannot create, update, or delete categories through the API.

To request a new category, contact support@fibe.gg.

GET /api/template_categories

Required scope: import_templates:read

Response:

[
{ "id": 1, "name": "Web Frameworks", "slug": "web-frameworks" },
{ "id": 2, "name": "Databases", "slug": "databases" },
{ "id": 3, "name": "Full-Stack Starters", "slug": "full-stack-starters" }
]

Use the returned id as category_id when creating or updating templates.


Create Template

POST /api/import_templates

Request body:

{
"import_template": {
"name": "Rails + PostgreSQL",
"description": "Full-stack Rails application with PostgreSQL database",
"category_id": 1
}
}

Create Version

POST /api/import_templates/:id/create_version

Request body:

{
"template_body": "fibe.gg:\n variables:\n app_name:\n name: \"Application Name\"\n validation: \"/^[a-z][a-z0-9-]{2,30}$/\"\n\nservices:\n web:\n build: .\n ports:\n - \"3000:3000\"\n environment:\n APP_NAME: $$var__app_name\n db:\n image: postgres:16",
"public": true
}

Versions are immutable — once created, the template_body cannot be changed. The version number is auto-assigned sequentially.

Variable Validation

The platform validates that all $$var__NAME and $$random__NAME references in the template body are declared in the fibe.gg > variables section, and vice versa. Undeclared or unused variables will cause a validation error.


Toggle Public

PATCH /api/import_templates/:id/toggle_public

Toggles a version's public flag. Public versions are visible in Stargate for all users.

Parameters:

ParameterTypeDescription
version_idintegerThe version to toggle

Delete Version

DELETE /api/import_templates/:id/destroy_version

Parameters:

ParameterTypeDescription
version_idintegerThe version to delete

Deleting a version does not affect Playspecs or Playgrounds that were already created from it.


Launch Template

POST /api/import_templates/:id/launch

Compiles the template and launches a new Playground natively on the backend. This is the equivalent of importing a template via the visual interface.

Request body:

{
"playroom_id": 1,
"version": 2, // optional, defaults to latest
"variables": {
"app_name": "my-cool-app",
"admin_password": "super-secret"
},
"name": "My Cool App Workspace" // optional
}

The backend TemplateCompilerService will automatically:

  1. Substitute any provided variables into $$var__ placeholders.
  2. Generate secure 16-character hex strings for any $$random__ placeholders.
  3. Validate variables against regex patterns defined in fibe.gg > variables.
  4. Deploy the compiled docker compose string to the target playroom.