TITLE: How to construct an abelian variety with CM by a given CM field?
QUESTION [5 upvotes]: Let $F$ be a totally real number field, and let $K$ be a quadratic extension of $F$ which cannot be embedded into $\mathbb{R}$. 
Then $K$ is a so called CM field.
For instance, take $F = \mathbb{Q}(\sqrt2)$, and $K = \mathbb{Q}(\zeta_8) = F(i)$ where $\zeta_8$ is a primitive complex $8$-th root of unity.
Denote by $\mathcal{O}_K$ the ring of integers of $K$.
My question is:

How to construct a number field $L$ and an abelian variety $A/L$ such that $\mathrm{End}(A) \cong \mathcal{O}_K ?$

For an example with elliptic curves, take $F = \mathbb{Q}$, and $K = \mathbb{Q}(\sqrt{-14})$ so that $\mathcal{O}_K = \mathbb{Z}[\sqrt{-14}]$.
Evidently, $\mathcal{O}_K$ is a lattice in $\mathbb{C}$ so $E_0 = \mathbb{C}/\mathcal{O}_K$ is an elliptic curve with $\mathcal{O}_K \subseteq \mathrm{End}(E_0)$.
Since $\mathrm{End}(E_0)$ is an order in an imaginary quadratic number field, we have $\mathrm{End}(E_0) \cong \mathcal{O}_K$ as $\mathcal{O}_K$ is the maximal order.
Furthermore, $j(E_0)$ is an algebraic number (in fact, an algebraic integer) which generates a field isomorphic to $L = \mathbb{Q}(\sqrt{2\sqrt{2}-1})$ over $\mathbb{Q}$.
It follows that we can define an elliptic curve $E_1/L$ such that $j(E_1) = j(E_0)$ so that $E_1 \cong_{\mathbb{C}} E_0$ and in particular $\mathrm{End}(E_1) \cong \mathrm{End}(E_0) \cong \mathcal{O}_K$ as required.

Can I tell a similar story (with abelian vaieties instead of elliptic curves) for any CM field?

It is only clear to me that the answer is positive for imaginary quadratic number fields.

REPLY [3 votes]: A reasonably good answer to your question of finding a number field $L$ is given in the comments to Is there an excplicit number field of definition for an Abelian Variety $A/\mathbb{C}$ with CM? . However, the answer is roughly "no, there's no easy way to find $L$". But first you need to understand the difference between the field of moduli and fields of definition. For elliptic curves, the field of moduli is generated by the $j$-invariant (and if you also want the CM maps defined, you need to adjoin $j$ to the CM field, at least if $\text{End}(A)$ is the full ring of integers). For abelian varieties, the field of moduli is the field generated by the point in moduli space, or alternatively the fixed field of
$$ \{\sigma\in\text{Gal}(\overline{\mathbb Q}/\mathbb Q) : \sigma(A)\cong A\}.$$
But there need not be a model for $A$ that is defined over this field. There's a brief discussion of CM abelian varieties in Shimura's Introduction to the Arithmetic Theory of Automorphic Forms (Section 5.5). More detailed information is in books on CM abelian varieties such as those by Shimura-Taniyama and Lang.