Universal property of the codomain fibration Let $\mathcal{C}$ a category with pullbacks. Does $\mathsf{cod}: \mathcal{C}^{\to}\to\mathcal{C}$ have any kind of universal property in the category of (co)fibrations over $\mathcal{C}$? I'd want it to be "terminal" in some way, or to play a role in factorizing certain (all?) (co)fibrations.
Note: I'm aware that $\mathsf{cod}$ can be easily interpreted via comma categories, but I'm not very familiar with them, so any pointer in that direction would be helpful, too.
 A: First a note about terminology: older literature sometimes uses the term "cofibration" for a functor $p:E\to B$ such that $p^{\rm op} : E^{\rm op} \to B^{\rm op}$ is a fibration, but it's more common nowadays to call this an "opfibration", with "cofibration" used instead for a functor whose corresponding morphism $B\to E$ in ${\rm Cat}^{\rm op}$ is a fibration.  One reason for this is that opfibrations, like fibrations, are characterized by a lifting property, like fibrations in homotopy theory, whereas cofibrations (in the modern sense) are instead characterized by an extension property, like cofibrations in homotopy theory.
With that out of the way, the most basic universal property of $\rm cod$ is that it is the free opfibration over $C$ generated by ${\rm id} : C\to C$.  In other words, if $p:E\to C$ is an opfibration equipped with a section $s:C\to E$, such that $p s = 1_C$, then there is an essentially unique map of opfibrations $\tilde{s} : C^{\to} \to E$.  More generally, for any functor $f:A\to C$, the opfibration $A\times_C C^{\to}$ is the free opfibration generated by $f$.  This doesn't even need the fact that $C$ has pullbacks.
A fancier universal property, which does use finite limits in $C$ and the consequent fact that $\rm cod$ is also a fibration, is that in the "universe" of fibrations over $C$, the codomain fibration is the "free coproduct completion of a point", in the same way that $\rm Set$ is the free coproduct completion of a point in the universe of ordinary categories.  Here "coproduct complete" means having "indexed coproducts", meaning that a fibration is also an opfibration and satisfies the Beck-Chevalley condition.  Thus, for any fibration $p:E\to C$ with this property, and any object $X\in p^{-1}(1)$, there is an essentially unique $g:C^{\to}\to E$ that is a morphism of both fibrations and opfibrations and maps $1_1$ to $X$.
