Skip to main content
POST
Kill Process

Endpoint

Sends a SIGTERM signal to terminate a process by its PID. This endpoint provides a safe way to stop processes from the psys interface.

Request

number
required
The process ID (PID) of the process to terminate. Must be a positive integer.

Example Request

Response

Success Response (200)

Returned when the process is successfully terminated.
boolean
required
Always true on success

Error Responses

string
Error message describing what went wrong

400 Bad Request

Returned when the PID is invalid (not a number, negative, or zero).
Causes:
  • PID is not a number
  • PID is less than or equal to 0
  • PID is not an integer

403 Forbidden

Returned when the process cannot be killed due to insufficient permissions (EPERM error).
Causes:
  • Process is owned by another user
  • Process requires elevated privileges to terminate
  • System security policies prevent the operation

404 Not Found

Returned when the specified process does not exist (ESRCH error).
Causes:
  • Process with the given PID does not exist
  • Process has already terminated

500 Internal Server Error

Returned for any other unexpected error during process termination.

Implementation Details

  • Uses Node.js process.kill(pid, 'SIGTERM') to send the termination signal
  • SIGTERM allows the process to perform cleanup before exiting
  • The endpoint is configured with dynamic = "force-dynamic" and runtime = "nodejs"
  • PID validation accepts both numeric values and string representations that can be parsed as integers
Important: This endpoint sends SIGTERM, which allows graceful shutdown. The process may take time to terminate or may ignore the signal. Use system tools like kill -9 for forced termination if needed.

Security Considerations

  • Only processes that the server has permission to terminate can be killed
  • System processes and processes owned by other users will return a 403 error
  • Always validate the PID before calling this endpoint to avoid unintended termination

Example Usage