API Reference
The Pipetower API allows you to interact with your account through a simple REST API,
e.g. retrieve servers and metrics, execute actions or workflows or read run logs.
All responses from the Pipetower API will be formatted as JSON, except the log of a run execution, which is plain text.
All responses from the Pipetower API will be formatted as JSON, except the log of a run execution, which is plain text.
BASE URL
https://app.pipetower.com/api/v1Authentication
The Pipetower API uses API tokens to authenticate requests. You can view and manage your
API tokens in your Pipetower Account.
The API token should be included in the request as a bearer token value.
A token is created with what it may do, so it only gets what it needs, e.g. for an agent or CI:
What the token doesn't allow is answered with a 403 error which says why. Tokens from before these options have full access with terminals, without limits and expiry.
To check your API token and what it may do, request GET /status. The availability of the API can be checked without a token with GET /ping.
The API token should be included in the request as a bearer token value.
A token is created with what it may do, so it only gets what it needs, e.g. for an agent or CI:
- Teams: all your teams or selected ones.
- Access: read views everything (secret values stay hidden), run also starts and cancels runs and connects servers, full also creates, changes and deletes actions, workflows, templates, pipes and variables and activates pipes.
- Limit runs: with run access, only selected actions and workflows, and only on selected servers. The server limit also applies to connecting and disconnecting. Full access has no run limits, as it may change actions and pipes.
- Terminal: independent of the access, whether the token may open and join terminal sessions, on all servers or only on selected ones. A shell can do anything on its server.
- Expiry: a date after which the token is rejected, or never.
What the token doesn't allow is answered with a 403 error which says why. Tokens from before these options have full access with terminals, without limits and expiry.
To check your API token and what it may do, request GET /status. The availability of the API can be checked without a token with GET /ping.
AUTHENTICATED REQUEST
curl https://app.pipetower.com/api/v1/status \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"authenticated": true,
"time": "2026-11-28T10:26:40+00:00",
"token": {
"name": "Deploy agent",
"access": "run",
"teams": [
{
"id": "64k8bk",
"name": "Ops"
}
],
"runables": [
{
"type": "action",
"id": "03wm83",
"name": "Deploy app"
}
],
"servers": [
{
"id": "kbe67n",
"name": "staging"
}
],
"terminal": {
"servers": [
{
"id": "kbe67n",
"name": "staging"
}
]
},
"expires_at": "2026-12-28T23:59:59+00:00"
}
}Headers
The API always answers with JSON, also on errors, whatever the request accepts.
Requests with a body send it as JSON with this header:
Content-Type: application/json
Errors
Pipetower uses the following HTTP response codes to indicate the success or failure of an API request:
The body of an error response contains a message and, for invalid data (422), the errors per parameter.
| 200 | Everything is ok. |
| 201 | The object was created, e.g. a run, an action or a terminal session. |
| 204 | The object was deleted, the response has no body. |
| 401 | No valid API token was given, or it has expired. |
| 403 | You are not allowed to access or change the requested resource, e.g. it belongs to a team you are not a member of, or your API token doesn't allow it (its access, its run limits or terminals). |
| 404 | The requested resource could not be found. |
| 409 | The object cannot be deleted because other objects still use it, they are listed in the response. |
| 422 | The payload has missing required parameters or invalid data was given, or the request has failed (e.g. a server could not be connected). |
| 500 | Request failed due to an internal error in Pipetower. |
| 503 | Pipetower is offline for maintenance. |
The body of an error response contains a message and, for invalid data (422), the errors per parameter.
ERROR RESPONSE
{
"message": "The server ids is required.",
"errors": {
"server_ids": [
"The server ids is required."
]
}
}Account
To check your Pipetower account you can use this endpoint.
-
id stringThe unique identifier for your account.
Attributes
GET /account
curl https://app.pipetower.com/api/v1/account \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "e86bn6",
"name": "Joe Bloggs",
"email": "jbloggs@pipetower.com",
"timezone": "UTC",
"email_verified": true,
"2fa_enabled": true,
"created_at": "2023-04-09T10:56:38+00:00",
"updated_at": "2023-07-29T13:24:11+00:00"
}Retrieve your user variables
Retrieves the user variables of your account.
-
search optionalOnly return the objects whose name contains the given term.
-
limit optionalA limit on the number of objects to be returned. Limit can range between 1 and 100. The default is 15.
-
page optionalThe page of results you would like to retrieve.
Parameters
GET /account/vars
curl https://app.pipetower.com/api/v1/account/vars \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"data": [
{
"secret": false,
"name": "SYSTEM_USER",
"value": "morpheus"
},
{
"secret": true,
"name": "APP_KEY",
"value": "***"
},
{...}
],
"meta": {...}
}Create or update a user variable
Creates the variable of the given name of your account, or replaces the value of an existing one.
Returns the variable with status 201 when it was created, or 200 when it was updated, and a 422 error when the input is not valid.
-
name REQUIREDThe name of the variable, in the path. It is used as
$NAMEin commands, scripts and templates and may contain letters, digits, dashes and underscores. -
value CONDITIONALLY REQUIRED stringThe value of the variable. Only an existing secret which stays a secret may leave it out, it keeps its stored value then.
-
secret optional booleanWhether the value is a secret: it is stored encrypted, hidden in the output of runs and never returned by the API. Left out, an existing variable stays what it is and a new one is not secret.
Parameters
PUT /account/vars/:name
curl -X PUT https://app.pipetower.com/api/v1/account/vars/BRANCH \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"value": "main"}'RESPONSE
{
"secret": false,
"name": "BRANCH",
"value": "main"
}Delete a user variable
Deletes the variable of the given name of your account. Returns an empty response with status 204, or a 404 error when there is no variable of that name.
-
name REQUIREDThe name of the variable you want to delete.
Parameters
DELETE /account/vars/:name
curl -X DELETE https://app.pipetower.com/api/v1/account/vars/BRANCH \
-H "Authorization: Bearer $API_TOKEN"Servers
Servers in Pipetower represent your physical servers to which Pipetower connects and on which actions and workflows are executed.
ENDPOINTS
The server object
-
id stringThe unique identifier for the server.
-
team_id stringThe ID of the team to which this server belongs.
-
connected booleanWhether Pipetower is connected to the server via SSH.
-
metrics objectThe latest metrics of the server, sizes in bytes and usages in percent. Null if the server is not connected or no metrics are available yet. A metric which was not measured is null.
Attributes
THE SERVER OBJECT
{
"id": "r0em4n",
"team_id": "n80b40",
"name": "Pipetower",
"connected": true,
"host": "pipetower.com",
"port": 22,
"tags": [
{
"name": "prod",
"color": "#38bdf8"
}
],
"metrics": {
"hostname": "morpheus-prod",
"operating_system": "Ubuntu 22.04.3 LTS",
"kernel": "Linux 5.15.0-84-generic",
"architecture": "x86-64",
"cpu": {
"model": "Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz",
"cores": 8,
"usage_percent": 10.8
},
"load": {
"avg_1": 1.23,
"avg_5": 1.45,
"avg_15": 1.18
},
"memory": {
"total_bytes": 16407863296,
"used_bytes": 10218950656,
"used_percent": 62.28
},
"disk": {
"total_bytes": 499524440064,
"used_bytes": 175871901696,
"used_percent": 35.21
},
"measured_at": "2023-10-07T10:27:00+00:00"
},
"created_at": "2023-03-16T09:21:59+00:00",
"updated_at": "2023-10-03T17:11:03+00:00"
}List all servers
Returns a list of your servers.
-
search optionalOnly return the objects whose name contains the given term.
-
team optionalOnly return the objects of the team with the given ID.
-
tag optionalOnly return the servers with the given tag name.
-
limit optionalA limit on the number of objects to be returned. Limit can range between 1 and 100. The default is 15.
-
page optionalThe page of results you would like to retrieve.
Parameters
GET /servers
curl https://app.pipetower.com/api/v1/servers \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"data": [
{
"id": "r0em4n",
"team_id": "n80b40",
"name": "Pipetower",
"connected": true,
"host": "pipetower.com",
"port": 22,
"tags": [
{
"name": "prod",
"color": "#38bdf8"
}
],
"metrics": {
"hostname": "morpheus-prod",
"operating_system": "Ubuntu 22.04.3 LTS",
"kernel": "Linux 5.15.0-84-generic",
"architecture": "x86-64",
"cpu": {
"model": "Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz",
"cores": 8,
"usage_percent": 10.8
},
"load": {
"avg_1": 1.23,
"avg_5": 1.45,
"avg_15": 1.18
},
"memory": {
"total_bytes": 16407863296,
"used_bytes": 10218950656,
"used_percent": 62.28
},
"disk": {
"total_bytes": 499524440064,
"used_bytes": 175871901696,
"used_percent": 35.21
},
"measured_at": "2023-10-07T10:27:00+00:00"
},
"created_at": "2023-03-16T09:21:59+00:00",
"updated_at": "2023-10-03T17:11:03+00:00"
},
{...},
{...}
],
"meta": {...}
}Retrieve a server
Retrieves a server object.
-
id REQUIREDThe ID of the server you want to retrieve.
Parameters
GET /servers/:id
curl https://app.pipetower.com/api/v1/servers/:id \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "r0em4n",
"team_id": "n80b40",
"name": "Pipetower",
"connected": true,
"host": "pipetower.com",
"port": 22,
"tags": [
{
"name": "prod",
"color": "#38bdf8"
}
],
"metrics": {
"hostname": "morpheus-prod",
"operating_system": "Ubuntu 22.04.3 LTS",
"kernel": "Linux 5.15.0-84-generic",
"architecture": "x86-64",
"cpu": {
"model": "Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz",
"cores": 8,
"usage_percent": 10.8
},
"load": {
"avg_1": 1.23,
"avg_5": 1.45,
"avg_15": 1.18
},
"memory": {
"total_bytes": 16407863296,
"used_bytes": 10218950656,
"used_percent": 62.28
},
"disk": {
"total_bytes": 499524440064,
"used_bytes": 175871901696,
"used_percent": 35.21
},
"measured_at": "2023-10-07T10:27:00+00:00"
},
"created_at": "2023-03-16T09:21:59+00:00",
"updated_at": "2023-10-03T17:11:03+00:00"
}Connect a server
Establishes the SSH connection to the specified server and returns the server object.
You need to be an owner or admin of the server's team.
If the connection fails, a 422 error with the reason as message is returned.
-
id REQUIREDThe ID of the server you want to connect.
Parameters
POST /servers/:id/connect
curl -X POST https://app.pipetower.com/api/v1/servers/:id/connect \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "r0em4n",
"team_id": "n80b40",
"name": "Pipetower",
"connected": true,
"host": "pipetower.com",
"port": 22,
"tags": [
{
"name": "prod",
"color": "#38bdf8"
}
],
"metrics": {
"hostname": "morpheus-prod",
"operating_system": "Ubuntu 22.04.3 LTS",
"kernel": "Linux 5.15.0-84-generic",
"architecture": "x86-64",
"cpu": {
"model": "Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz",
"cores": 8,
"usage_percent": 10.8
},
"load": {
"avg_1": 1.23,
"avg_5": 1.45,
"avg_15": 1.18
},
"memory": {
"total_bytes": 16407863296,
"used_bytes": 10218950656,
"used_percent": 62.28
},
"disk": {
"total_bytes": 499524440064,
"used_bytes": 175871901696,
"used_percent": 35.21
},
"measured_at": "2023-10-07T10:27:00+00:00"
},
"created_at": "2023-03-16T09:21:59+00:00",
"updated_at": "2023-10-03T17:11:03+00:00"
}Disconnect a server
Closes the SSH connection to the specified server and returns the server object.
You need to be an owner or admin of the server's team.
-
id REQUIREDThe ID of the server you want to disconnect.
Parameters
POST /servers/:id/disconnect
curl -X POST https://app.pipetower.com/api/v1/servers/:id/disconnect \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "r0em4n",
"team_id": "n80b40",
"name": "Pipetower",
"connected": false,
"host": "pipetower.com",
"port": 22,
"tags": [
{
"name": "prod",
"color": "#38bdf8"
}
],
"metrics": null,
"created_at": "2023-03-16T09:21:59+00:00",
"updated_at": "2023-10-07T10:31:12+00:00"
}Retrieve a server's metrics
Retrieves the latest value of each metric of the specified server.
The server object contains the most important of them grouped in its metrics attribute.
-
id REQUIREDThe ID of the server for which you want to retrieve the metrics.
-
limit optionalA limit on the number of objects to be returned. Limit can range between 1 and 100. The default is 15.
-
page optionalThe page of results you would like to retrieve.
Parameters
GET /servers/:id/metrics
curl https://app.pipetower.com/api/v1/servers/:id/metrics \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"data": [
{
"type": "CpuModel",
"metric": "name",
"value": "Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "CpuModel",
"metric": "cpus",
"value": "8",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "HostInfo",
"metric": "hostname",
"value": "morpheus-prod",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "HostInfo",
"metric": "operating_system",
"value": "Ubuntu 22.04.3 LTS",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "HostInfo",
"metric": "kernel",
"value": "Linux 5.15.0-84-generic",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "HostInfo",
"metric": "architecture",
"value": "x86-64",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "DiskUsage",
"metric": "\/|total",
"value": "248617984",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "DiskUsage",
"metric": "\/|used",
"value": "48326376",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "DiskUsage",
"metric": "\/|available",
"value": "187589708",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "DiskUsage",
"metric": "sum|total",
"value": "487816836",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "DiskUsage",
"metric": "sum|used",
"value": "171749904",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "DiskUsage",
"metric": "\/home|total",
"value": "239198852",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "DiskUsage",
"metric": "\/home|used",
"value": "123423528",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "DiskUsage",
"metric": "\/home|available",
"value": "103551888",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "DiskUsage",
"metric": "sum|used_percent",
"value": "35.21",
"timestamp": "2023-10-07T10:26:00+00:00"
},
{
"type": "CpuUsage",
"metric": "idle",
"value": "89.2",
"timestamp": "2023-10-07T10:27:00+00:00"
},
{
"type": "CpuUsage",
"metric": "load",
"value": "10.8",
"timestamp": "2023-10-07T10:27:00+00:00"
},
{
"type": "LoadAverage",
"metric": "average_1",
"value": "1.23",
"timestamp": "2023-10-07T10:27:00+00:00"
},
{
"type": "LoadAverage",
"metric": "average_5",
"value": "1.45",
"timestamp": "2023-10-07T10:27:00+00:00"
},
{
"type": "LoadAverage",
"metric": "average_15",
"value": "1.18",
"timestamp": "2023-10-07T10:27:00+00:00"
},
{
"type": "MemoryUsage",
"metric": "mem_total",
"value": "16023304",
"timestamp": "2023-10-07T10:27:00+00:00"
},
{
"type": "MemoryUsage",
"metric": "mem_available",
"value": "6043860",
"timestamp": "2023-10-07T10:27:00+00:00"
},
{
"type": "MemoryUsage",
"metric": "mem_used",
"value": "9979444",
"timestamp": "2023-10-07T10:27:00+00:00"
},
{
"type": "MemoryUsage",
"metric": "mem_used_percent",
"value": "62.28",
"timestamp": "2023-10-07T10:27:00+00:00"
}
],
"meta": {...}
}Retrieve a server's environment variables
Retrieves the environment variables of the specified server.
-
id REQUIREDThe ID of the server for which you want to retrieve the environment variables.
-
search optionalOnly return the objects whose name contains the given term.
-
limit optionalA limit on the number of objects to be returned. Limit can range between 1 and 100. The default is 15.
-
page optionalThe page of results you would like to retrieve.
Parameters
GET /servers/:id/vars
curl https://app.pipetower.com/api/v1/servers/:id/vars \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"data": [
{
"secret": false,
"name": "SYSTEM_USER",
"value": "morpheus"
},
{
"secret": true,
"name": "APP_KEY",
"value": "***"
},
{...}
],
"meta": {...}
}Create or update a server variable
Creates the variable of the given name of the specified server, or replaces the value of an existing one.
Returns the variable with status 201 when it was created, or 200 when it was updated, and a 422 error when the input is not valid. Only owners and admins of the server's team may change its variables.
-
id REQUIREDThe ID of the server whose variable you want to create or update.
-
name REQUIREDThe name of the variable, in the path. It is used as
$NAMEin commands, scripts and templates and may contain letters, digits, dashes and underscores. -
value CONDITIONALLY REQUIRED stringThe value of the variable. Only an existing secret which stays a secret may leave it out, it keeps its stored value then.
-
secret optional booleanWhether the value is a secret: it is stored encrypted, hidden in the output of runs and never returned by the API. Left out, an existing variable stays what it is and a new one is not secret.
Parameters
PUT /servers/:id/vars/:name
curl -X PUT https://app.pipetower.com/api/v1/servers/:id/vars/BRANCH \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"value": "main"}'RESPONSE
{
"secret": false,
"name": "BRANCH",
"value": "main"
}Delete a server variable
Deletes the variable of the given name of the specified server. Returns an empty response with status 204, or a 404 error when there is no variable of that name. Only owners and admins of the server's team may change its variables.
-
id REQUIREDThe ID of the server whose variable you want to delete.
-
name REQUIREDThe name of the variable you want to delete.
Parameters
DELETE /servers/:id/vars/:name
curl -X DELETE https://app.pipetower.com/api/v1/servers/:id/vars/BRANCH \
-H "Authorization: Bearer $API_TOKEN"Definitions
A definition describes an action, a workflow, a template or a pipe completely, in one portable document.
It is what the export in Pipetower writes and the import reads, what the forms in Pipetower edit, and what
the API takes to create and update these objects.
Whatever can be configured in Pipetower can be written in a definition, with the same validation.
Definitions are written as YAML files, or as JSON when sent to the API (JSON is valid YAML, so a JSON file can be imported too).
Definitions are written as YAML files, or as JSON when sent to the API (JSON is valid YAML, so a JSON file can be imported too).
ENDPOINTS
The definition format
Every definition starts with its kind and
its name.
Other objects are always referenced by their name within the team: a workflow names its actions, a copy template step names its template,
the settings name the servers. Nothing in a definition is specific to one Pipetower account, so a definition can be imported into another team.
Optional keys may be left out, and flags which are off are left out in exports. An unknown key is an error, so a typo cannot be ignored silently.
Validation. An invalid definition is answered with a 422 error whose errors are keyed by the path in the definition, for example steps.1.conditions.0.0.step for the first condition of the second step. The syntax is checked, then every key and value, then the references within the team. With dry_run the definition is only validated and returned in its normalized form, nothing is saved.
Optional keys may be left out, and flags which are off are left out in exports. An unknown key is an error, so a typo cannot be ignored silently.
Validation. An invalid definition is answered with a 422 error whose errors are keyed by the path in the definition, for example steps.1.conditions.0.0.step for the first condition of the second step. The syntax is checked, then every key and value, then the references within the team. With dry_run the definition is only validated and returned in its normalized form, nothing is saved.
A MINIMAL ACTION DEFINITION
kind: action
name: Update packages
steps:
- name: Update
type: execute_command
command: sudo apt update && sudo apt upgrade -yVALIDATION ERROR RESPONSE
{
"message": "The steps.1.conditions.0.0.step field: Only a previous step can be the source (step 1 at most) (and 2 more errors)",
"errors": {
"steps.1.conditions.0.0.step": [
"Only a previous step can be the source (step 1 at most)"
],
"steps.2.template": [
"Unknown template \"Nginx vhost\" in the team"
],
"steps.3.sudoo": [
"Unknown key \"sudoo\", possible are: name, type, conditions, continue_rule, script, sudo"
]
}
}DRY RUN RESPONSE
{
"valid": true,
"definition": {
"kind": "template",
"name": "Application .env",
"tags": [
"config"
],
"file_name": ".env",
"content": "APP_ENV=production\nAPP_DEBUG=false\nAPP_URL=https:\/\/$SERVER_HOST"
}
}The action definition
-
kind stringThe kind of the definition: action, workflow, template or pipe. Optional in requests, where the endpoint says what is created.
-
name stringThe name, unique within the team. It's the identity of the object in definitions: workflows reference actions by name, actions reference templates by name.
-
tags array of stringsOptional. The names of the tags, unknown tags are created in the team.
-
settings.run_restricted_servers array of stringsOptional. The names of the servers of the team the action may run on. Without it, it may run on all servers.
-
variables array of objectsOptional. The variables which have to be provided on run, each with a name (letters, numbers, dashes, underscores), a type (text, the default, or selection) and for a selection the possible values as list. A variable which is optional needs no value on run, it is empty then.
-
steps array of objectsThe steps in their order, at least one. Every step has a name and a type, the keys of its type, and optionally conditions and a continue_rule.
-
steps.*.type stringexecute_command: a command, optionally with expectations, a list of expect/send rules (expect, send, regex, match_case) answering prompts of the command.
execute_shell_script: a script, optionally run as sudo.
copy_template: the template by name (or embedded as object with name, file_name and content, which creates or updates it), the dst_path and optionally the dst_file (default: the file name of the template), overwrite and sudo.
modify_file: the file and the modifications, a list of find/replace rules (find, replace, regex, words, match_case), optionally as sudo. -
steps.*.conditions array of arraysOptional. The conditions under which the step is executed: a list of groups, of which at least one must be fulfilled (OR), each a list of conditions which must all be fulfilled (AND). A condition has a source, either step (the number of a previous step, starting at 1) or variable (the name of a variable), a rule and, for the rules which compare with something, a value. Rules on the execution of a step: exec_successful, exec_failed, exec_partially_failed, exec_skipped, exec_terminated, exec_not_allowed. Rules on the output of a step or the value of a variable: output_exists, output_not_exists and, with a value, output_contains, output_not_contains, output_equal, output_not_equal, output_greater_than, output_less_than, output_starts_with, output_not_starts_with, output_ends_with, output_not_ends_with, output_matches_regex.
-
steps.*.continue_rule objectOptional. Continue the run although the step failed if its output matches the text, compared as regex and/or match_case if set.
Attributes
ACTION DEFINITION WITH EVERY OPTION
# An action: steps executed one after the other on a server.
# kind: what the file describes. name: unique in the team, other objects are referenced by their
# names.
# Optional keys may be left out, a flag which is left out is off. Unknown keys are rejected.
# tags: names of tags, unknown ones are created in the team.
# settings.run_restricted_servers: names of the servers the action may run on, left out it may run
# on all servers of the team.
# variables: what has to be given when the action runs, usable as $NAME in commands, scripts and
# templates. A name has letters, digits, dashes and underscores. type: text (the default) or
# selection with its possible values. optional: the value may be left out on run, the variable is
# empty then.
# steps: in their order, each with a name, a type and the keys of its type:
# execute_command: command. Optional expectations answer prompts of the command: expect (text or
# regex) and send, {enter} sends the Enter key.
# execute_shell_script: script, optionally as sudo.
# copy_template: template (name of a template of the team, or an embedded one with name, file_name
# and content), dst_path, dst_file (default: the file name of the template), overwrite and sudo.
# modify_file: file and modifications, each a find and replace, as regex, only whole words or
# match_case; sudo.
# conditions: groups of conditions, at least one group must be fulfilled (OR), within a group all
# conditions must be (AND). A condition has a source, either step: <number of a previous step,
# counted from 1> or variable: <name of a variable of the action>, and a rule.
# Rules on how a step was executed (steps only): exec_successful, exec_failed,
# exec_partially_failed, exec_skipped, exec_terminated, exec_not_allowed.
# Rules on the output of a step or the value of a variable: output_exists, output_not_exists, and,
# with a value to compare with: output_contains, output_not_contains, output_equal,
# output_not_equal, output_greater_than, output_less_than, output_starts_with,
# output_not_starts_with, output_ends_with, output_not_ends_with, output_matches_regex.
# continue_rule: go on although the step failed if its output matches the text (regex, match_case).
kind: action
name: 'Deploy application'
tags:
- deploy
- web
settings:
run_restricted_servers:
- web-1
- web-2
variables:
- name: BRANCH
type: text
- name: ENVIRONMENT
type: selection
values:
- staging
- production
- name: COMMIT
type: text
optional: true
steps:
- name: 'Pull the code'
type: execute_command
command: 'cd /var/www/app && git pull origin $BRANCH'
expectations:
- expect: 'Password for'
send: '$GIT_PASSWORD{enter}'
regex: false
match_case: true
continue_rule:
text: 'Already up to date'
regex: false
match_case: false
- name: 'Check out the commit'
type: execute_command
command: 'cd /var/www/app && git checkout $COMMIT'
conditions:
- - variable: COMMIT
rule: output_exists
- name: 'Write the environment file'
type: copy_template
template: 'Application .env'
dst_path: /var/www/app/
dst_file: .env
overwrite: true
sudo: false
conditions:
- - step: 1
rule: exec_successful
- name: 'Set the environment'
type: modify_file
file: /var/www/app/.env
sudo: false
modifications:
- find: '^APP_ENV=.*$'
replace: APP_ENV=$ENVIRONMENT
regex: true
words: false
match_case: true
- find: debug
replace: 'false'
regex: false
words: true
match_case: false
- name: 'Restart the services'
type: execute_shell_script
script: |-
#!/bin/sh
systemctl restart php-fpm
systemctl reload nginx
sudo: true
conditions:
- - step: 1
rule: exec_successful
- variable: ENVIRONMENT
rule: output_equal
value: production
- - step: 4
rule: output_contains
value: 'restart required'The workflow definition
-
kind stringThe kind of the definition: action, workflow, template or pipe. Optional in requests, where the endpoint says what is created.
-
name stringThe name, unique within the team. It's the identity of the object in definitions: workflows reference actions by name, actions reference templates by name.
-
tags array of stringsOptional. The names of the tags, unknown tags are created in the team.
-
settings.run_restricted_servers array of stringsOptional. The names of the servers of the team the workflow may run on. Without it, it may run on all servers.
-
variables array of objectsOptional. The variables which have to be provided on run, each with a name (letters, numbers, dashes, underscores), a type (text, the default, or selection) and for a selection the possible values as list. A variable which is optional needs no value on run, it is empty then.
-
steps array of objectsThe actions to execute in their order, at least one. Every step names its action and optionally fixes variables of the action (name to value; a variable without value is asked on run) and has conditions.
-
steps.*.conditions array of arraysOptional. The conditions under which the step is executed: a list of groups, of which at least one must be fulfilled (OR), each a list of conditions which must all be fulfilled (AND). A condition has a source, either step (the number of a previous step, that is its action, starting at 1) or variable (the name of a workflow variable or of a variable of a previous action), a rule and, for the rules which compare with something, a value. Rules on the execution of a step: exec_successful, exec_failed, exec_partially_failed, exec_skipped, exec_terminated, exec_not_allowed. Rules on the output of a step or the value of a variable: output_exists, output_not_exists and, with a value, output_contains, output_not_contains, output_equal, output_not_equal, output_greater_than, output_less_than, output_starts_with, output_not_starts_with, output_ends_with, output_not_ends_with, output_matches_regex.
Attributes
WORKFLOW DEFINITION WITH EVERY OPTION
# A workflow: actions executed one after the other on a server.
# kind: what the file describes. name: unique in the team, other objects are referenced by their
# names.
# Optional keys may be left out, a flag which is left out is off. Unknown keys are rejected.
# tags: names of tags, unknown ones are created in the team.
# settings.run_restricted_servers: names of the servers the workflow may run on, left out it may run
# on all servers of the team.
# variables: what has to be given when the workflow runs, usable as $NAME in commands, scripts and
# templates. A name has letters, digits, dashes and underscores. type: text (the default) or
# selection with its possible values. optional: the value may be left out on run, the variable is
# empty then.
# steps: in their order, each the name of an action of the team. variables fixes values of the
# variables of that action (name: value), a variable without a fixed value is asked when the
# workflow runs.
# conditions: groups of conditions, at least one group must be fulfilled (OR), within a group all
# conditions must be (AND). A condition has a source, either step: <number of a previous step, i.e.
# its action, counted from 1> or variable: <name of a workflow variable or of a variable of a
# previous action>, and a rule.
# Rules on how a step was executed (steps only): exec_successful, exec_failed,
# exec_partially_failed, exec_skipped, exec_terminated, exec_not_allowed.
# Rules on the output of a step or the value of a variable: output_exists, output_not_exists, and,
# with a value to compare with: output_contains, output_not_contains, output_equal,
# output_not_equal, output_greater_than, output_less_than, output_starts_with,
# output_not_starts_with, output_ends_with, output_not_ends_with, output_matches_regex.
kind: workflow
name: Release
tags:
- deploy
settings:
run_restricted_servers:
- web-1
variables:
- name: BRANCH
type: text
- name: ENVIRONMENT
type: selection
values:
- staging
- production
- name: COMMIT
type: text
optional: true
steps:
- action: 'Run the tests'
variables:
BRANCH: main
- action: 'Deploy application'
variables:
BRANCH: ''
conditions:
- - step: 1
rule: exec_successful
- variable: ENVIRONMENT
rule: output_equal
value: production
- - step: 1
rule: output_contains
value: 'skip tests'The template definition
-
kind stringThe kind of the definition: action, workflow, template or pipe. Optional in requests, where the endpoint says what is created.
-
name stringThe name, unique within the team. It's the identity of the object in definitions: workflows reference actions by name, actions reference templates by name.
-
tags array of stringsOptional. The names of the tags, unknown tags are created in the team.
-
file_name stringThe name of the file the template is copied to by default.
-
content stringThe content of the file, placeholders included.
Attributes
TEMPLATE DEFINITION WITH EVERY OPTION
# A template: a file which copy_template steps of actions write to a server, placeholders like $NAME
# are replaced.
# kind: what the file describes. name: unique in the team, other objects are referenced by their
# names.
# Optional keys may be left out, a flag which is left out is off. Unknown keys are rejected.
# tags: names of tags, unknown ones are created in the team.
# file_name: the name the file gets on the server unless the step says otherwise. content: the file.
kind: template
name: 'Application .env'
tags:
- config
file_name: .env
content: |-
APP_ENV=production
APP_DEBUG=false
APP_URL=https://$SERVER_HOSTThe pipe definition
-
kind stringThe kind of the definition: action, workflow, template or pipe. Optional in requests, where the endpoint says what is created.
-
name stringThe name, unique within the team.
-
active booleanOptional. The trigger only fires while the pipe is active. Left out, the pipe is inactive.
-
tags array of stringsOptional. The names of the tags, unknown tags are created in the team.
-
trigger objectWhen the pipe runs, by its type: schedule with every (hour, day, week or month), the time as hour 0-23 (day, week, month), the day (monday-sunday for a week, 1-31 for a month) and weekends to also fire on weekends (hour, day); metric with the metric (cpu_usage, used_disk_space, used_memory, load_average_1, load_average_5, load_average_15), the threshold and the watched servers and server_tags by name; webhook, whose URL is shown with the pipe and kept when the pipe is updated; action or workflow with the name of the action or workflow whose execution fires it.
-
steps array of objectsWhat runs in its order, at least one step, by its type: action or workflow with the name of the action or workflow, on servers and server_tags by name, on the servers the trigger fired on (trigger_servers) and on the other servers of the team (other_servers), with variables which fixes values of its variables (name to value; a variable which is not optional needs one, unless a webhook sends it); notification with the channel (email, the default), the recipients as email addresses of members of the team and a message.
-
steps.*.conditions array of arraysOptional. The conditions under which the step is executed: a list of groups, of which at least one must be fulfilled (OR), each a list of conditions which must all be fulfilled (AND). A condition checks either a field of the trigger or a previous action or workflow step (its number, starting at 1), with a rule and, for the rules which compare with something, a value. The trigger fields: for a schedule date_day, date_month, date_year, pretty_day_of_week, day_of_week, time_hour, time_minute, time_second; for a metric metric_value_percent; for a webhook payload; for an action or workflow action or workflow. Where the source ran on servers (a step, the action or workflow of the trigger, the metric), servers says if any (the default), all or none of them must fulfill the condition, or server names the one which is checked. The rules are the same as in workflows: exec_successful, exec_failed, exec_partially_failed, exec_skipped, exec_terminated, exec_not_allowed, output_exists, output_not_exists and, with a value, output_contains, output_not_contains, output_equal, output_not_equal, output_greater_than, output_less_than, output_starts_with, output_not_starts_with, output_ends_with, output_not_ends_with, output_matches_regex.
Attributes
PIPE DEFINITION WITH EVERY OPTION
# A pipe: when its trigger fires, its steps are executed one after the other.
# kind: what the file describes. name: unique in the team, other objects are referenced by their
# names.
# Optional keys may be left out, a flag which is left out is off. Unknown keys are rejected.
# active: the trigger only fires while the pipe is active.
# tags: names of tags, unknown ones are created in the team.
# trigger.type: action, metric, schedule, webhook, workflow.
# schedule: every: hour, day, week or month. time: the hour 0-23 (day, week, month). day:
# monday-sunday (week) or 1-31 (month). weekends: also fire on weekends (hour, day).
# metric: fires when the metric of a server reaches the threshold (percent, or the load). metric:
# cpu_usage, used_disk_space, used_memory, load_average_1, load_average_5, load_average_15.
# servers and server_tags: names of the watched servers and tags.
# webhook: fires when its URL is called, the URL is shown with the pipe and kept when the pipe is
# updated. action, workflow: fires when the action or workflow with this name was executed.
# steps: in their order, type: notification, action, workflow.
# action, workflow: the action or workflow with this name, on servers and server_tags (names), and
# trigger_servers: the servers the trigger fired on, other_servers: the other servers of the team.
# variables fixes values of its variables (name: value), a variable which is not optional needs
# one unless a webhook sends it.
# notification: channel (email, the default) to the recipients, email addresses of members of the
# team, with a message.
# conditions: groups of conditions, at least one group must be fulfilled (OR), within a group all
# conditions must be (AND). A condition checks either trigger: <field of the trigger> or step:
# <number of a previous action or workflow step, counted from 1>, with a rule.
# Trigger fields: schedule: date_day, date_month, date_year, pretty_day_of_week, day_of_week,
# time_hour, time_minute, time_second; metric: metric_value_percent; webhook: payload; action:
# action; workflow: workflow.
# Rules on how it was executed: exec_successful, exec_failed, exec_partially_failed, exec_skipped,
# exec_terminated, exec_not_allowed.
# Rules on the output or the value: output_exists, output_not_exists, and, with a value to compare
# with: output_contains, output_not_contains, output_equal, output_not_equal, output_greater_than,
# output_less_than, output_starts_with, output_not_starts_with, output_ends_with,
# output_not_ends_with, output_matches_regex.
# A step, the action or workflow of the trigger and the metric ran on servers: servers: any (the
# default), all or none of them must fulfill the condition, or server: <name> checks one of them.
kind: pipe
name: 'Restart on high load'
active: true
tags:
- ops
trigger:
type: metric
metric: cpu_usage
threshold: 90
servers:
- web-1
server_tags:
- web
steps:
- type: action
action: 'Restart services'
servers:
- web-2
server_tags:
- workers
trigger_servers: true
other_servers: true
variables:
SERVICE: php-fpm
conditions:
- - trigger: metric_value_percent
rule: output_greater_than
value: '95'
servers: any
- type: workflow
workflow: 'Scale out'
servers:
- web-1
server_tags:
- web
trigger_servers: true
other_servers: true
variables:
REPLICAS: '2'
conditions:
- - step: 1
rule: exec_failed
servers: all
- type: notification
channel: email
recipients:
- ops@example.com
message: 'The load stayed high'
conditions:
- - step: 2
rule: output_contains
value: error
server: web-1Retrieve an example definition
Retrieves a definition of the given kind which uses every option there is, the ones shown above. It is generated by Pipetower itself,
so it's always complete for the current version.
-
kind REQUIREDaction, workflow, template or pipe.
-
format optionalyaml to get the example as YAML file instead of JSON.
Parameters
GET /definitions/:kind/example
curl https://app.pipetower.com/api/v1/definitions/action/example?format=yaml \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
# An action: steps executed one after the other on a server.
# kind: what the file describes. name: unique in the team, other objects are referenced by their
# names.
# Optional keys may be left out, a flag which is left out is off. Unknown keys are rejected.
# tags: names of tags, unknown ones are created in the team.
# settings.run_restricted_servers: names of the servers the action may run on, left out it may run
# on all servers of the team.
# variables: what has to be given when the action runs, usable as $NAME in commands, scripts and
# templates. A name has letters, digits, dashes and underscores. type: text (the default) or
# selection with its possible values. optional: the value may be left out on run, the variable is
# empty then.
# steps: in their order, each with a name, a type and the keys of its type:
# execute_command: command. Optional expectations answer prompts of the command: expect (text or
# regex) and send, {enter} sends the Enter key.
# execute_shell_script: script, optionally as sudo.
# copy_template: template (name of a template of the team, or an embedded one with name, file_name
# and content), dst_path, dst_file (default: the file name of the template), overwrite and sudo.
# modify_file: file and modifications, each a find and replace, as regex, only whole words or
# match_case; sudo.
# conditions: groups of conditions, at least one group must be fulfilled (OR), within a group all
# conditions must be (AND). A condition has a source, either step: <number of a previous step,
# counted from 1> or variable: <name of a variable of the action>, and a rule.
# Rules on how a step was executed (steps only): exec_successful, exec_failed,
# exec_partially_failed, exec_skipped, exec_terminated, exec_not_allowed.
# Rules on the output of a step or the value of a variable: output_exists, output_not_exists, and,
# with a value to compare with: output_contains, output_not_contains, output_equal,
# output_not_equal, output_greater_than, output_less_than, output_starts_with,
# output_not_starts_with, output_ends_with, output_not_ends_with, output_matches_regex.
# continue_rule: go on although the step failed if its output matches the text (regex, match_case).
kind: action
name: 'Deploy application'
tags:
- deploy
- web
settings:
run_restricted_servers:
- web-1
- web-2
variables:
- name: BRANCH
type: text
- name: ENVIRONMENT
type: selection
values:
- staging
- production
- name: COMMIT
type: text
optional: true
steps:
- name: 'Pull the code'
type: execute_command
command: 'cd /var/www/app && git pull origin $BRANCH'
expectations:
- expect: 'Password for'
send: '$GIT_PASSWORD{enter}'
regex: false
match_case: true
continue_rule:
text: 'Already up to date'
regex: false
match_case: false
- name: 'Check out the commit'
type: execute_command
command: 'cd /var/www/app && git checkout $COMMIT'
conditions:
- - variable: COMMIT
rule: output_exists
- name: 'Write the environment file'
type: copy_template
template: 'Application .env'
dst_path: /var/www/app/
dst_file: .env
overwrite: true
sudo: false
conditions:
- - step: 1
rule: exec_successful
- name: 'Set the environment'
type: modify_file
file: /var/www/app/.env
sudo: false
modifications:
- find: '^APP_ENV=.*$'
replace: APP_ENV=$ENVIRONMENT
regex: true
words: false
match_case: true
- find: debug
replace: 'false'
regex: false
words: true
match_case: false
- name: 'Restart the services'
type: execute_shell_script
script: |-
#!/bin/sh
systemctl restart php-fpm
systemctl reload nginx
sudo: true
conditions:
- - step: 1
rule: exec_successful
- variable: ENVIRONMENT
rule: output_equal
value: production
- - step: 4
rule: output_contains
value: 'restart required'Actions
Actions define the tasks that can be automated, like executing commands.
ENDPOINTS
The action object
-
id stringThe unique identifier for the action.
-
team_id stringThe ID of the team to which this action belongs.
-
allowed_servers array|nullThe servers (ID and name) on which the action may run, if its settings restrict it to some. Null if it may run on all servers of its team.
Attributes
THE ACTION OBJECT
{
"id": "92eb93",
"team_id": "n80b40",
"name": "Install UFW",
"steps": [
{
"order": 0,
"type": "execute_command",
"name": "Install",
"execution": {
"command": "sudo apt install ufw"
}
},
{
"order": 1,
"type": "execute_command",
"name": "Enable",
"execution": {
"command": "sudo ufw enable",
"expectations": [
{
"send": "y",
"regex": true,
"expect": "Proceed(.*)"
}
],
"with_expectations": true
}
}
],
"variables": [
{
"name": "PORT",
"type": "text"
}
],
"allowed_servers": [
{
"id": "m2e9k4",
"name": "web-01"
}
],
"tags": [],
"created_at": "2023-08-19T09:05:11+00:00",
"updated_at": "2023-08-20T12:45:53+00:00"
}List all actions
Returns a list of your actions.
-
search optionalOnly return the objects whose name contains the given term.
-
team optionalOnly return the objects of the team with the given ID.
-
limit optionalA limit on the number of objects to be returned. Limit can range between 1 and 100. The default is 15.
-
page optionalThe page of results you would like to retrieve.
Parameters
GET /actions
curl https://app.pipetower.com/api/v1/actions \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"data": [
{
"id": "92eb93",
"team_id": "n80b40",
"name": "Install UFW",
"steps": [
{
"order": 0,
"type": "execute_command",
"name": "Install",
"execution": {
"command": "sudo apt install ufw"
}
},
{
"order": 1,
"type": "execute_command",
"name": "Enable",
"execution": {
"command": "sudo ufw enable",
"expectations": [
{
"send": "y",
"regex": true,
"expect": "Proceed(.*)"
}
],
"with_expectations": true
}
}
],
"variables": [
{
"name": "PORT",
"type": "text"
}
],
"allowed_servers": [
{
"id": "m2e9k4",
"name": "web-01"
}
],
"tags": [],
"created_at": "2023-08-19T09:05:11+00:00",
"updated_at": "2023-08-20T12:45:53+00:00"
},
{...},
{...}
],
"meta": {...}
}Retrieve an action
Retrieves an action object.
-
id REQUIREDThe ID of the action you want to retrieve.
Parameters
GET /actions/:id
curl https://app.pipetower.com/api/v1/actions/:id \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "92eb93",
"team_id": "n80b40",
"name": "Install UFW",
"steps": [
{
"order": 0,
"type": "execute_command",
"name": "Install",
"execution": {
"command": "sudo apt install ufw"
}
},
{
"order": 1,
"type": "execute_command",
"name": "Enable",
"execution": {
"command": "sudo ufw enable",
"expectations": [
{
"send": "y",
"regex": true,
"expect": "Proceed(.*)"
}
],
"with_expectations": true
}
}
],
"variables": [
{
"name": "PORT",
"type": "text"
}
],
"allowed_servers": [
{
"id": "m2e9k4",
"name": "web-01"
}
],
"tags": [],
"created_at": "2023-08-19T09:05:11+00:00",
"updated_at": "2023-08-20T12:45:53+00:00"
}Create an action
Creates an action from its definition: the request body is the definition
as one JSON document, exactly as an export file but in JSON. Only name and steps are required, everything else is optional.
The two parameters below are the only keys which are not part of the definition.
Names of referenced objects are resolved in the team, unknown tags are created.
Returns the created action object, or a 422 error with the problems by definition path.
-
team CONDITIONALLY REQUIREDThe ID or name of the team in which the action is created. Required if you are a member of several teams.
-
dry_run optional booleanOnly validate the definition without creating anything. Returns the normalized definition if it's valid.
Parameters
POST /actions
curl -X POST https://app.pipetower.com/api/v1/actions \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d @action.jsonACTION.JSON
{
"kind": "action",
"name": "Deploy application",
"tags": [
"deploy",
"web"
],
"settings": {
"run_restricted_servers": [
"web-1",
"web-2"
]
},
"variables": [
{
"name": "BRANCH",
"type": "text"
},
{
"name": "ENVIRONMENT",
"type": "selection",
"values": [
"staging",
"production"
]
},
{
"name": "COMMIT",
"type": "text",
"optional": true
}
],
"steps": [
{
"name": "Pull the code",
"type": "execute_command",
"command": "cd \/var\/www\/app && git pull origin $BRANCH",
"expectations": [
{
"expect": "Password for",
"send": "$GIT_PASSWORD{enter}",
"regex": false,
"match_case": true
}
],
"continue_rule": {
"text": "Already up to date",
"regex": false,
"match_case": false
}
},
{
"name": "Check out the commit",
"type": "execute_command",
"command": "cd \/var\/www\/app && git checkout $COMMIT",
"conditions": [
[
{
"variable": "COMMIT",
"rule": "output_exists"
}
]
]
},
{
"name": "Write the environment file",
"type": "copy_template",
"template": "Application .env",
"dst_path": "\/var\/www\/app\/",
"dst_file": ".env",
"overwrite": true,
"sudo": false,
"conditions": [
[
{
"step": 1,
"rule": "exec_successful"
}
]
]
},
{
"name": "Set the environment",
"type": "modify_file",
"file": "\/var\/www\/app\/.env",
"sudo": false,
"modifications": [
{
"find": "^APP_ENV=.*$",
"replace": "APP_ENV=$ENVIRONMENT",
"regex": true,
"words": false,
"match_case": true
},
{
"find": "debug",
"replace": "false",
"regex": false,
"words": true,
"match_case": false
}
]
},
{
"name": "Restart the services",
"type": "execute_shell_script",
"script": "#!\/bin\/sh\n\nsystemctl restart php-fpm\nsystemctl reload nginx",
"sudo": true,
"conditions": [
[
{
"step": 1,
"rule": "exec_successful"
},
{
"variable": "ENVIRONMENT",
"rule": "output_equal",
"value": "production"
}
],
[
{
"step": 4,
"rule": "output_contains",
"value": "restart required"
}
]
]
}
]
}RESPONSE
{
"id": "92eb93",
"team_id": "n80b40",
"name": "Install UFW",
"steps": [
{
"order": 0,
"type": "execute_command",
"name": "Install",
"execution": {
"command": "sudo apt install ufw"
}
},
{
"order": 1,
"type": "execute_command",
"name": "Enable",
"execution": {
"command": "sudo ufw enable",
"expectations": [
{
"send": "y",
"regex": true,
"expect": "Proceed(.*)"
}
],
"with_expectations": true
}
}
],
"variables": [
{
"name": "PORT",
"type": "text"
}
],
"allowed_servers": [
{
"id": "m2e9k4",
"name": "web-01"
}
],
"tags": [],
"created_at": "2023-08-19T09:05:11+00:00",
"updated_at": "2023-08-20T12:45:53+00:00"
}Update an action
Replaces the action with the definition in the request body, one JSON document
like on creation: the whole action is described again, not only the changes. Retrieve the current definition, change it and send it back.
Returns the updated action object, or a 422 error with the problems by definition path.
-
id REQUIREDThe ID of the action you want to update.
-
dry_run optional booleanOnly validate the definition without changing anything.
Parameters
PUT /actions/:id
curl -X PUT https://app.pipetower.com/api/v1/actions/:id \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d @action.jsonRESPONSE
{
"id": "92eb93",
"team_id": "n80b40",
"name": "Install UFW",
"steps": [
{
"order": 0,
"type": "execute_command",
"name": "Install",
"execution": {
"command": "sudo apt install ufw"
}
},
{
"order": 1,
"type": "execute_command",
"name": "Enable",
"execution": {
"command": "sudo ufw enable",
"expectations": [
{
"send": "y",
"regex": true,
"expect": "Proceed(.*)"
}
],
"with_expectations": true
}
}
],
"variables": [
{
"name": "PORT",
"type": "text"
}
],
"allowed_servers": [
{
"id": "m2e9k4",
"name": "web-01"
}
],
"tags": [],
"created_at": "2023-08-19T09:05:11+00:00",
"updated_at": "2023-08-20T12:45:53+00:00"
}Delete an action
Deletes the action. Returns an empty response with status 204, or a 409 error with the objects which still use the action,
in which case it is not deleted.
-
id REQUIREDThe ID of the action you want to delete.
Parameters
DELETE /actions/:id
curl -X DELETE https://app.pipetower.com/api/v1/actions/:id \
-H "Authorization: Bearer $API_TOKEN"RESPONSE WHEN STILL USED (409)
{
"message": "The action is used by other objects and cannot be deleted.",
"used_by": [
{
"type": "workflow",
"id": "4f7a2c",
"name": "Release"
}
]
}Retrieve an action's definition
Retrieves the definition of the action, the same content the export file has.
Send it back to update the action or to create a copy.
-
id REQUIREDThe ID of the action for which you want to retrieve the definition.
Parameters
GET /actions/:id/definition
curl https://app.pipetower.com/api/v1/actions/:id/definition \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"kind": "action",
"name": "Deploy application",
"tags": [
"deploy",
"web"
],
"settings": {
"run_restricted_servers": [
"web-1",
"web-2"
]
},
"variables": [
{
"name": "BRANCH",
"type": "text"
},
{
"name": "ENVIRONMENT",
"type": "selection",
"values": [
"staging",
"production"
]
},
{
"name": "COMMIT",
"type": "text",
"optional": true
}
],
"steps": [
{
"name": "Pull the code",
"type": "execute_command",
"command": "cd \/var\/www\/app && git pull origin $BRANCH",
"expectations": [
{
"expect": "Password for",
"send": "$GIT_PASSWORD{enter}",
"regex": false,
"match_case": true
}
],
"continue_rule": {
"text": "Already up to date",
"regex": false,
"match_case": false
}
},
{
"name": "Check out the commit",
"type": "execute_command",
"command": "cd \/var\/www\/app && git checkout $COMMIT",
"conditions": [
[
{
"variable": "COMMIT",
"rule": "output_exists"
}
]
]
},
{
"name": "Write the environment file",
"type": "copy_template",
"template": "Application .env",
"dst_path": "\/var\/www\/app\/",
"dst_file": ".env",
"overwrite": true,
"sudo": false,
"conditions": [
[
{
"step": 1,
"rule": "exec_successful"
}
]
]
},
{
"name": "Set the environment",
"type": "modify_file",
"file": "\/var\/www\/app\/.env",
"sudo": false,
"modifications": [
{
"find": "^APP_ENV=.*$",
"replace": "APP_ENV=$ENVIRONMENT",
"regex": true,
"words": false,
"match_case": true
},
{
"find": "debug",
"replace": "false",
"regex": false,
"words": true,
"match_case": false
}
]
},
{
"name": "Restart the services",
"type": "execute_shell_script",
"script": "#!\/bin\/sh\n\nsystemctl restart php-fpm\nsystemctl reload nginx",
"sudo": true,
"conditions": [
[
{
"step": 1,
"rule": "exec_successful"
},
{
"variable": "ENVIRONMENT",
"rule": "output_equal",
"value": "production"
}
],
[
{
"step": 4,
"rule": "output_contains",
"value": "restart required"
}
]
]
}
]
}Workflows
Workflows are sequences of Actions that are executed one after the other.
ENDPOINTS
The workflow object
-
id stringThe unique identifier for the workflow.
-
team_id stringThe ID of the team to which this workflow belongs.
-
allowed_servers array|nullThe servers (ID and name) on which the workflow may run, if its settings restrict it to some. Null if it may run on all servers of its team.
-
steps.*.action objectThe ID and name of the action which is executed in this step. Null if the action does not exist anymore.
Attributes
THE WORKFLOW OBJECT
{
"id": "m5e8kv",
"team_id": "n80b40",
"name": "Initial server setup",
"steps": [
{
"order": 0,
"action": {
"id": "92e843",
"name": "Update packages"
},
"execution": {
"action": "92e843"
}
},
{
"order": 1,
"action": {
"id": "36b28n",
"name": "Create system user"
},
"execution": {
"action": "36b28n"
}
},
{
"order": 2,
"action": {
"id": "83k1m8",
"name": "Deploy application"
},
"execution": {
"action": "83k1m8",
"conditions": [
[
{
"condition_rule": "exec_successful|bool",
"condition_value": "",
"condition_action": "1|36b28n"
}
]
]
}
}
],
"variables": [
{
"name": "BRANCH",
"type": "selection",
"values": "main,dev"
}
],
"allowed_servers": [
{
"id": "m2e9k4",
"name": "web-01"
}
],
"tags": [],
"created_at": "2023-07-08T14:42:23+00:00",
"updated_at": "2023-08-26T12:34:04+00:00"
}List all workflows
Returns a list of your workflows.
-
search optionalOnly return the objects whose name contains the given term.
-
team optionalOnly return the objects of the team with the given ID.
-
limit optionalA limit on the number of objects to be returned. Limit can range between 1 and 100. The default is 15.
-
page optionalThe page of results you would like to retrieve.
Parameters
GET /workflows
curl https://app.pipetower.com/api/v1/workflows \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"data": [
{
"id": "m5e8kv",
"team_id": "n80b40",
"name": "Initial server setup",
"steps": [
{
"order": 0,
"action": {
"id": "92e843",
"name": "Update packages"
},
"execution": {
"action": "92e843"
}
},
{
"order": 1,
"action": {
"id": "36b28n",
"name": "Create system user"
},
"execution": {
"action": "36b28n"
}
},
{
"order": 2,
"action": {
"id": "83k1m8",
"name": "Deploy application"
},
"execution": {
"action": "83k1m8",
"conditions": [
[
{
"condition_rule": "exec_successful|bool",
"condition_value": "",
"condition_action": "1|36b28n"
}
]
]
}
}
],
"variables": [
{
"name": "BRANCH",
"type": "selection",
"values": "main,dev"
}
],
"allowed_servers": [
{
"id": "m2e9k4",
"name": "web-01"
}
],
"tags": [],
"created_at": "2023-07-08T14:42:23+00:00",
"updated_at": "2023-08-26T12:34:04+00:00"
},
{...},
{...}
],
"meta": {...}
}Retrieve a workflow
Retrieves a workflow object.
-
id REQUIREDThe ID of the workflow you want to retrieve.
Parameters
GET /workflows/:id
curl https://app.pipetower.com/api/v1/workflows/:id \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "m5e8kv",
"team_id": "n80b40",
"name": "Initial server setup",
"steps": [
{
"order": 0,
"action": {
"id": "92e843",
"name": "Update packages"
},
"execution": {
"action": "92e843"
}
},
{
"order": 1,
"action": {
"id": "36b28n",
"name": "Create system user"
},
"execution": {
"action": "36b28n"
}
},
{
"order": 2,
"action": {
"id": "83k1m8",
"name": "Deploy application"
},
"execution": {
"action": "83k1m8",
"conditions": [
[
{
"condition_rule": "exec_successful|bool",
"condition_value": "",
"condition_action": "1|36b28n"
}
]
]
}
}
],
"variables": [
{
"name": "BRANCH",
"type": "selection",
"values": "main,dev"
}
],
"allowed_servers": [
{
"id": "m2e9k4",
"name": "web-01"
}
],
"tags": [],
"created_at": "2023-07-08T14:42:23+00:00",
"updated_at": "2023-08-26T12:34:04+00:00"
}Create a workflow
Creates a workflow from its definition: the request body is the definition
as one JSON document, exactly as an export file but in JSON. Only name and steps are required, everything else is optional.
The two parameters below are the only keys which are not part of the definition.
Names of referenced objects are resolved in the team, unknown tags are created.
Returns the created workflow object, or a 422 error with the problems by definition path.
-
team CONDITIONALLY REQUIREDThe ID or name of the team in which the workflow is created. Required if you are a member of several teams.
-
dry_run optional booleanOnly validate the definition without creating anything. Returns the normalized definition if it's valid.
Parameters
POST /workflows
curl -X POST https://app.pipetower.com/api/v1/workflows \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d @workflow.jsonWORKFLOW.JSON
{
"kind": "workflow",
"name": "Release",
"tags": [
"deploy"
],
"settings": {
"run_restricted_servers": [
"web-1"
]
},
"variables": [
{
"name": "BRANCH",
"type": "text"
},
{
"name": "ENVIRONMENT",
"type": "selection",
"values": [
"staging",
"production"
]
},
{
"name": "COMMIT",
"type": "text",
"optional": true
}
],
"steps": [
{
"action": "Run the tests",
"variables": {
"BRANCH": "main"
}
},
{
"action": "Deploy application",
"variables": {
"BRANCH": ""
},
"conditions": [
[
{
"step": 1,
"rule": "exec_successful"
},
{
"variable": "ENVIRONMENT",
"rule": "output_equal",
"value": "production"
}
],
[
{
"step": 1,
"rule": "output_contains",
"value": "skip tests"
}
]
]
}
]
}RESPONSE
{
"id": "m5e8kv",
"team_id": "n80b40",
"name": "Initial server setup",
"steps": [
{
"order": 0,
"action": {
"id": "92e843",
"name": "Update packages"
},
"execution": {
"action": "92e843"
}
},
{
"order": 1,
"action": {
"id": "36b28n",
"name": "Create system user"
},
"execution": {
"action": "36b28n"
}
},
{
"order": 2,
"action": {
"id": "83k1m8",
"name": "Deploy application"
},
"execution": {
"action": "83k1m8",
"conditions": [
[
{
"condition_rule": "exec_successful|bool",
"condition_value": "",
"condition_action": "1|36b28n"
}
]
]
}
}
],
"variables": [
{
"name": "BRANCH",
"type": "selection",
"values": "main,dev"
}
],
"allowed_servers": [
{
"id": "m2e9k4",
"name": "web-01"
}
],
"tags": [],
"created_at": "2023-07-08T14:42:23+00:00",
"updated_at": "2023-08-26T12:34:04+00:00"
}Update a workflow
Replaces the workflow with the definition in the request body, one JSON document
like on creation: the whole workflow is described again, not only the changes. Retrieve the current definition, change it and send it back.
Returns the updated workflow object, or a 422 error with the problems by definition path.
-
id REQUIREDThe ID of the workflow you want to update.
-
dry_run optional booleanOnly validate the definition without changing anything.
Parameters
PUT /workflows/:id
curl -X PUT https://app.pipetower.com/api/v1/workflows/:id \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d @workflow.jsonRESPONSE
{
"id": "m5e8kv",
"team_id": "n80b40",
"name": "Initial server setup",
"steps": [
{
"order": 0,
"action": {
"id": "92e843",
"name": "Update packages"
},
"execution": {
"action": "92e843"
}
},
{
"order": 1,
"action": {
"id": "36b28n",
"name": "Create system user"
},
"execution": {
"action": "36b28n"
}
},
{
"order": 2,
"action": {
"id": "83k1m8",
"name": "Deploy application"
},
"execution": {
"action": "83k1m8",
"conditions": [
[
{
"condition_rule": "exec_successful|bool",
"condition_value": "",
"condition_action": "1|36b28n"
}
]
]
}
}
],
"variables": [
{
"name": "BRANCH",
"type": "selection",
"values": "main,dev"
}
],
"allowed_servers": [
{
"id": "m2e9k4",
"name": "web-01"
}
],
"tags": [],
"created_at": "2023-07-08T14:42:23+00:00",
"updated_at": "2023-08-26T12:34:04+00:00"
}Delete a workflow
Deletes the workflow. Returns an empty response with status 204, or a 409 error with the objects which still use the workflow,
in which case it is not deleted.
-
id REQUIREDThe ID of the workflow you want to delete.
Parameters
DELETE /workflows/:id
curl -X DELETE https://app.pipetower.com/api/v1/workflows/:id \
-H "Authorization: Bearer $API_TOKEN"RESPONSE WHEN STILL USED (409)
{
"message": "The action is used by other objects and cannot be deleted.",
"used_by": [
{
"type": "workflow",
"id": "4f7a2c",
"name": "Release"
}
]
}Retrieve a workflow's definition
Retrieves the definition of the workflow, the same content the export file has.
Send it back to update the workflow or to create a copy.
-
id REQUIREDThe ID of the workflow for which you want to retrieve the definition.
Parameters
GET /workflows/:id/definition
curl https://app.pipetower.com/api/v1/workflows/:id/definition \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"kind": "workflow",
"name": "Release",
"tags": [
"deploy"
],
"settings": {
"run_restricted_servers": [
"web-1"
]
},
"variables": [
{
"name": "BRANCH",
"type": "text"
},
{
"name": "ENVIRONMENT",
"type": "selection",
"values": [
"staging",
"production"
]
},
{
"name": "COMMIT",
"type": "text",
"optional": true
}
],
"steps": [
{
"action": "Run the tests",
"variables": {
"BRANCH": "main"
}
},
{
"action": "Deploy application",
"variables": {
"BRANCH": ""
},
"conditions": [
[
{
"step": 1,
"rule": "exec_successful"
},
{
"variable": "ENVIRONMENT",
"rule": "output_equal",
"value": "production"
}
],
[
{
"step": 1,
"rule": "output_contains",
"value": "skip tests"
}
]
]
}
]
}Pipes
Pipes are sequences of Actions or Workflows triggered by an event (When -> Then).
ENDPOINTS
The pipe object
-
id stringThe unique identifier for the pipe.
-
team_id stringThe ID of the team to which this pipe belongs.
-
active booleanWhether the trigger fires. See activate and deactivate.
-
trigger.execution.webhook_url stringFor a webhook trigger, the URL which runs the pipe when it is called. It stays the same when the pipe is updated.
-
trigger.action, trigger.workflow objectThe ID and name of the action or workflow whose execution fires the trigger. Null for the other triggers.
-
steps.*.action, steps.*.workflow objectThe ID and name of the action or workflow which is executed in this step. Null for a notification, or if it does not exist anymore. The step in words, with names instead of IDs, is in the definition of the pipe.
Attributes
THE PIPE OBJECT
{
"id": "e47d20",
"team_id": "n80b40",
"name": "Check available Updates",
"active": true,
"trigger": {
"type": "schedule",
"event": "every_week",
"action": null,
"workflow": null,
"execution": {
"day": "monday",
"time": "10"
}
},
"steps": [
{
"order": 0,
"type": "action",
"event": "execute_action",
"action": {
"id": "026nw2",
"name": "Check updates"
},
"workflow": null,
"execution": {
"action": "026nw2",
"servers": [
"r0em4n",
"kbe67n",
"b27a36"
]
}
},
{
"order": 1,
"type": "notification",
"event": "send_notification",
"action": null,
"workflow": null,
"execution": {
"channel": "email",
"message": "Updates are available!",
"conditions": [
[
{
"condition_rule": "output_contains|value",
"condition_field": "1|step_execute_action_action",
"condition_value": "upgradable from:",
"condition_server": "any_of_executed_servers"
}
]
],
"recipients": [
"e86bn6"
]
}
}
],
"tags": [],
"created_at": "2023-07-16T19:19:17+00:00",
"updated_at": "2023-10-07T09:22:02+00:00"
}List all pipes
Returns a list of your pipes.
-
search optionalOnly return the objects whose name contains the given term.
-
team optionalOnly return the objects of the team with the given ID.
-
limit optionalA limit on the number of objects to be returned. Limit can range between 1 and 100. The default is 15.
-
page optionalThe page of results you would like to retrieve.
Parameters
GET /pipes
curl https://app.pipetower.com/api/v1/pipes \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"data": [
{
"id": "e47d20",
"team_id": "n80b40",
"name": "Check available Updates",
"active": true,
"trigger": {
"type": "schedule",
"event": "every_week",
"action": null,
"workflow": null,
"execution": {
"day": "monday",
"time": "10"
}
},
"steps": [
{
"order": 0,
"type": "action",
"event": "execute_action",
"action": {
"id": "026nw2",
"name": "Check updates"
},
"workflow": null,
"execution": {
"action": "026nw2",
"servers": [
"r0em4n",
"kbe67n",
"b27a36"
]
}
},
{
"order": 1,
"type": "notification",
"event": "send_notification",
"action": null,
"workflow": null,
"execution": {
"channel": "email",
"message": "Updates are available!",
"conditions": [
[
{
"condition_rule": "output_contains|value",
"condition_field": "1|step_execute_action_action",
"condition_value": "upgradable from:",
"condition_server": "any_of_executed_servers"
}
]
],
"recipients": [
"e86bn6"
]
}
}
],
"tags": [],
"created_at": "2023-07-16T19:19:17+00:00",
"updated_at": "2023-10-07T09:22:02+00:00"
},
{...},
{...}
],
"meta": {...}
}Retrieve a pipe
Retrieves a pipe object.
-
id REQUIREDThe ID of the pipe you want to retrieve.
Parameters
GET /pipes/:id
curl https://app.pipetower.com/api/v1/pipes/:id \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "e47d20",
"team_id": "n80b40",
"name": "Check available Updates",
"active": true,
"trigger": {
"type": "schedule",
"event": "every_week",
"action": null,
"workflow": null,
"execution": {
"day": "monday",
"time": "10"
}
},
"steps": [
{
"order": 0,
"type": "action",
"event": "execute_action",
"action": {
"id": "026nw2",
"name": "Check updates"
},
"workflow": null,
"execution": {
"action": "026nw2",
"servers": [
"r0em4n",
"kbe67n",
"b27a36"
]
}
},
{
"order": 1,
"type": "notification",
"event": "send_notification",
"action": null,
"workflow": null,
"execution": {
"channel": "email",
"message": "Updates are available!",
"conditions": [
[
{
"condition_rule": "output_contains|value",
"condition_field": "1|step_execute_action_action",
"condition_value": "upgradable from:",
"condition_server": "any_of_executed_servers"
}
]
],
"recipients": [
"e86bn6"
]
}
}
],
"tags": [],
"created_at": "2023-07-16T19:19:17+00:00",
"updated_at": "2023-10-07T09:22:02+00:00"
}Activate a pipe
Activates the pipe, so its trigger fires, and returns the pipe object.
You need to be a member of the pipe's team.
-
id REQUIREDThe ID of the pipe you want to activate.
Parameters
POST /pipes/:id/activate
curl -X POST https://app.pipetower.com/api/v1/pipes/:id/activate \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "e47d20",
"team_id": "n80b40",
"name": "Check available Updates",
"active": true,
"trigger": {
"type": "schedule",
"event": "every_week",
"action": null,
"workflow": null,
"execution": {
"day": "monday",
"time": "10"
}
},
"steps": [
{
"order": 0,
"type": "action",
"event": "execute_action",
"action": {
"id": "026nw2",
"name": "Check updates"
},
"workflow": null,
"execution": {
"action": "026nw2",
"servers": [
"r0em4n",
"kbe67n",
"b27a36"
]
}
},
{
"order": 1,
"type": "notification",
"event": "send_notification",
"action": null,
"workflow": null,
"execution": {
"channel": "email",
"message": "Updates are available!",
"conditions": [
[
{
"condition_rule": "output_contains|value",
"condition_field": "1|step_execute_action_action",
"condition_value": "upgradable from:",
"condition_server": "any_of_executed_servers"
}
]
],
"recipients": [
"e86bn6"
]
}
}
],
"tags": [],
"created_at": "2023-07-16T19:19:17+00:00",
"updated_at": "2023-10-07T09:22:02+00:00"
}Deactivate a pipe
Deactivates the pipe, so its trigger doesn't fire anymore, and returns the pipe object. Its runs which already started go on.
You need to be a member of the pipe's team.
-
id REQUIREDThe ID of the pipe you want to deactivate.
Parameters
POST /pipes/:id/deactivate
curl -X POST https://app.pipetower.com/api/v1/pipes/:id/deactivate \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "e47d20",
"team_id": "n80b40",
"name": "Check available Updates",
"active": true,
"trigger": {
"type": "schedule",
"event": "every_week",
"action": null,
"workflow": null,
"execution": {
"day": "monday",
"time": "10"
}
},
"steps": [
{
"order": 0,
"type": "action",
"event": "execute_action",
"action": {
"id": "026nw2",
"name": "Check updates"
},
"workflow": null,
"execution": {
"action": "026nw2",
"servers": [
"r0em4n",
"kbe67n",
"b27a36"
]
}
},
{
"order": 1,
"type": "notification",
"event": "send_notification",
"action": null,
"workflow": null,
"execution": {
"channel": "email",
"message": "Updates are available!",
"conditions": [
[
{
"condition_rule": "output_contains|value",
"condition_field": "1|step_execute_action_action",
"condition_value": "upgradable from:",
"condition_server": "any_of_executed_servers"
}
]
],
"recipients": [
"e86bn6"
]
}
}
],
"tags": [],
"created_at": "2023-07-16T19:19:17+00:00",
"updated_at": "2023-10-07T09:22:02+00:00"
}Create a pipe
Creates a pipe from its definition: the request body is the definition
as one JSON document, exactly as an export file but in JSON. Only name, trigger and steps are required, everything else is optional.
The two parameters below are the only keys which are not part of the definition.
Names of referenced objects are resolved in the team, unknown tags are created.
Returns the created pipe object, or a 422 error with the problems by definition path.
-
team CONDITIONALLY REQUIREDThe ID or name of the team in which the pipe is created. Required if you are a member of several teams.
-
dry_run optional booleanOnly validate the definition without creating anything. Returns the normalized definition if it's valid.
Parameters
POST /pipes
curl -X POST https://app.pipetower.com/api/v1/pipes \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d @pipe.jsonPIPE.JSON
{
"kind": "pipe",
"name": "Restart on high load",
"active": true,
"tags": [
"ops"
],
"trigger": {
"type": "metric",
"metric": "cpu_usage",
"threshold": 90,
"servers": [
"web-1"
],
"server_tags": [
"web"
]
},
"steps": [
{
"type": "action",
"action": "Restart services",
"servers": [
"web-2"
],
"server_tags": [
"workers"
],
"trigger_servers": true,
"other_servers": true,
"variables": {
"SERVICE": "php-fpm"
},
"conditions": [
[
{
"trigger": "metric_value_percent",
"rule": "output_greater_than",
"value": "95",
"servers": "any"
}
]
]
},
{
"type": "workflow",
"workflow": "Scale out",
"servers": [
"web-1"
],
"server_tags": [
"web"
],
"trigger_servers": true,
"other_servers": true,
"variables": {
"REPLICAS": "2"
},
"conditions": [
[
{
"step": 1,
"rule": "exec_failed",
"servers": "all"
}
]
]
},
{
"type": "notification",
"channel": "email",
"recipients": [
"ops@example.com"
],
"message": "The load stayed high",
"conditions": [
[
{
"step": 2,
"rule": "output_contains",
"value": "error",
"server": "web-1"
}
]
]
}
]
}RESPONSE
{
"id": "e47d20",
"team_id": "n80b40",
"name": "Check available Updates",
"active": true,
"trigger": {
"type": "schedule",
"event": "every_week",
"action": null,
"workflow": null,
"execution": {
"day": "monday",
"time": "10"
}
},
"steps": [
{
"order": 0,
"type": "action",
"event": "execute_action",
"action": {
"id": "026nw2",
"name": "Check updates"
},
"workflow": null,
"execution": {
"action": "026nw2",
"servers": [
"r0em4n",
"kbe67n",
"b27a36"
]
}
},
{
"order": 1,
"type": "notification",
"event": "send_notification",
"action": null,
"workflow": null,
"execution": {
"channel": "email",
"message": "Updates are available!",
"conditions": [
[
{
"condition_rule": "output_contains|value",
"condition_field": "1|step_execute_action_action",
"condition_value": "upgradable from:",
"condition_server": "any_of_executed_servers"
}
]
],
"recipients": [
"e86bn6"
]
}
}
],
"tags": [],
"created_at": "2023-07-16T19:19:17+00:00",
"updated_at": "2023-10-07T09:22:02+00:00"
}Update a pipe
Replaces the pipe with the definition in the request body, one JSON document
like on creation: the whole pipe is described again, not only the changes. Retrieve the current definition, change it and send it back.
Returns the updated pipe object, or a 422 error with the problems by definition path.
-
id REQUIREDThe ID of the pipe you want to update.
-
dry_run optional booleanOnly validate the definition without changing anything.
Parameters
PUT /pipes/:id
curl -X PUT https://app.pipetower.com/api/v1/pipes/:id \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d @pipe.jsonRESPONSE
{
"id": "e47d20",
"team_id": "n80b40",
"name": "Check available Updates",
"active": true,
"trigger": {
"type": "schedule",
"event": "every_week",
"action": null,
"workflow": null,
"execution": {
"day": "monday",
"time": "10"
}
},
"steps": [
{
"order": 0,
"type": "action",
"event": "execute_action",
"action": {
"id": "026nw2",
"name": "Check updates"
},
"workflow": null,
"execution": {
"action": "026nw2",
"servers": [
"r0em4n",
"kbe67n",
"b27a36"
]
}
},
{
"order": 1,
"type": "notification",
"event": "send_notification",
"action": null,
"workflow": null,
"execution": {
"channel": "email",
"message": "Updates are available!",
"conditions": [
[
{
"condition_rule": "output_contains|value",
"condition_field": "1|step_execute_action_action",
"condition_value": "upgradable from:",
"condition_server": "any_of_executed_servers"
}
]
],
"recipients": [
"e86bn6"
]
}
}
],
"tags": [],
"created_at": "2023-07-16T19:19:17+00:00",
"updated_at": "2023-10-07T09:22:02+00:00"
}Delete a pipe
Deletes the pipe with its trigger and steps. Returns an empty response with status 204. The runs of the pipe stay in the run history.
-
id REQUIREDThe ID of the pipe you want to delete.
Parameters
DELETE /pipes/:id
curl -X DELETE https://app.pipetower.com/api/v1/pipes/:id \
-H "Authorization: Bearer $API_TOKEN"Retrieve a pipe's definition
Retrieves the definition of the pipe, the same content the export file has.
Send it back to update the pipe or to create a copy.
-
id REQUIREDThe ID of the pipe for which you want to retrieve the definition.
Parameters
GET /pipes/:id/definition
curl https://app.pipetower.com/api/v1/pipes/:id/definition \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"kind": "pipe",
"name": "Restart on high load",
"active": true,
"tags": [
"ops"
],
"trigger": {
"type": "metric",
"metric": "cpu_usage",
"threshold": 90,
"servers": [
"web-1"
],
"server_tags": [
"web"
]
},
"steps": [
{
"type": "action",
"action": "Restart services",
"servers": [
"web-2"
],
"server_tags": [
"workers"
],
"trigger_servers": true,
"other_servers": true,
"variables": {
"SERVICE": "php-fpm"
},
"conditions": [
[
{
"trigger": "metric_value_percent",
"rule": "output_greater_than",
"value": "95",
"servers": "any"
}
]
]
},
{
"type": "workflow",
"workflow": "Scale out",
"servers": [
"web-1"
],
"server_tags": [
"web"
],
"trigger_servers": true,
"other_servers": true,
"variables": {
"REPLICAS": "2"
},
"conditions": [
[
{
"step": 1,
"rule": "exec_failed",
"servers": "all"
}
]
]
},
{
"type": "notification",
"channel": "email",
"recipients": [
"ops@example.com"
],
"message": "The load stayed high",
"conditions": [
[
{
"step": 2,
"rule": "output_contains",
"value": "error",
"server": "web-1"
}
]
]
}
]
}Templates
Templates are reusable text files that you can copy to your server.
ENDPOINTS
The template object
-
id stringThe unique identifier for the template.
-
team_id stringThe ID of the team to which this template belongs.
Attributes
THE TEMPLATE OBJECT
{
"id": "kw386m",
"team_id": "n80b40",
"name": "NGINX server block",
"file_name": "$DOMAIN.conf",
"content": "server {\n listen 80 default_server;\n server_name $DOMAIN;\n\n root \/var\/www\/$FOLDER\/htdocs;\n index index.html;\n\n location \/ {\n try_files $uri $uri\/ =404;\n }\n}",
"tags": [],
"created_at": "2023-09-10T10:51:02+00:00",
"updated_at": "2023-09-23T15:02:32+00:00"
}List all templates
Returns a list of your templates.
-
search optionalOnly return the objects whose name contains the given term.
-
team optionalOnly return the objects of the team with the given ID.
-
limit optionalA limit on the number of objects to be returned. Limit can range between 1 and 100. The default is 15.
-
page optionalThe page of results you would like to retrieve.
Parameters
GET /templates
curl https://app.pipetower.com/api/v1/templates \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"data": [
{
"id": "kw386m",
"team_id": "n80b40",
"name": "NGINX server block",
"file_name": "$DOMAIN.conf",
"content": "server {\n listen 80 default_server;\n server_name $DOMAIN;\n\n root \/var\/www\/$FOLDER\/htdocs;\n index index.html;\n\n location \/ {\n try_files $uri $uri\/ =404;\n }\n}",
"tags": [],
"created_at": "2023-09-10T10:51:02+00:00",
"updated_at": "2023-09-23T15:02:32+00:00"
},
{...},
{...}
],
"meta": {...}
}Retrieve a template
Retrieves a template object.
-
id REQUIREDThe ID of the template you want to retrieve.
Parameters
GET /templates/:id
curl https://app.pipetower.com/api/v1/templates/:id \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "kw386m",
"team_id": "n80b40",
"name": "NGINX server block",
"file_name": "$DOMAIN.conf",
"content": "server {\n listen 80 default_server;\n server_name $DOMAIN;\n\n root \/var\/www\/$FOLDER\/htdocs;\n index index.html;\n\n location \/ {\n try_files $uri $uri\/ =404;\n }\n}",
"tags": [],
"created_at": "2023-09-10T10:51:02+00:00",
"updated_at": "2023-09-23T15:02:32+00:00"
}Create a template
Creates a template from its definition: the request body is the definition
as one JSON document, exactly as an export file but in JSON. Only name, file_name and content are required, everything else is optional.
The two parameters below are the only keys which are not part of the definition.
Names of referenced objects are resolved in the team, unknown tags are created.
Returns the created template object, or a 422 error with the problems by definition path.
-
team CONDITIONALLY REQUIREDThe ID or name of the team in which the template is created. Required if you are a member of several teams.
-
dry_run optional booleanOnly validate the definition without creating anything. Returns the normalized definition if it's valid.
Parameters
POST /templates
curl -X POST https://app.pipetower.com/api/v1/templates \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d @template.jsonTEMPLATE.JSON
{
"kind": "template",
"name": "Application .env",
"tags": [
"config"
],
"file_name": ".env",
"content": "APP_ENV=production\nAPP_DEBUG=false\nAPP_URL=https:\/\/$SERVER_HOST"
}RESPONSE
{
"id": "kw386m",
"team_id": "n80b40",
"name": "NGINX server block",
"file_name": "$DOMAIN.conf",
"content": "server {\n listen 80 default_server;\n server_name $DOMAIN;\n\n root \/var\/www\/$FOLDER\/htdocs;\n index index.html;\n\n location \/ {\n try_files $uri $uri\/ =404;\n }\n}",
"tags": [],
"created_at": "2023-09-10T10:51:02+00:00",
"updated_at": "2023-09-23T15:02:32+00:00"
}Update a template
Replaces the template with the definition in the request body, one JSON document
like on creation: the whole template is described again, not only the changes. Retrieve the current definition, change it and send it back.
Returns the updated template object, or a 422 error with the problems by definition path.
-
id REQUIREDThe ID of the template you want to update.
-
dry_run optional booleanOnly validate the definition without changing anything.
Parameters
PUT /templates/:id
curl -X PUT https://app.pipetower.com/api/v1/templates/:id \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d @template.jsonRESPONSE
{
"id": "kw386m",
"team_id": "n80b40",
"name": "NGINX server block",
"file_name": "$DOMAIN.conf",
"content": "server {\n listen 80 default_server;\n server_name $DOMAIN;\n\n root \/var\/www\/$FOLDER\/htdocs;\n index index.html;\n\n location \/ {\n try_files $uri $uri\/ =404;\n }\n}",
"tags": [],
"created_at": "2023-09-10T10:51:02+00:00",
"updated_at": "2023-09-23T15:02:32+00:00"
}Delete a template
Deletes the template. Returns an empty response with status 204, or a 409 error with the objects which still use the template,
in which case it is not deleted.
-
id REQUIREDThe ID of the template you want to delete.
Parameters
DELETE /templates/:id
curl -X DELETE https://app.pipetower.com/api/v1/templates/:id \
-H "Authorization: Bearer $API_TOKEN"RESPONSE WHEN STILL USED (409)
{
"message": "The action is used by other objects and cannot be deleted.",
"used_by": [
{
"type": "workflow",
"id": "4f7a2c",
"name": "Release"
}
]
}Retrieve a template's definition
Retrieves the definition of the template, the same content the export file has.
Send it back to update the template or to create a copy.
-
id REQUIREDThe ID of the template for which you want to retrieve the definition.
Parameters
GET /templates/:id/definition
curl https://app.pipetower.com/api/v1/templates/:id/definition \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"kind": "template",
"name": "Application .env",
"tags": [
"config"
],
"file_name": ".env",
"content": "APP_ENV=production\nAPP_DEBUG=false\nAPP_URL=https:\/\/$SERVER_HOST"
}Teams
Teams are a group of people who can work together on their automation.
ENDPOINTS
The team object
-
id stringThe unique identifier for the team.
Attributes
THE TEAM OBJECT
{
"id": "n80b40",
"name": "Acme",
"members": [
{
"name": "Joe Bloggs",
"email": "jbloggs@pipetower.com",
"role": "owner",
"2fa_enabled": true
},
{
"name": "Sarah Johnson",
"email": "sjohnson@pipetower.com",
"role": "admin",
"2fa_enabled": true
}
],
"created_at": "2023-08-12T07:05:53+00:00",
"updated_at": "2023-09-10T13:10:02+00:00"
}List all teams
Returns a list of your teams.
-
search optionalOnly return the objects whose name contains the given term.
-
limit optionalA limit on the number of objects to be returned. Limit can range between 1 and 100. The default is 15.
-
page optionalThe page of results you would like to retrieve.
Parameters
GET /teams
curl https://app.pipetower.com/api/v1/teams \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"data": [
{
"id": "n80b40",
"name": "Acme",
"members": [
{
"name": "Joe Bloggs",
"email": "jbloggs@pipetower.com",
"role": "owner",
"2fa_enabled": true
},
{
"name": "Sarah Johnson",
"email": "sjohnson@pipetower.com",
"role": "admin",
"2fa_enabled": true
}
],
"created_at": "2023-08-12T07:05:53+00:00",
"updated_at": "2023-09-10T13:10:02+00:00"
},
{...},
{...}
],
"meta": {...}
}Retrieve a team
Retrieves a team object.
-
id REQUIREDThe ID of the team you want to retrieve.
Parameters
GET /teams/:id
curl https://app.pipetower.com/api/v1/teams/:id \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "n80b40",
"name": "Acme",
"members": [
{
"name": "Joe Bloggs",
"email": "jbloggs@pipetower.com",
"role": "owner",
"2fa_enabled": true
},
{
"name": "Sarah Johnson",
"email": "sjohnson@pipetower.com",
"role": "admin",
"2fa_enabled": true
}
],
"created_at": "2023-08-12T07:05:53+00:00",
"updated_at": "2023-09-10T13:10:02+00:00"
}Retrieve a team's variables
Retrieves the variables of the specified team.
-
id REQUIREDThe ID of the team for which you want to retrieve the variables.
-
search optionalOnly return the objects whose name contains the given term.
-
limit optionalA limit on the number of objects to be returned. Limit can range between 1 and 100. The default is 15.
-
page optionalThe page of results you would like to retrieve.
Parameters
GET /teams/:id/vars
curl https://app.pipetower.com/api/v1/teams/:id/vars \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"data": [
{
"secret": false,
"name": "SYSTEM_USER",
"value": "morpheus"
},
{
"secret": true,
"name": "APP_KEY",
"value": "***"
},
{...}
],
"meta": {...}
}Create or update a team variable
Creates the variable of the given name of the specified team, or replaces the value of an existing one.
Returns the variable with status 201 when it was created, or 200 when it was updated, and a 422 error when the input is not valid. Only owners of the team may change its variables.
-
id REQUIREDThe ID of the team whose variable you want to create or update.
-
name REQUIREDThe name of the variable, in the path. It is used as
$NAMEin commands, scripts and templates and may contain letters, digits, dashes and underscores. -
value CONDITIONALLY REQUIRED stringThe value of the variable. Only an existing secret which stays a secret may leave it out, it keeps its stored value then.
-
secret optional booleanWhether the value is a secret: it is stored encrypted, hidden in the output of runs and never returned by the API. Left out, an existing variable stays what it is and a new one is not secret.
Parameters
PUT /teams/:id/vars/:name
curl -X PUT https://app.pipetower.com/api/v1/teams/:id/vars/BRANCH \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"value": "main"}'RESPONSE
{
"secret": false,
"name": "BRANCH",
"value": "main"
}Delete a team variable
Deletes the variable of the given name of the specified team. Returns an empty response with status 204, or a 404 error when there is no variable of that name. Only owners of the team may change its variables.
-
id REQUIREDThe ID of the team whose variable you want to delete.
-
name REQUIREDThe name of the variable you want to delete.
Parameters
DELETE /teams/:id/vars/:name
curl -X DELETE https://app.pipetower.com/api/v1/teams/:id/vars/BRANCH \
-H "Authorization: Bearer $API_TOKEN"Variables
Variables are used as
$NAME in commands, scripts and templates. They are defined on one of three places:
your account, a team or a server.
When a run resolves a name defined on several places, the server comes first, then the account of the user who started the run, then the team.
Each place has its own endpoints to retrieve, create, update and delete its variables, this endpoint lists the variables of all places at once.
ENDPOINTS
GET
/vars
List all variables
Returns the variables of your account, of your teams and of their servers, each with the place it is defined on:
the account first, then the teams, then the servers. Secret values are returned as
***.
-
search optionalOnly return the objects whose name contains the given term.
-
team optionalOnly return the variables of the team with the given ID and of its servers, next to those of your account.
-
limit optionalA limit on the number of objects to be returned. Limit can range between 1 and 100. The default is 15.
-
page optionalThe page of results you would like to retrieve.
Parameters
-
place objectWhere the variable is defined: its
type(account,teamorserver), and theidandnameof the account, team or server. A server also names itsteamwithidandname, as servers of different teams can have the same name.
Attributes
GET /vars
curl https://app.pipetower.com/api/v1/vars?search=DB_ \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"data": [
{
"secret": true,
"name": "DB_PASSWORD",
"value": "***",
"place": {
"type": "account",
"id": "vr0240",
"name": "Ada Lovelace"
}
},
{
"secret": false,
"name": "DB_HOST",
"value": "db.internal",
"place": {
"type": "team",
"id": "64k8bk",
"name": "Ops"
}
},
{
"secret": true,
"name": "DB_PASSWORD",
"value": "***",
"place": {
"type": "server",
"id": "kbe67n",
"name": "web-01",
"team": {
"id": "64k8bk",
"name": "Ops"
}
}
},
{...}
],
"meta": {...}
}Runs
Runs hold information about the execution of actions, workflows, or pipes.
ENDPOINTS
The run object
-
id stringThe unique identifier for the run.
-
team_id stringThe ID of the team to which this run belongs.
-
status stringThe status of the run: pending, running, successful, failed, partially_failed, canceled, terminated, skipped or not_allowed.
-
executable objectThe executed action, workflow or pipe. Null if it is not available anymore.
-
triggered_by objectThe user who triggered the run. Null if the run was not triggered by a user, e.g. by a pipe.
-
metadata objectThe metadata of the run, names with a text each: what was passed when the run was created and what its steps wrote in their output with meta.NAME=text, which wins over a passed entry of the same name. Null if there is none.
-
executions arrayThe run executions, one per server. Lists of runs contain the executions without their steps and variables. Not present for runs of a pipe.
-
runs arrayThe IDs of the runs which were started by the pipe. Only present for runs of a pipe.
Attributes
THE RUN OBJECT
{
"id": "e0k229",
"team_id": "n80b40",
"status": "successful",
"executable": {
"id": "92eb93",
"type": "Action",
"name": "Install UFW"
},
"triggered_by": {
"name": "Joe Bloggs"
},
"metadata": {
"ticket": "OPS-12"
},
"executions": [
{
"id": "5035k0",
"team_id": "n80b40",
"run_id": "e0k229",
"server": {
"id": "r0em4n",
"name": "Pipetower",
"host": "pipetower.com"
},
"status": "successful",
"executable": {
"id": "92eb93",
"type": "Action",
"name": "Install UFW"
},
"steps": [
{
"type": "ActionStep",
"name": "Install",
"status": "successful",
"reason": null,
"skipped_by_conditions": false,
"stream_id": "v38k2e",
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": "2023-10-07T10:26:49+00:00"
},
{
"type": "ActionStep",
"name": "Enable",
"status": "successful",
"reason": null,
"skipped_by_conditions": false,
"stream_id": "k9b47m",
"started_at": "2023-10-07T10:26:49+00:00",
"finished_at": "2023-10-07T10:26:50+00:00"
}
],
"variables": [
{
"name": "PORT",
"value": "22",
"secret": false
}
],
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": "2023-10-07T10:26:50+00:00"
},
{...}
],
"created_at": "2023-10-07T10:26:40+00:00",
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": "2023-10-07T10:26:50+00:00"
}List all runs
Returns a list of your runs, the latest first. All filters can be combined.
-
server optionalOnly return the runs with an execution on the server with the given ID.
-
action optionalOnly return the runs of the action with the given ID.
-
workflow optionalOnly return the runs of the workflow with the given ID.
-
pipe optionalOnly return the runs of the pipe with the given ID.
-
status optionalOnly return the runs with the given status, see the run object for the possible values.
-
team optionalOnly return the objects of the team with the given ID.
-
limit optionalA limit on the number of objects to be returned. Limit can range between 1 and 100. The default is 15.
-
page optionalThe page of results you would like to retrieve.
Parameters
GET /runs
curl https://app.pipetower.com/api/v1/runs \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"data": [
{
"id": "e0k229",
"team_id": "n80b40",
"status": "successful",
"executable": {
"id": "92eb93",
"type": "Action",
"name": "Install UFW"
},
"triggered_by": {
"name": "Joe Bloggs"
},
"metadata": null,
"executions": [
{
"id": "5035k0",
"team_id": "n80b40",
"run_id": "e0k229",
"server": {
"id": "r0em4n",
"name": "Pipetower",
"host": "pipetower.com"
},
"status": "successful",
"executable": {
"id": "92eb93",
"type": "Action",
"name": "Install UFW"
},
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": "2023-10-07T10:26:50+00:00"
},
{...}
],
"created_at": "2023-10-07T10:26:40+00:00",
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": "2023-10-07T10:26:50+00:00"
},
{
"id": "e69vm3",
"team_id": "n80b40",
"status": "successful",
"executable": {
"id": "e47d20",
"type": "Pipe",
"name": "Check available Updates"
},
"triggered_by": null,
"metadata": null,
"runs": [
"m60b76",
"73r7k6"
],
"created_at": "2023-10-08T07:19:04+00:00",
"started_at": "2023-10-08T07:19:04+00:00",
"finished_at": "2023-10-08T07:19:06+00:00"
},
{...}
],
"meta": {...}
}Create a run
To execute an action or a workflow on one or multiple servers, create a new run object.
If the action / workflow or one of the servers cannot be found, a 404 error is returned.
A server of another team, or one the action / workflow is restricted from running on, is rejected with a 422 error
which names the server; no run is created then.
-
action_id CONDITIONALLY REQUIREDThe ID of the action you want to execute.
This field is required when workflow_id is not present. -
workflow_id CONDITIONALLY REQUIREDThe ID of the workflow you want to execute.
This field is required when action_id is not present. -
server_ids REQUIRED arrayAn array containing the server IDs on which you want to execute the action / workflow.
-
variables CONDITIONALLY REQUIRED objectThe values for the variables of the action / workflow, keyed by the variable name. Every variable which is not optional needs a value and the value of a selection variable has to be one of its values, otherwise a 422 error is returned and no run is created.
-
metadata optional objectInformation to store and show with the run, keyed by a name of your choice, e.g. the commits which a deployment delivers. It is never used in a command. At most 50 entries, each a text of up to 50,000 characters with a name of up to 100 characters, and 100 kilobytes in total. Names and texts have to be valid UTF-8.
Parameters
POST /runs
curl -X POST https://app.pipetower.com/api/v1/runs \
-H "Authorization: Bearer $API_TOKEN" \
-d action_id="92eb93" \
-d server_ids[]="r0em4n" \
-d server_ids[]="kbe67n" \
-d variables[PORT]="22" \
-d metadata[ticket]="OPS-12"RESPONSE
{
"id": "e0k229",
"team_id": "n80b40",
"status": "pending",
"executable": {
"id": "92eb93",
"type": "Action",
"name": "Install UFW"
},
"triggered_by": {
"name": "Joe Bloggs"
},
"metadata": {
"ticket": "OPS-12"
},
"executions": [
{
"id": "5035k0",
"team_id": "n80b40",
"run_id": "e0k229",
"server": {
"id": "r0em4n",
"name": "Pipetower",
"host": "pipetower.com"
},
"status": "pending",
"executable": {
"id": "92eb93",
"type": "Action",
"name": "Install UFW"
},
"steps": [],
"variables": [
{
"name": "PORT",
"value": "22",
"secret": false
}
],
"started_at": null,
"finished_at": null
},
{...}
],
"created_at": "2023-10-07T10:26:40+00:00",
"started_at": null,
"finished_at": null
}Retrieve a run
Retrieves a run object with its executions and their steps.
-
id REQUIREDThe ID of the run you want to retrieve.
-
include optionalSet to output to include the details (exit code, command and output) of each action step.
Parameters
GET /runs/:id
curl https://app.pipetower.com/api/v1/runs/:id \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "e0k229",
"team_id": "n80b40",
"status": "successful",
"executable": {
"id": "92eb93",
"type": "Action",
"name": "Install UFW"
},
"triggered_by": {
"name": "Joe Bloggs"
},
"metadata": {
"ticket": "OPS-12"
},
"executions": [
{
"id": "5035k0",
"team_id": "n80b40",
"run_id": "e0k229",
"server": {
"id": "r0em4n",
"name": "Pipetower",
"host": "pipetower.com"
},
"status": "successful",
"executable": {
"id": "92eb93",
"type": "Action",
"name": "Install UFW"
},
"steps": [
{
"type": "ActionStep",
"name": "Install",
"status": "successful",
"reason": null,
"skipped_by_conditions": false,
"stream_id": "v38k2e",
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": "2023-10-07T10:26:49+00:00"
},
{
"type": "ActionStep",
"name": "Enable",
"status": "successful",
"reason": null,
"skipped_by_conditions": false,
"stream_id": "k9b47m",
"started_at": "2023-10-07T10:26:49+00:00",
"finished_at": "2023-10-07T10:26:50+00:00"
}
],
"variables": [
{
"name": "PORT",
"value": "22",
"secret": false
}
],
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": "2023-10-07T10:26:50+00:00"
},
{...}
],
"created_at": "2023-10-07T10:26:40+00:00",
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": "2023-10-07T10:26:50+00:00"
}Terminate a run
Terminates all unfinished executions of the run and returns the run object.
Pending steps are terminated directly, a running step receives a termination signal
and is shown as running until it has stopped.
-
id REQUIREDThe ID of the run you want to terminate.
Parameters
POST /runs/:id/terminate
curl -X POST https://app.pipetower.com/api/v1/runs/:id/terminate \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "e0k229",
"team_id": "n80b40",
"status": "running",
"executable": {
"id": "92eb93",
"type": "Action",
"name": "Install UFW"
},
"triggered_by": {
"name": "Joe Bloggs"
},
"metadata": null,
"executions": [
{
"id": "5035k0",
"team_id": "n80b40",
"run_id": "e0k229",
"server": {
"id": "r0em4n",
"name": "Pipetower",
"host": "pipetower.com"
},
"status": "running",
"executable": {
"id": "92eb93",
"type": "Action",
"name": "Install UFW"
},
"steps": [
{
"type": "ActionStep",
"name": "Install",
"status": "running",
"reason": null,
"skipped_by_conditions": false,
"stream_id": "v38k2e",
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": null
},
{
"type": "ActionStep",
"name": "Enable",
"status": "terminated",
"reason": null,
"skipped_by_conditions": false,
"stream_id": null,
"started_at": null,
"finished_at": null
}
],
"variables": [
{
"name": "PORT",
"value": "22",
"secret": false
}
],
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": null
},
{...}
],
"created_at": "2023-10-07T10:26:40+00:00",
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": null
}Run executions
Run executions hold information about a specific execution of an action
or a workflow on a server, with details like status, steps, exit codes, output etc.
ENDPOINTS
The run execution object
-
id stringThe unique identifier for the run execution.
-
team_id stringThe ID of the team to which this run execution belongs.
-
server objectThe ID, name and host of the server on which the action / workflow is executed.
-
steps arrayThe results of the steps: the action steps of an action, the workflow steps of a workflow.
-
steps.*.type stringActionStep or WorkflowStep.
-
steps.*.reason stringThe reason why a step was not allowed, e.g. because of missing variable values. Otherwise null.
-
steps.*.skipped_by_conditions booleanWhether the step was skipped because its conditions were not fulfilled.
-
steps.*.stream_id stringThe ID of the output stream of an action step. Null if the step has no output stream.
-
steps.*.steps arrayThe results of the action steps of a workflow step. Only present for workflow steps.
-
steps.*.details objectThe exit code, type, command and output of an action step. Only present when requested with include=output.
-
variables arrayThe variables and their values of this execution. The value of secret variables is null.
Attributes
THE RUN EXECUTION OBJECT
{
"id": "5035k0",
"team_id": "n80b40",
"run_id": "e0k229",
"server": {
"id": "r0em4n",
"name": "Pipetower",
"host": "pipetower.com"
},
"status": "successful",
"executable": {
"id": "92eb93",
"type": "Action",
"name": "Install UFW"
},
"steps": [
{
"type": "ActionStep",
"name": "Install",
"status": "successful",
"reason": null,
"skipped_by_conditions": false,
"stream_id": "v38k2e",
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": "2023-10-07T10:26:49+00:00"
},
{
"type": "ActionStep",
"name": "Enable",
"status": "successful",
"reason": null,
"skipped_by_conditions": false,
"stream_id": "k9b47m",
"started_at": "2023-10-07T10:26:49+00:00",
"finished_at": "2023-10-07T10:26:50+00:00"
}
],
"variables": [
{
"name": "PORT",
"value": "22",
"secret": false
}
],
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": "2023-10-07T10:26:50+00:00"
}Retrieve a run execution
Retrieves a run execution object.
-
id REQUIREDThe ID of the run execution you want to retrieve.
-
include optionalSet to output to include the details (exit code, command and output) of each action step.
Parameters
GET /run-executions/:id
curl "https://app.pipetower.com/api/v1/run-executions/:id?include=output" \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "5035k0",
"team_id": "n80b40",
"run_id": "e0k229",
"server": {
"id": "r0em4n",
"name": "Pipetower",
"host": "pipetower.com"
},
"status": "successful",
"executable": {
"id": "92eb93",
"type": "Action",
"name": "Install UFW"
},
"steps": [
{
"type": "ActionStep",
"name": "Install",
"status": "successful",
"reason": null,
"skipped_by_conditions": false,
"stream_id": "v38k2e",
"details": {
"exit_code": 0,
"type": "execute_command",
"command": "sudo apt install ufw",
"output": "[sudo] password for pipetower: \r\nReading package lists... Done\r\n(...)"
},
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": "2023-10-07T10:26:49+00:00"
},
{
"type": "ActionStep",
"name": "Enable",
"status": "successful",
"reason": null,
"skipped_by_conditions": false,
"stream_id": "k9b47m",
"details": {
"exit_code": 0,
"type": "execute_command",
"command": "sudo ufw enable",
"output": "[sudo] password for pipetower: \r\nFirewall is active and enabled on system startup"
},
"started_at": "2023-10-07T10:26:49+00:00",
"finished_at": "2023-10-07T10:26:50+00:00"
}
],
"variables": [
{
"name": "PORT",
"value": "22",
"secret": false
}
],
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": "2023-10-07T10:26:50+00:00"
}Terminate a run execution
Terminates the run execution and returns the run execution object.
Pending steps are terminated directly, a running step receives a termination signal
and is shown as running until it has stopped.
-
id REQUIREDThe ID of the run execution you want to terminate.
Parameters
POST /run-executions/:id/terminate
curl -X POST https://app.pipetower.com/api/v1/run-executions/:id/terminate \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "5035k0",
"team_id": "n80b40",
"run_id": "e0k229",
"server": {
"id": "r0em4n",
"name": "Pipetower",
"host": "pipetower.com"
},
"status": "running",
"executable": {
"id": "92eb93",
"type": "Action",
"name": "Install UFW"
},
"steps": [
{
"type": "ActionStep",
"name": "Install",
"status": "running",
"reason": null,
"skipped_by_conditions": false,
"stream_id": "v38k2e",
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": null
},
{
"type": "ActionStep",
"name": "Enable",
"status": "terminated",
"reason": null,
"skipped_by_conditions": false,
"stream_id": null,
"started_at": null,
"finished_at": null
}
],
"variables": [
{
"name": "PORT",
"value": "22",
"secret": false
}
],
"started_at": "2023-10-07T10:26:41+00:00",
"finished_at": null
}Retrieve a run execution's log
Retrieves the full log of the specified run execution as plain text
(text/plain):
the variables, the evaluated conditions, the commands, the output and the exit code of each step.
Secret values are masked, times are shown in the timezone of your account.
-
id REQUIREDThe ID of the run execution for which you want to retrieve the log.
Parameters
GET /run-executions/:id/log
curl https://app.pipetower.com/api/v1/run-executions/:id/log \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
================================================================================
Run #e0k229 · Execution #5035k0
================================================================================
Action Install UFW
Server pipetower.com
Status Successful
Started 2023-10-07 10:26:41 UTC
Finished 2023-10-07 10:26:50 UTC (9s)
--- Variables ------------------------------------------------------------------
PORT = 22
--- 1 Install --------------------------------- 10:26:41 · ✓ Successful · 8s ---
$ sudo apt install ufw
[sudo] password for pipetower:
Reading package lists... Done
(...)
>>> exit code 0 · finished 10:26:49
--- 2 Enable ---------------------------------- 10:26:49 · ✓ Successful · 1s ---
$ sudo ufw enable
[sudo] password for pipetower:
Firewall is active and enabled on system startup
>>> exit code 0 · finished 10:26:50Gateway
The WebSocket gateway delivers changes of runs and servers and the live output of running steps in real time,
and it connects you to terminal sessions.
To connect, create a ticket and send it as first message ({"type": "auth", "ticket": "..."}) to the returned URL. A ticket is valid for 60 seconds and can only be used once. Afterwards you can subscribe to the topics runs, servers, run.:id or server.:id ({"type": "subscribe", "topic": "runs"}).
To connect, create a ticket and send it as first message ({"type": "auth", "ticket": "..."}) to the returned URL. A ticket is valid for 60 seconds and can only be used once. Afterwards you can subscribe to the topics runs, servers, run.:id or server.:id ({"type": "subscribe", "topic": "runs"}).
-
url stringThe URL of the WebSocket gateway.
-
ticket stringThe ticket with which you authenticate the connection.
-
expires_at stringThe time until which the ticket can be used.
Attributes
POST /gateway/ticket
curl -X POST https://app.pipetower.com/api/v1/gateway/ticket \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"url": "wss:\/\/app.pipetower.com\/terminal-ws",
"ticket": "eyJ0eXAiOiJjb25uZWN0aW9uIiwidXNyIjp7ImlkIjoiZTg2Ym42Ii...Hn3kQ0pW",
"expires_at": "2023-10-07T10:27:40+00:00"
}Terminal sessions
Terminal sessions are shells on your servers, which can be shared with the members of the server's team.
The terminal itself is used through the gateway,
to which you attach with the ticket of the session.
ENDPOINTS
The terminal session object
-
id stringThe unique identifier for the terminal session.
-
server objectThe ID, name, host and connection state of the server on which the session runs.
-
owner stringThe name of the user who opened the session.
-
role stringYour role in the session: owner or guest.
-
ticket stringThe ticket with which you attach to the session through the gateway. It is valid for 60 seconds and can only be used once.
Attributes
THE TERMINAL SESSION OBJECT
{
"id": "q4m8z1",
"server": {
"id": "r0em4n",
"name": "Pipetower",
"host": "pipetower.com",
"connected": true
},
"owner": "Joe Bloggs",
"role": "owner",
"ticket": "eyJ0eXAiOiJzZXNzaW9uIiwidXNyIjp7ImlkIjoiZTg2Ym42Ii...tR7cVx2A"
}Open a terminal session
Opens a new terminal session on the specified server, you are its owner.
The shell is started when you attach to the session through the gateway.
Your API token has to allow terminals on the server, at any access.
-
id REQUIREDThe ID of the server on which you want to open the session.
Parameters
POST /servers/:id/terminal-sessions
curl -X POST https://app.pipetower.com/api/v1/servers/:id/terminal-sessions \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "q4m8z1",
"server": {
"id": "r0em4n",
"name": "Pipetower",
"host": "pipetower.com",
"connected": true
},
"owner": "Joe Bloggs",
"role": "owner",
"ticket": "eyJ0eXAiOiJzZXNzaW9uIiwidXNyIjp7ImlkIjoiZTg2Ym42Ii...tR7cVx2A"
}Attach to a terminal session
Returns the terminal session with a fresh ticket to attach to it.
Guests can only attach to a running session, the owner also to a session which is not started yet.
-
id REQUIREDThe ID of the terminal session you want to attach to.
Parameters
POST /terminal-sessions/:id/attach
curl -X POST https://app.pipetower.com/api/v1/terminal-sessions/:id/attach \
-H "Authorization: Bearer $API_TOKEN"RESPONSE
{
"id": "q4m8z1",
"server": {
"id": "r0em4n",
"name": "Pipetower",
"host": "pipetower.com",
"connected": true
},
"owner": "Joe Bloggs",
"role": "guest",
"ticket": "eyJ0eXAiOiJzZXNzaW9uIiwidXNyIjp7ImlkIjoiYTN4OXAyIi...Lm5wQe8d"
}© 2026 Pipetower