Introduction
Last updatedIntroduction#
The DTC (Direct-to-Consumer) API combines the strengths of server-side and client-side GraphQL: giving developers the tools they need to build modern, innovative storefronts, with the help of its clever queries to fetch exactly the data you need. No more, no less.
This means you’re cutting down on resource usage and boosting network speed, making everything run like a well-oiled machine. And with the ability to execute multiple queries or mutations in a single call, you’re looking at seriously enhanced performance. Plus, its strongly typed schema keeps everything reliable and consistent—no surprises here!
Performance isn’t just a feature; it’s at the core of the DTC API, engineered to accommodate heavy frontend utilization without compromising on response times. This ensures a seamless user experience, even under significant load.
The API offers flexible configuration options, including session and no-session modes. This flexibility extends to the management of affiliates, allocation rules, brick-and-mortar locations, and customizable bundles, enriching the development experience. It’s a playground for developers who want to build something truly special.
Discover the Perks#
- Seamless Selection Integration
- Selections created in Centra backend can be easily checked out in the DTC API by generating a selection link and using the
claimSelection
mutation (claimSelection(id: String!, hash: String!)
). This makes it easier to manage selections and streamline the checkout process.
- Selections created in Centra backend can be easily checked out in the DTC API by generating a selection link and using the
- Custom Attributes at Category and Selection Levels
- The DTC API supports custom attributes both at the category level and on individual selections. This flexibility allows you to tailor the experience for your customers and present highly personalized product options.
- Session and No-Session Modes
The DTC API offers two modes:
- Session Mode: This allows users to manage carts, complete checkouts, and perform post-checkout operations based on the shopper’s session details (market, price list, language, etc.).
- No-Session Mode: Stateless and designed to expose only the necessary data, this mode is ideal for building custom caches and efficiently handling data without retaining session information.
- Affiliate Tracking
- The DTC API enables you to track affiliate-driven sales easily. When a user arrives on your site via an affiliate link, the affiliate is connected to the selection. This helps you monitor and analyze orders generated through affiliate partnerships, such as influencer marketing efforts.
- Historical Orders
- Once a customer completes the checkout process, the selection is automatically converted into an order. Registered users can log in and view their historical orders, improving the post-purchase experience and fostering customer retention.
- Advanced Filtering Options
- The DTC API provides comprehensive filtering capabilities (
displayItems.filters
) for narrowing down results by categories, collections, brands, and more. You can retrieve detailed filter data, such as category information, without requiring separate queries. This improves both performance and user experience.
- The DTC API provides comprehensive filtering capabilities (
- Powerful Search Capabilities
- DTC API enables you to implement a search bar with both strict and full-text search options. A simple search query allows the API to find matching results across various fields, improving product discoverability and enhancing the user experience.
Key Tips for Migrating from Checkout API to DTC API#
Optimize Your Data Fetching To ensure smooth performance and avoid overfetching, optimize the data you retrieve based on where the customer is in their journey. Fetch only the necessary data depending on whether the user is browsing, viewing the cart, or checking out.
When moving from the Checkout API to the DTC API, it's important to think about what data you need and where it’s needed. This will help make the transition smoother. From our experience, simply mapping Checkout API responses to the DTC API can cause overfetching — meaning you end up pulling more data than necessary. To avoid this, plan ahead and make sure you're only fetching the data you actually need.
So how do you start the migration?#
When starting, the Catalog is a good place to focus. For example, when fetching a list of display items, you likely don't need all the attributes — just key ones, like the color swatch.
On the PDP (Product Detail Page), you’ll need more detailed data, but only for one product. Related products are fetched similarly to a list view. The same goes for cart vs. checkout: in the cart, you don't need all the data that’s required at checkout.
For instance, in the cart, you probably don't need to load checkout fields like shipping costs. If you're calculating shipping totals, there’s no need to ask for details from services like Ingrid while still in the cart. The same applies to responses when adding products from the PDP.
Next Steps
Take a quick look at the migration table what functionality is covered, we are still working on all the features found in Checkout API and Shop API, and even more to come. Once you have a good grasp of what to expect, dive into the detailed sections on selection, customer, catalog, and checkout to get started on your migration!