SSH Command

  • POST
  • /workspaces
  • /:workspace
  • /projects
  • /:project_name
  • /pipelines
  • /:pipeline_id
  • /actions

Request

URL PARAMETERS
workspacerequired string
The workspace domain.
pipeline_idrequired integer
The numerical ID of the desired pipeline.
project_namerequired string
The name ID of the project.
POST PARAMETERS
namerequired string
The name of the action.
typerequired string
Defines the type of the action. Should be set to SSH_COMMAND.
targetsrequired string
Define a target (server) for your deployments using the following paramters
commandsrequired string[]
The array of commands invoked on the remote server.
run_as_scriptboolean
If set to true, commands are executed as a regular script. If set to false, the commands will be executed one by one, in non-interactive mode.
shellstring
The name of the shell that will be used to execute commands. Can be one of SH (default) or BASH.
working_directorystring
The absolute or relative path on the remote server.
execute_every_commandboolean
If set to true all commands will be executed regardless of the result of the previous command.

Last modified on Mar 19, 2025

Example: SSH (Password)

curl -X POST "https://api.buddy.works/workspaces/:workspace/projects/:project_name/pipelines/:pipeline_id/actions" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
  "name": "Execute commands on 192.0.2.1",
  "type": "SSH_COMMAND",
  "trigger_time": "ON_EVERY_EXECUTION",
  "working_directory": "tests/SSH_Tests/",
  "commands": [
    "date >> tmp.log"
  ],
  "targets": [
    {
      "type": "SSH",
      "id": "vlatncuatc",
      "host": "192.0.2.1",
      "port": "22",
      "auth": {
        "method": "PASSWORD",
        "username": "buddy",
        "password": "$MyPassword"
      }
    }
  ],
  "run_as_script": true,
  "shell": "BASH",
  "execute_every_command": false
}'
EXAMPLE RESPONSE
{ "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/175688/actions/196743", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/175688/action/196743/edit", "id": 196743, "name": "Execute commands on 192.0.2.1", "type": "SSH_COMMAND", "trigger_time": "ON_EVERY_EXECUTION", "last_execution_status": "INITIAL", "disabled": false, "working_directory": "tests/SSH_Tests/", "commands": [ "date >> tmp.log" ], "targets": [ { "type": "SSH", "id": "vlatncuatc", "host": "192.0.2.1", "port": "22", "auth": { "method": "PASSWORD", "username": "buddy", "password": "secure!Fa+KZiUPt454/V0I/rzVow==.NTxejOG4XOsR8a5u8PLhVw==" } } ], "pipeline": { "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/175688", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/175688", "id": 175688, "name": "Test Docs", "on": "EVENT", "definition_source": "LOCAL", "git_config_ref": "NONE", "events": [ { "type": "PUSH", "refs": [ "refs/heads/master" ] } ], "priority": "NORMAL", "disabled": false, "last_execution_status": "INITIAL", "always_from_scratch": false, "ignore_fail_on_project_status": false, "no_skip_to_most_recent": false, "terminate_stale_runs": false, "auto_clear_cache": false, "fetch_all_refs": false, "fail_on_prepare_env_warning": true, "concurrent_pipeline_runs": false, "do_not_create_commit_status": false, "stale": false, "waiting_for_push": false, "resources": "DEFAULT", "git_changeset_base": "LATEST_RUN", "filesystem_changeset_base": "DATE_MODIFIED", "cpu": "X86", "description_required": false }, "ignore_errors": false, "run_as_script": true, "shell": "BASH", "run_next": "WAIT_ON_SUCCESS", "execute_every_command": false }
STATUS
201 Created
LIMITS
X-Rate-Limit-Limit: 1 X-Rate-Limit-Remaining: 999

Example: SFTP (key)

curl -X POST "https://api.buddy.works/workspaces/:workspace/projects/:project_name/pipelines/:pipeline_id/actions" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
  "name": "Upload files to 192.0.2.1 by SFTP(Key)",
  "type": "SSH_COMMAND",
  "trigger_time": "ON_EVERY_EXECUTION",
  "working_directory": "tests/SSH_Tests/",
  "commands": [
    "date >> tmp.log"
  ],
  "targets": [
    {
      "id": "sftp_target_1",
      "type": "SSH",
      "host": "192.0.2.1",
      "port": "22",
      "auth": {
        "method": "ASSETS_KEY",
        "username": "api_tests_user",
        "asset": "id_project"
      }
    }
  ]
}'
EXAMPLE RESPONSE
{ "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/196734/actions/1609587", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/196734/action/1609587/edit", "id": 1610087, "name": "Upload files to 192.0.2.1 by SFTP(Key)", "type": "SSH_COMMAND", "trigger_time": "ON_EVERY_EXECUTION", "last_execution_status": "INITIAL", "disabled": false, "working_directory": "tests/SSH_Tests/", "commands": [ "date >> tmp.log" ], "targets": [ { "type": "SSH", "id": "sftp_target_1", "host": "192.0.2.1", "port": "22", "auth": { "method": "ASSETS_KEY", "username": "api_tests_user", "asset": "id_project" } } ], "pipeline": { "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/525739", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/525739", "id": 525739, "name": "pip6", "definition_source": "LOCAL", "git_config_ref": "FIXED", "events": [ { "type": "PUSH", "refs": [ "refs/heads/master" ] } ], "priority": "NORMAL", "disabled": false, "last_execution_status": "INITIAL", "always_from_scratch": false, "ignore_fail_on_project_status": false, "no_skip_to_most_recent": false, "terminate_stale_runs": false, "auto_clear_cache": false, "fetch_all_refs": false, "fail_on_prepare_env_warning": true, "concurrent_pipeline_runs": false, "do_not_create_commit_status": false, "stale": false, "waiting_for_push": false, "resources": "DEFAULT", "git_config": { "path": ".buddy/pip6.fixed.yml", "branch": "master", "project": "company-website" }, "git_changeset_base": "LATEST_RUN", "filesystem_changeset_base": "DATE_MODIFIED", "cpu": "X64", "description_required": false }, "ignore_errors": false, "run_as_script": false, "shell": "SH", "run_next": "WAIT_ON_SUCCESS", "execute_every_command": false }
STATUS
201 Created
LIMITS
X-Rate-Limit-Limit: 1 X-Rate-Limit-Remaining: 999

Example: SSH (Password & Passphrase and Key)

curl -X POST "https://api.buddy.works/workspaces/:workspace/projects/:project_name/pipelines/:pipeline_id/actions" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
  "name": "Execute commands on 192.0.2.1",
  "type": "SSH_COMMAND",
  "trigger_time": "ON_EVERY_EXECUTION",
  "working_directory": "tests/SSH_Tests/",
  "commands": [
    "date >> tmp.log"
  ],
  "targets": [
    {
      "type": "SSH",
      "id": "vlatncuatc",
      "host": "192.0.2.1",
      "port": "22",
      "auth": {
        "method": "ASSETS_KEY",
        "username": "api_tests_user",
        "passphrase": "$MyPassphrase",
        "password": "$MyPassword",
        "asset": "id_project"
      }
    }
  ],
  "run_as_script": true,
  "shell": "BASH",
  "execute_every_command": false
}'
EXAMPLE RESPONSE
{ "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/525739/actions/1609604", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/525739/action/1609604/edit", "id": 1609604, "name": "Execute commands on 192.0.2.1", "type": "SSH_COMMAND", "trigger_time": "ON_EVERY_EXECUTION", "last_execution_status": "INITIAL", "disabled": false, "working_directory": "tests/SSH_Tests/", "commands": [ "date >> tmp.log" ], "targets": [ { "type": "SSH", "id": "vlatncuatc", "host": "192.0.2.1", "port": "22", "auth": { "method": "ASSETS_KEY", "username": "api_tests_user", "asset": "id_project" } } ], "pipeline": { "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/525739", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/525739", "id": 525739, "name": "pip6", "definition_source": "LOCAL", "git_config_ref": "NONE", "events": [ { "type": "PUSH", "refs": [ "refs/heads/master" ] } ], "priority": "NORMAL", "disabled": false, "last_execution_status": "INITIAL", "always_from_scratch": false, "ignore_fail_on_project_status": false, "no_skip_to_most_recent": false, "terminate_stale_runs": false, "auto_clear_cache": false, "fetch_all_refs": false, "fail_on_prepare_env_warning": true, "concurrent_pipeline_runs": false, "do_not_create_commit_status": false, "stale": false, "waiting_for_push": false, "resources": "DEFAULT", "git_changeset_base": "LATEST_RUN", "filesystem_changeset_base": "DATE_MODIFIED", "cpu": "X64", "description_required": false }, "ignore_errors": false, "run_as_script": true, "shell": "BASH", "run_next": "WAIT_ON_SUCCESS", "execute_every_command": false }
STATUS
201 Created
LIMITS
X-Rate-Limit-Limit: 1 X-Rate-Limit-Remaining: 999

Example: SSH with Integration

curl -X POST "https://api.buddy.works/workspaces/:workspace/projects/:project_name/pipelines/:pipeline_id/actions" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
  "name": "Execute commands on 192.0.2.1 with Integration",
  "type": "SSH_COMMAND",
  "trigger_time": "ON_EVERY_EXECUTION",
  "working_directory": "tests/SSH_Tests/",
  "commands": [
    "date >> tmp.log"
  ],
  "targets": [
    {
      "type": "DIGITAL_OCEAN",
      "id": "do_server",
      "host": "buddy-tests",
      "port": "6464",
      "auth": {
        "method": "ASSETS_KEY",
        "username": "api_tests_user",
        "password": "$MyPassword",
        "asset": "id_project"
      },
      "integration": "digitalocean"
    }
  ],
  "run_as_script": true,
  "shell": "BASH",
  "execute_every_command": false
}'
EXAMPLE RESPONSE
{ "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/175688/actions/196737", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/175688/action/196737/edit", "id": 1610091, "name": "Execute commands on 192.0.2.1 (integration)", "type": "SSH_COMMAND", "trigger_time": "ON_EVERY_EXECUTION", "last_execution_status": "INITIAL", "disabled": false, "working_directory": "tests/SSH_Tests/", "commands": [ "date >> tmp.log" ], "targets": [ { "type": "DIGITAL_OCEAN", "id": "do_server", "host": "buddy-tests", "port": "6464", "auth": { "method": "ASSETS_KEY", "username": "api_tests_user", "password": "secure!mVDZtTa4G2jzOcxn6u5Ifg==.37LzUFR4h/6jFECXuElXzw==", "asset": "id_project" }, "integration": "digitalocean" } ], "pipeline": { "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/525739", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/525739", "id": 525739, "name": "pip6", "definition_source": "LOCAL", "git_config_ref": "FIXED", "events": [ { "type": "PUSH", "refs": [ "refs/heads/master" ] } ], "priority": "NORMAL", "disabled": false, "last_execution_status": "INITIAL", "always_from_scratch": false, "ignore_fail_on_project_status": false, "no_skip_to_most_recent": false, "terminate_stale_runs": false, "auto_clear_cache": false, "fetch_all_refs": false, "fail_on_prepare_env_warning": true, "concurrent_pipeline_runs": false, "do_not_create_commit_status": false, "stale": false, "waiting_for_push": false, "resources": "DEFAULT", "git_config": { "path": ".buddy/pip6.fixed.yml", "branch": "master", "project": "company-website" }, "git_changeset_base": "LATEST_RUN", "filesystem_changeset_base": "DATE_MODIFIED", "cpu": "X64", "description_required": false }, "ignore_errors": false, "run_as_script": true, "shell": "BASH", "run_next": "WAIT_ON_SUCCESS", "execute_every_command": false }
STATUS
201 Created
LIMITS
X-Rate-Limit-Limit: 1 X-Rate-Limit-Remaining: 999

Example: Proxy

curl -X POST "https://api.buddy.works/workspaces/:workspace/projects/:project_name/pipelines/:pipeline_id/actions" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
  "name": "SSH with Proxy",
  "type": "SSH_COMMAND",
  "trigger_time": "ON_EVERY_EXECUTION",
  "working_directory": "tests/SSH_Tests/",
  "commands": [
    "date >> tmp.log"
  ],
  "targets": [
    {
      "id": "sftp_target_3",
      "type": "SSH",
      "host": "192.0.2.1",
      "port": "22",
      "auth": {
        "method": "PASSWORD",
        "username": "sftp-pass-0",
        "password": "$MyPassword"
      },
      "proxy": {
        "host": "proxy.myserver.com",
        "port": "80",
        "auth": {
          "method": "PASSWORD",
          "username": "api_tests_user_proxy",
          "password": "$MyPassword"
        }
      }
    }
  ]
}'
EXAMPLE RESPONSE
{ "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/525739/actions/1610128", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/525739/action/1610128/edit", "id": 1610128, "name": "SSH with Proxy", "type": "SSH_COMMAND", "trigger_time": "ON_EVERY_EXECUTION", "last_execution_status": "INITIAL", "disabled": false, "working_directory": "tests/SSH_Tests/", "commands": [ "date >> tmp.log" ], "targets": [ { "type": "SSH", "id": "sftp_target_3", "host": "192.0.2.1", "port": "22", "auth": { "method": "PASSWORD", "username": "sftp-pass-0", "password": "secure!mVDZtTa4G2jzOcxn6u5Ifg==.37LzUFR4h/6jFECXuElXzw==" }, "proxy": { "host": "proxy.myserver.com", "port": "80", "auth": { "method": "PASSWORD", "username": "api_tests_user_proxy", "password": "secure!mVDZtTa4G2jzOcxn6u5Ifg==.37LzUFR4h/6jFECXuElXzw==" } } } ], "pipeline": { "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/525739", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/525739", "id": 525739, "name": "pip6", "definition_source": "LOCAL", "git_config_ref": "FIXED", "events": [ { "type": "PUSH", "refs": [ "refs/heads/master" ] } ], "priority": "NORMAL", "disabled": false, "last_execution_status": "INITIAL", "always_from_scratch": false, "ignore_fail_on_project_status": false, "no_skip_to_most_recent": false, "terminate_stale_runs": false, "auto_clear_cache": false, "fetch_all_refs": false, "fail_on_prepare_env_warning": true, "concurrent_pipeline_runs": false, "do_not_create_commit_status": false, "stale": false, "waiting_for_push": false, "resources": "DEFAULT", "git_config": { "path": ".buddy/pip6.fixed.yml", "branch": "master", "project": "company-website" }, "git_changeset_base": "LATEST_RUN", "filesystem_changeset_base": "DATE_MODIFIED", "cpu": "X64", "description_required": false }, "ignore_errors": false, "run_as_script": false, "shell": "SH", "run_next": "WAIT_ON_SUCCESS", "execute_every_command": false }
STATUS
200 OK
LIMITS
X-Rate-Limit-Limit: 1 X-Rate-Limit-Remaining: 999