Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Termix-SSH/Termix/llms.txt

Use this file to discover all available pages before exploring further.

The Snippets API lets you manage reusable command snippets and the folders that organize them. All endpoints require JWT authentication and data-access authorization. Snippets are scoped to the authenticated user.

Folders

List all snippet folders

GET /snippets/folders Returns all snippet folders for the authenticated user, ordered alphabetically by name.
[].id
number
Folder ID.
[].userId
string
Owner user ID.
[].name
string
Folder name.
[].color
string
Optional hex color for UI display.
[].icon
string
Optional icon identifier.
[].createdAt
string
ISO 8601 timestamp.
[].updatedAt
string
ISO 8601 timestamp.
StatusMeaning
400Invalid or missing user ID.
401Authentication required.
500Database error while fetching folders.
cURL
curl -X GET https://your-termix-host/snippets/folders \
  -H "Authorization: Bearer <token>"

Create a snippet folder

POST /snippets/folders Creates a new snippet folder. Folder names must be unique per user.
name
string
required
Folder name. Must be non-empty and unique for the user.
color
string
Optional hex color string for the folder (e.g. #3B82F6).
icon
string
Optional icon identifier used by the UI.
id
number
The new folder’s ID.
name
string
Folder name.
color
string
Color value, if provided.
icon
string
Icon value, if provided.
StatusMeaning
400Folder name is required.
401Authentication required.
409A folder with this name already exists for the user.
500Database error.
cURL
curl -X POST https://your-termix-host/snippets/folders \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"name": "Deployment", "color": "#22C55E", "icon": "rocket"}'

Update folder metadata

PUT /snippets/folders/:name/metadata Updates the color and/or icon of an existing folder. The folder is identified by its URL-encoded name.
name
string
required
URL-encoded folder name.
color
string
New color value. Pass an empty string to clear.
icon
string
New icon value. Pass an empty string to clear.
StatusMeaning
400Invalid request.
401Authentication required.
404Folder not found.
500Database error.
cURL
curl -X PUT "https://your-termix-host/snippets/folders/Deployment/metadata" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"color": "#EF4444"}'

Rename a snippet folder

PUT /snippets/folders/rename Renames an existing folder and cascades the new name to all snippets in that folder.
oldName
string
required
Current folder name.
newName
string
required
Desired new folder name. Must not already exist.
success
boolean
Always true on success.
oldName
string
The previous folder name.
newName
string
The new folder name.
StatusMeaning
400oldName or newName missing or empty.
401Authentication required.
404No folder exists with oldName.
409A folder named newName already exists.
500Database error.
cURL
curl -X PUT https://your-termix-host/snippets/folders/rename \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"oldName": "Deployment", "newName": "Deploy Scripts"}'

Delete a snippet folder

DELETE /snippets/folders/:name Deletes the folder. Snippets inside are moved to the root (their folder field is set to null) rather than deleted.
name
string
required
URL-encoded folder name.
success
boolean
Always true on success.
StatusMeaning
400Invalid or missing name.
401Authentication required.
500Database error.
cURL
curl -X DELETE "https://your-termix-host/snippets/folders/Deploy%20Scripts" \
  -H "Authorization: Bearer <token>"

Snippets

List all snippets

GET /snippets Returns all snippets for the authenticated user. Ordering: snippets without a folder first, then alphabetically by folder, then by order field, then by most-recently-updated.
[].id
number
Snippet ID.
[].userId
string
Owner user ID.
[].name
string
Snippet display name.
[].content
string
The command or script content.
[].description
string
Optional description.
[].folder
string
Folder name, or null for root-level snippets.
[].order
number
Sort order within the folder.
[].createdAt
string
ISO 8601 creation timestamp.
[].updatedAt
string
ISO 8601 last-modified timestamp.
cURL
curl -X GET https://your-termix-host/snippets \
  -H "Authorization: Bearer <token>"

Get a snippet by ID

GET /snippets/:id
id
number
required
Snippet ID.
StatusMeaning
400Invalid or non-numeric ID.
401Authentication required.
404Snippet not found or does not belong to the user.
500Database error.
cURL
curl -X GET https://your-termix-host/snippets/42 \
  -H "Authorization: Bearer <token>"

Create a snippet

POST /snippets
name
string
required
Display name for the snippet.
content
string
required
The command or script content.
description
string
Optional human-readable description.
folder
string
Folder name to place the snippet in. Omit to place at root level.
order
number
Sort order. Auto-assigned to max(existing) + 1 if omitted.
id
number
The new snippet’s ID.
name
string
Snippet name.
content
string
Snippet content.
StatusMeaning
400name or content is missing or empty.
401Authentication required.
500Database error.
cURL
curl -X POST https://your-termix-host/snippets \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Restart nginx",
    "content": "sudo systemctl restart nginx",
    "description": "Gracefully restart the nginx web server",
    "folder": "Deploy Scripts"
  }'

Update a snippet

PUT /snippets/:id All body fields are optional; only supplied fields are updated.
id
number
required
Snippet ID.
name
string
New display name.
content
string
New command content.
description
string
New description. Pass empty string to clear.
folder
string
Move to a different folder. Pass empty string to move to root.
order
number
New sort order.
StatusMeaning
400Invalid or missing ID.
401Authentication required.
404Snippet not found.
500Database error.
cURL
curl -X PUT https://your-termix-host/snippets/42 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"content": "sudo systemctl reload nginx"}'

Delete a snippet

DELETE /snippets/:id
id
number
required
Snippet ID.
success
boolean
Always true on success.
StatusMeaning
400Invalid or missing ID.
401Authentication required.
404Snippet not found.
500Database error.
cURL
curl -X DELETE https://your-termix-host/snippets/42 \
  -H "Authorization: Bearer <token>"

Reorder snippets

PUT /snippets/reorder Bulk-updates the order and/or folder of multiple snippets in a single request.
snippets
object[]
required
Array of update objects.
success
boolean
Always true on success.
updated
number
Number of snippets updated.
StatusMeaning
400snippets array is missing or empty.
401Authentication required.
500Database error.
cURL
curl -X PUT https://your-termix-host/snippets/reorder \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "snippets": [
      {"id": 1, "order": 0, "folder": "Deploy Scripts"},
      {"id": 2, "order": 1, "folder": "Deploy Scripts"},
      {"id": 3, "order": 0}
    ]
  }'

Execute a snippet on a host

POST /snippets/execute Connects to the specified SSH host, runs the snippet’s content, and returns the output. The connection is ephemeral and closed immediately after execution.
Execution has a 30-second timeout. Long-running commands will be terminated.
snippetId
number
required
ID of the snippet to run.
hostId
number
required
ID of the target host in the Termix database.
success
boolean
Whether the command exited without errors on stderr.
output
string
Standard output from the command.
error
string
Standard error output, present when success is false.
StatusMeaning
400snippetId or hostId is missing.
401Authentication required.
404Snippet or host not found.
500SSH connection failure or command execution error.
cURL
curl -X POST https://your-termix-host/snippets/execute \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"snippetId": 42, "hostId": 7}'
{
  "success": true,
  "output": "nginx reloaded successfully\n"
}

Build docs developers (and LLMs) love