A spring pin tolerates a wider hole tolerance than a solid dowel and stays put without a retaining ring, which makes it a quick way to join or locate parts. The spring action also absorbs some vibration and allows the pin to be reused a limited number of times.
Choose the duty level for the application and confirm the hole diameter, the pin diameter and the shear load; a light-duty pin in a heavily loaded joint will deform or work loose. Note that a spring pin is not a cotter pin, and confirm the material and finish for the environment.