TITLE: Explicit description of the stack associated to a groupoid
QUESTION [5 upvotes]: Let $\{X_1 \rightrightarrows X_0\}$ be a smooth groupoid object in the category of affine schemes ($X_0 \to X_1$, $X_1 \to X_1$ and $X_1 \times_{X_0} X_1 \to X_1$ also belong to the datum). Equivalently, we have a smooth commutative Hopf algebroid. Let $X$ be the associated algebraic stack. Thus, we have a presentation $X_0 \twoheadrightarrow X$ (which is smooth, surjective and affine) with $X_0 \times_X X_0 = X_1$, and $X$ is geometric. Every geometric stack arises this way.
Question. If $Y$ is a scheme, how can we describe $X(Y)$ explicitly in terms of $Y$ and the $X_i$?
This should be somewhere in the literature? For example, if $X_0 = \mathrm{Spec}(\mathbb{Z})$, then $X_1$ is a group scheme, $X$ is its classifying stack, so that $X(Y)$ consists of $X_1$-torsors on $Y$, right?
In general, I expect that the answer will be some kind of "torsors under the groupoid". A morphism $Y \to X$ may be pulled back to $Y_0 \to X_0$, where $Y_0 \to Y$ is smooth, surjective and affine. Conversely, if $Y_0 \to Y$ is smooth, surjective and affine, and $Y_0 \to X_0$ is a morphism, then an extension to $Y \to X$ corresponds to a descent datum of $Y_0 \to X_0 \to X$ with respect to the fpqc cover $Y_0 \to Y$. But this still involves $X$. How can we get rid of $X$ in the description of morphisms $Y \to X$?

REPLY [3 votes]: Niels already links to references that answer the question, but I'll briefly summarize them.
If $X$ is a stack presented by a groupoid $X_1 \rightrightarrows X_0$ then a map from a scheme $S$ into $X$ induces a groupoid presentation $S \mathop{\times}_X X_1 \rightrightarrows S \mathop{\times}_X X_0$ of $S$.  Conversely, suppose that we have a groupoid presentation $S_1 \rightrightarrows S_0$ of $S$ and compatible maps $S_i \rightarrow X_i$ (such that the two maps $S_1 \rightarrow S_0$ are induced by pullback from the two maps $X_1 \rightarrow X_0$) then there is an induced map $S \rightarrow X$.
The associated stack of the groupoid $X_\bullet$ is therefore the fibered category $X$ for which $X(S)$ is the category of groupoid presentations of $S$ with a map to $X_\bullet$ satisfying the above parenthetical condition.