\cleardoublepage
\pdfbookmark{\contentsname}{Contents} % shows appendix at page 12, but it links to page 11.
\tableofcontents
\section{AA}
\begin{enumerate}
\item BB\ref{apx:api} % points at page 11.
\end{enumerate}
\appendix
\section{Appendix} % starts at page 12. but page 11 is blank.
\label{apx:api}
\centerline{\includegraphics[page=1,scale=0.8]{api.pdf}}
\includepdf[pages={2-}, scale=0.8]{api.pdf}
When it comes to the appendix, there is a blank page before it (page 11), and both \ref and table-of-contents refers to that blank page (table-of-contents does have a correct page number page 12)

geometryto changemargin, this Oreo cream disappeared. That's why it is odd. – Tiina Feb 12 '18 at 07:58