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.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.
Folders
List all snippet folders
GET /snippets/folders
Returns all snippet folders for the authenticated user, ordered alphabetically by name.
Folder ID.
Owner user ID.
Folder name.
Optional hex color for UI display.
Optional icon identifier.
ISO 8601 timestamp.
ISO 8601 timestamp.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Invalid or missing user ID. |
| 401 | Authentication required. |
| 500 | Database error while fetching folders. |
Example request
Example request
cURL
Create a snippet folder
POST /snippets/folders
Creates a new snippet folder. Folder names must be unique per user.
Folder name. Must be non-empty and unique for the user.
Optional hex color string for the folder (e.g.
#3B82F6).Optional icon identifier used by the UI.
The new folder’s ID.
Folder name.
Color value, if provided.
Icon value, if provided.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Folder name is required. |
| 401 | Authentication required. |
| 409 | A folder with this name already exists for the user. |
| 500 | Database error. |
Example request
Example request
cURL
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.
URL-encoded folder name.
New color value. Pass an empty string to clear.
New icon value. Pass an empty string to clear.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Invalid request. |
| 401 | Authentication required. |
| 404 | Folder not found. |
| 500 | Database error. |
Example request
Example request
cURL
Rename a snippet folder
PUT /snippets/folders/rename
Renames an existing folder and cascades the new name to all snippets in that folder.
Current folder name.
Desired new folder name. Must not already exist.
Always
true on success.The previous folder name.
The new folder name.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | oldName or newName missing or empty. |
| 401 | Authentication required. |
| 404 | No folder exists with oldName. |
| 409 | A folder named newName already exists. |
| 500 | Database error. |
Example request
Example request
cURL
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.
URL-encoded folder name.
Always
true on success.Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Invalid or missing name. |
| 401 | Authentication required. |
| 500 | Database error. |
Example request
Example request
cURL
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.
Snippet ID.
Owner user ID.
Snippet display name.
The command or script content.
Optional description.
Folder name, or
null for root-level snippets.Sort order within the folder.
ISO 8601 creation timestamp.
ISO 8601 last-modified timestamp.
Example request
Example request
cURL
Get a snippet by ID
GET /snippets/:id
Snippet ID.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Invalid or non-numeric ID. |
| 401 | Authentication required. |
| 404 | Snippet not found or does not belong to the user. |
| 500 | Database error. |
Example request
Example request
cURL
Create a snippet
POST /snippets
Display name for the snippet.
The command or script content.
Optional human-readable description.
Folder name to place the snippet in. Omit to place at root level.
Sort order. Auto-assigned to
max(existing) + 1 if omitted.The new snippet’s ID.
Snippet name.
Snippet content.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | name or content is missing or empty. |
| 401 | Authentication required. |
| 500 | Database error. |
Example request
Example request
cURL
Update a snippet
PUT /snippets/:id
All body fields are optional; only supplied fields are updated.
Snippet ID.
New display name.
New command content.
New description. Pass empty string to clear.
Move to a different folder. Pass empty string to move to root.
New sort order.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Invalid or missing ID. |
| 401 | Authentication required. |
| 404 | Snippet not found. |
| 500 | Database error. |
Example request
Example request
cURL
Delete a snippet
DELETE /snippets/:id
Snippet ID.
Always
true on success.Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Invalid or missing ID. |
| 401 | Authentication required. |
| 404 | Snippet not found. |
| 500 | Database error. |
Example request
Example request
cURL
Reorder snippets
PUT /snippets/reorder
Bulk-updates the order and/or folder of multiple snippets in a single request.
Array of update objects.
Always
true on success.Number of snippets updated.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | snippets array is missing or empty. |
| 401 | Authentication required. |
| 500 | Database error. |
Example request
Example request
cURL
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.
ID of the snippet to run.
ID of the target host in the Termix database.
Whether the command exited without errors on stderr.
Standard output from the command.
Standard error output, present when
success is false.Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | snippetId or hostId is missing. |
| 401 | Authentication required. |
| 404 | Snippet or host not found. |
| 500 | SSH connection failure or command execution error. |
Example request
Example request
cURL
Example response (200)
Example response (200)