universe docs source
browse docs
docs /api-reference /templates

Templates API

Browse template trees, edit and manage their files, and sync template storage. Templates are file trees under ./templates/<group>/<name>/ that Universe copies into an instance working directory before launch. These endpoints expose listing, per-file CRUD, zip import/export, and storage sync.

Templates are organized by group and name. The pair identifies a directory tree under ./templates/<group>/<name>/ that gets copied into an instance’s working directory at deploy time, with %VARIABLE% placeholders replaced in the files listed under the configuration’s fileModifications.

!
warning

All template endpoints require a token with ALL permission.

Browse templates

List all templates

GET /api/templates

Returns all available templates grouped by group.

curl http://<master>:7000/api/templates \
  -H "Authorization: Bearer YOUR_TOKEN"

Get template details

GET /api/templates/{group}/{name}

Returns the resolved path and existence flag for a single template.

ParameterInDescription
grouppathTemplate group. Required.
namepathTemplate name. Required.
curl http://<master>:7000/api/templates/server/base \
  -H "Authorization: Bearer YOUR_TOKEN"

Template files

List files

GET /api/templates/{group}/{name}/files

Returns every file inside a local template directory as a flat list of relative paths.

curl http://<master>:7000/api/templates/server/base/files \
  -H "Authorization: Bearer YOUR_TOKEN"

Read a file

GET /api/templates/{group}/{name}/files/{path}

Returns the raw contents of a file within a template as text/plain. The path segment is the file path relative to the template root, for example server.properties.

curl http://<master>:7000/api/templates/server/base/files/server.properties \
  -H "Authorization: Bearer YOUR_TOKEN"
i
note

A path that does not resolve to a file returns 404 Not Found.

Edit a file

PATCH /api/templates/{group}/{name}/files/{path}

Replaces the contents of an existing file. The request body is the new file content sent as text/plain. Returns 200 OK with the affected path.

curl -X PATCH http://<master>:7000/api/templates/server/base/files/server.properties \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: text/plain" \
  --data-binary @server.properties

Create a file

POST /api/templates/{group}/{name}/files/{path}

Creates a new file inside the template. The body accepts any content type, including binary assets, jars, and images, sent as application/octet-stream. Returns 201 Created on success.

curl -X POST http://<master>:7000/api/templates/server/base/files/icon.png \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @icon.png
!
warning

Creation fails with 409 Conflict if the target file already exists. Use PATCH to overwrite an existing file.

Delete a file

DELETE /api/templates/{group}/{name}/files/{path}

Removes a file from a local template. Returns 200 OK with the deleted path.

curl -X DELETE http://<master>:7000/api/templates/server/base/files/old.txt \
  -H "Authorization: Bearer YOUR_TOKEN"

Import and export

Export as zip

POST /api/templates/{group}/{name}/export

Packages a local template into a zip and returns it as application/zip. A template that does not exist returns 404 Not Found.

curl -X POST http://<master>:7000/api/templates/server/base/export \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -o base.zip

Import from zip

POST /api/templates/{group}/{name}/import

Unpacks a zip archive into the template directory, overwriting existing files. Send the archive as application/zip.

curl -X POST http://<master>:7000/api/templates/server/base/import \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/zip" \
  --data-binary @base.zip

Storage sync

Sync one template from a storage provider

POST /api/templates/{group}/{name}/sync

Downloads the latest version of a single template from a remote storage provider (for example s3 or ftp) into the local template directory.

Body fieldTypeDescription
storagestringStorage provider key, such as s3. Required.
curl -X POST http://<master>:7000/api/templates/server/base/sync \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"storage": "s3"}'
i
note

A provider key that is not registered returns 400 Bad Request. Storage providers are contributed by extensions such as the S3 storage extension.

Sync templates across the cluster

POST /api/templates/sync

Dispatches a template sync task to the cluster over Hazelcast so Wrapper nodes receive matching template trees. The pattern selects which templates to sync, for example server/* or group/name. The response confirms dispatch; the actual copy happens asynchronously on each node.

Body fieldTypeDescription
patternstringTemplate pattern to sync, such as default/* or group/name. Required.
curl -X POST http://<master>:7000/api/templates/sync \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"pattern": "server/*"}'