There are several possible definitions of initial object in a 2-category $\mathfrak{K}$; which one is appropriate depends on your applications.

1. A 2-category has an underlying ordinary category, so we may just reuse the standard definition of initial object.
2. A 2-category can be regarded as a category enriched over categories, so we may use the definition of initial object in an enriched category. Concretely, this refers to an object $a$ such that the hom-category $\mathfrak{K} (a, b)$ is the terminal category for all objects $b$ in $\mathfrak{K}$.

  Clearly, every enriched initial object is an initial object in the underlying ordinary category, but the converse is not true. (For example, the unique object of $\mathfrak{K} (a, b)$ may have non-trivial endomorphisms.) This definition is standard: see e.g. [Kelly, _Basic concepts of enriched category theory_].
3. We can do things up to isomorphism in a 2-category, so we might define an initial object to be an object $a$ such that the hom-category $\mathfrak{K} (a, b)$ has only one object up to isomorphism. This is the same thing as an initial object in the "homotopy category" $\operatorname{Ho} \mathfrak{K}$ obtained by identifying all isomorphic morphisms in $\mathfrak{K}$.

  Clearly, an object that is initial in the underlying ordinary category of $\mathfrak{K}$ is also initial in this sense, but the converse is not true. As far as I know, this definition is not used.
4. Every 2-category is also a bicategory, so we can take the definition from there. A bicategorical initial object in $\mathfrak{K}$ is an object $a$ such that the hom-categories $\mathfrak{K} (a, b)$ are contractible _groupoids_. More concretely, this means there is a morphism $a \to b$ for every $b$ and there is a unique 2-cell between any parallel pair of morphisms $a \to b$.

  Every bicategorical initial object is also initial in the sense of (3). This definition is a special case of the general notion of bilimit: see e.g. [Kelly, _Elementary observations on 2-categorical limits_].

5. Every 2-category can be regarded as a simplicially enriched category by replacing each hom-category with its nerve. We could therefore define an initial object in $\mathfrak{K}$ to be an object $a$ such that the nerve of $\mathfrak{K} (a, b)$ is contractible for all $b$.

  It is not hard to see that bicategorical initial objects are also initial in this sense, but the converse is not true. (For example, $\mathfrak{K} (a, b)$ might have non-invertible morphisms.) I have not seen this definition before, but it may be useful if $\mathfrak{K} (a, b)$ is actually standing in for a homotopy type.

If the hom-categories of $\mathfrak{K}$ are posets (and I mean partially ordered set, _not_ preordered set) then definitions (1) – (4) coincide. This is because the only isomorphisms in a poset are the identities.