Skip to main content
More in Learn

Get All Orders by a Customer

With the Crystallize Order API, you can retrieve all the orders made by a particular customer. This section will show you how.

In order to perform these operations, ensure that you have the proper authentication (if necessary) and user permissions.

Fetch All Orders

In order to fetch all orders by a customer, you’ll need to provide the customer identifier to the query. The query below uses getAll and provides the customerIdentifier argument to it. It then fetches information regarding all the orders the customer has placed until now.

Slicing Results

You can slice the list of orders you get back by using the first argument. This argument allows you to fetch only the number of orders you specify. Let's say you only want to grab the first three results. This is how you would do it:


The Order API uses cursor-based pagination. A cursor can be defined as a pointer that’s generally an ID representing a specific location in a list. GraphQL uses the concept of connections for this purpose.

GraphQL Connections

A connection in GraphQL acts as a wrapper for the list of results you’re paginating. Any connection consists of two fields: edges and pageInfo. Take a look at the following query:

The query above contains the following:

  • edges: contains a list of OrderConnectionEdge types.
  • node: the object containing the information about an order.
  • cursor: a string specifying the location of an item in the list.
  • pageInfo: this contains fields such as hasNextPage, hasPreviousPage, endCursor, startCursor, and totalNodes.

Using Pagination

To apply pagination to the list of orders, use the first argument and the after argument, which is the cursor. The following query fetches the first two items, starting from the cursor value provided to it.

People showing thumbs up

Need further assistance?

Ask the Crystallize team or other enthusiasts in our slack community.

Join our slack community