Understanding of the expressions for vacuum-to-vacuum transition amplitude Consider the amplitude $$Z=\big\langle 0\big|\exp\big(-\frac{iHT}{\hbar}\big)\big|0\big\rangle.$$ This is same as $$Z=\int\limits_{-\infty}^{+\infty} dq\int\limits_{-\infty}^{+\infty} dq^\prime\langle 0|q^\prime\rangle\langle q^\prime|e^{-iHT/\hbar}|q\rangle\langle q|0\rangle=\int\limits_{-\infty}^{+\infty} dq\int\limits_{-\infty}^{+\infty}dq^\prime~ \phi^*_0(q^\prime)\phi_0(q)K(q,t;q^\prime,t^\prime)$$ where $\phi_0(q)$ is the position space wavefunction for the ground state $|0\rangle$ evaluated at $q$ and $$K(q,t;q^\prime,t^\prime)\equiv \langle q^\prime|e^{-iHT/\hbar}|q\rangle=\int_{q(t)=q}^{q(t^\prime)=q^\prime} Dq(t) \exp\Big[i\int_0^Tdt(\frac{1}{2}m\dot{q}^2-V(q)\Big].$$ This integral has informations about the ground state i.e., we need the ground state wavefunction to evaluate this. 
But $Z$ has an alternative expression in terms of a path-integral as $$Z=\int Dq(t) \exp\Big[\frac{i}{\hbar}\int_0^Tdt(\frac{1}{2}m\dot{q}^2-V(q)\Big].$$ Unlike the first expression of $Z$, from the second expression has anything to do with the ground state or knows about the ground state. I find it amusing that the second relation apparently oblivious to the ground state?


*

*Is there any boundary condition for $q(0)$ and $q(T)$ in $\int Dq(t)$? This is not clear. Now, we are not evaluating $\big\langle q_i\big|\exp\big(-\frac{iHT}{\hbar}\big)\big|q_f\big\rangle$. So I see no reason of fixing anything.

*It is possible to derive the second relation from the first or the first relation from the second?

*Is there a similar path integral expression for $\big\langle f\big|\exp\big(-\frac{iHT}{\hbar}\big)\big|i\big\rangle$ where $i$ and $f$ are arbitrary initial or final state?
 A: Let's be more careful:
$$
K(q,t|q^\prime, t^\prime)=\int_{q(t)=q}^{q(t^\prime)=q^\prime} Dq(t) \exp\Big[i\int_0^Tdt(\frac{1}{2}m\dot{q}^2-V(q)\Big].
$$
In this integral you need integrate over all continuous trajectories with boundary conditions at $t$ and $t^\prime$: $q(t)=q$ and $q^\prime(t^\prime)=q^\prime$.
Using $K$ you easily can calculate evaluation of wave function:
$$
\psi(q,t) =\int dq^\prime K(q,t|q^\prime, t^\prime)\psi(q^\prime, t^\prime)
$$
So for amplitude you obtain:
$$
\big\langle \psi^\prime(t)\big|\psi(t)\big\rangle
=
\big\langle \psi^\prime(t)\big|\exp\big(-\frac{iH(t-t^\prime)}{\hbar}\big)\big|\psi(t^\prime)\big\rangle
=
\int dq \underbrace{\int dq^\prime K(q,t|q^\prime, t^\prime)\psi(q^\prime, t^\prime)}_{\psi(q,t)}(\psi^\prime(q,t))^*
$$
For vacum-vacum amplitude you need put ground state wave function.
For partition function (which usually denoted as Z):
$$
Z =Tr_{\mathcal{H}}e^{-iHT/\hbar} = 
\int dq \big\langle q\big|\exp\big(-\frac{iHT}{\hbar}\big)\big|q\big\rangle
=\int dq\int_{q(0)=q}^{q(T)=q} Dq(t) \exp\Big[i\int_0^Tdt(\frac{1}{2}m\dot{q}^2-V(q)\Big]
$$
Useful reference Path Integral
Also I recommend you read appendix in book by Joseph Polchinski
