The deployment of collaborative robotic systems in industry 4.0 raises the potential for complex human-robot interaction to create highly flexible processes. This brings a need for systems that can facilitate rapid programming and development of safe collaborative processes, without the need for extensive training. In this paper we introduce a novel Application Programming Interface (API) for the KUKA Intelligent Industrial Work Assistant (iiwa) Lightweight Robot (LBR) that enables fast development and integration of devices, using the popular Robot Operating System (ROS), without compromising the inherent safety features of the robot. We describe the API, released as a freely available download, and provide an example application of its use to support a large-scale interactive participant experiment. As flexible manufacturing technologies become ever more connected and complex, it is important to ensure compatibility between networked devices and provide tools to support system integration based on common platforms. Our API is one such tool, and has been designed to support faster and easier system integration and development, providing particular support to scientists in creating experiments for studying human-robot collaboration.