Recently I have become confused about how boundary terms in the action affect transition amplitudes. Ultimately I am concerned about field theory, but I think my confusion can be demonstrated with a free point particle example as well.
Consider the matrix element $$ \,_{H}\langle x_2, t_2|x_1, t_1\rangle_{H} = \,_S\langle x_2|e^{iH(t_2 - t_1)}|x_1\rangle_S$$
Where $H, S$ denotes a Heisenberg and Schrodinger vector, respectively. I am interested in understanding this matrix element from the path integral point of view: $$\,_{H}\langle x_2, t_2|x_1, t_1\rangle_{H} = \int_{q(t_1) = x_1}^{q(t_2) = x_2}\mathcal{D}q(t)\,e^{iS[q]}.$$
My confusion comes from the fact that there are many different representations of the action which could describe a free point particle, which differ by boundary terms. For example, one could use $$S_1[q] = \frac{1}{2}\int_{t_1}^{t_2}dt\,\dot q^2.$$ Alternatively, one could also use $$S_2[q] = -\frac{1}{2}\int_{t_1}^{t_2}dt\,q\ddot q = S_1[q] - \frac{1}{2}\Big(x_2\dot x_2 -x_1\dot x_1\Big).$$
The first choice of action is traditionally what one would use, and it comes from the Hamiltonian $$H_1 = \frac{p^2}{2}$$ However, I am wondering if the second choice of action has any physical meaning. In particular my questions are the following:
(1) Does using $S_2$ actually compute a transition amplitude at all? For instance, if we use this action, we would have $$\,_{H}\langle x_2, t_2|x_1, t_1\rangle_{H} = e^{ - \frac{i}{2}(x_2\dot x_2 -x_1\dot x_1)}\int_{q(t_1) = x_1}^{q(t_2) = x_2}\mathcal{D}q(t)\,e^{iS_1[q]}$$ This does not seem like a well defined object because $\dot x_{1,2}$ are not well defined. If this path integral does not compute a transition amplitude, does it have another interpretation?
(2) What affect do the boundary terms in $S_2$ have on the Hamiltonian? Is there a different Hamiltonian $H_2$ that gives $S_2$?
Note: For question (1), one could argue that the problematic pieces only appear as a phase, and thus drop out after taking the modulus. This is true for this simple example, but it may not be in general. For instance, one might consider $$\,_H\langle x_2, t_2|\psi\rangle_H = \int dx_1\int_{q(t_1) = x_1}^{q(t_2) = x_2}\mathcal{D}q(t)\,e^{iS_2[q]}\,_{H}\langle x_1, t_1|\psi\rangle_H \\= e^{ - \frac{i}{2}x_2\dot x_2}\int dx_1 \,e^{\frac{i}{2}x_1\dot x_1}\int_{q(t_1) = x_1}^{q(t_2) = x_2}\mathcal{D}q(t)\,e^{iS_1[q]}\,_{H}\langle x_1, t_1|\psi\rangle_H $$ where the $x_1 \dot x_1$ piece does not appear as a phase.