Xc banner image

Understanding Shopify APIs in Hydrogen for B2B Commerce: Storefront, Customer Account, and Admin

Chen Liang Headshot
Lead Commerce Architect - SFCC/Shopify Plus
  • Twitter
  • LinkedIn

When building a B2B storefront with Shopify Hydrogen, developers encounter three different APIs: the Storefront API, the Customer Account API, and the Admin API. At first glance, it may seem tempting to rely only on the Admin API, since it appears to expose nearly all store data. However, each API is designed for a specific purpose, and understanding how they work together is key to building secure, scalable B2B Hydrogen applications.

Storefront API - Powering the Shopping Experience

The Storefront API is the primary API used to power the customer-facing storefront. It provides optimized access to the data required for browsing and purchasing.

Typical use cases include:

  • Fetching products and collections
  • Displaying product details and recommendations
  • Managing carts and checkout
  • Product search and merchandising

Because the Storefront API is designed to support high-volume public traffic, it is the best choice for product catalog data and most interactions that occur, even for B2B storefronts.

Customer Account API - Managing Authenticated B2B Customer Sessions

The Customer Account API is designed for authenticated customer experiences. In a Hydrogen application, it mainly powers the /account area of the storefront.

Common use cases include:

  • Viewing order history
  • Managing addresses
  • Accessing customer profile information
  • Viewing orders and draft orders associated with a customer

For B2B customers, this API is particularly useful for managing the authenticated account session and identifying the logged-in user.

However, the data returned by the Customer Account API is typically scoped to the individual customer, which means it does not always provide the broader company-level visibility often required in B2B commerce.

Admin API - Enabling Advanced B2B Business Logic

The Admin API provides deeper access to store management data and operations. While it is commonly used for administrative tools, it becomes essential in many advanced B2B implementations.

Typical B2B-related use cases include:

  • Accessing company and organization-level data
  • Managing company users, roles, and permissions
  • Working with draft orders, quotes, or approval workflows
  • Accessing advanced store configuration and metadata
  • Creating and updating metaobjects or metafields used for custom B2B entities
Why Not Just Use the Admin API for Everything in B2B?

Since B2B storefronts often require deeper data access, developers sometimes wonder whether they should simply use the Admin API for everything. However, this approach is not recommended.

There are several important reasons:

Security

Admin API tokens provide extensive access to store data. Exposing these tokens to the browser would introduce serious security risks, which is why the Admin API must remain server-side.

Rate Limits

The Admin API has stricter rate limits compared to the Storefront API. Using it for catalog browsing or product data could create performance bottlenecks, especially for large B2B catalogs.

Performance Optimization

The Storefront API is specifically optimized for storefront queries and is designed to efficiently serve product and merchandising data at scale.

Authentication and Session Handling

Customer authentication and session management are built directly into the Customer Account API. Recreating these flows manually with the Admin API would significantly increase complexity.

Why the Customer Account API Alone Is Not Enough for Many B2B Use Cases

While the Customer Account API works well for standard account functionality, many B2B commerce scenarios require additional capabilities that are only available through the Admin API.

One important limitation is that the Customer Account API cannot update metaobjects or other store-level structured data. Metaobjects are often used in Hydrogen implementations to store structured information such as configuration data or custom B2B entities.

Examples:

Company-Level Order Visibility

In B2B commerce, customers often belong to a company or organization rather than acting as individual buyers. A company administrator may need to view activity across the entire company.

This can include:

  • Viewing orders placed by other users in the same company
  • Accessing company-level purchasing history
  • Managing multiple users within a company account

The Customer Account API typically returns data tied to the logged-in customer, while the Admin API allows access to broader company-level structures.

B2B Role and Permission Management

Many B2B organizations require role-based permissions, such as:

  • Company administrators who manage users
  • Buyers who place orders
  • Approvers who must approve large purchases

Managing these types of permissions often requires interacting with company contacts and roles, which are exposed through the Admin API.

Image 1 of Understanding Shopify API blog

Quote and Approval Workflows

A common B2B purchasing pattern includes steps such as:

  • Requesting a quote
  • Negotiating pricing
  • Submitting an order for approval
  • Converting approved quotes into orders

These workflows are typically implemented using draft orders, metafields, or metaobjects, which require the Admin API.

Shared B2B Resources (Saved Lists and Job Sites)

Many B2B storefronts include shared entities that multiple users within the same company can access.

Examples include:

  • Saved Lists that enable teams to create reusable product lists, share them across company members, and add items to the cart when ready to purchase
  • Job Sites representing project-specific delivery locations
  • Custom quote records or configuration objects

These entities are commonly defined and implemented using Shopify metaobjects, meaning they must be created and updated through the Admin API.

A Practical Architecture for B2B Hydrogen Storefronts

Most Shopify Hydrogen B2B implementations use a layered approach:

  • Storefront API for product discovery and shopping experiences
  • Customer Account API to identify the logged-in customer and manage account sessions
  • Admin API for company-level data, advanced workflows, and custom B2B logic

This architecture allows developers to maintain strong security practices while still enabling powerful B2B commerce functionality.

Learn More About Our B2B Shopify Hydrogen Accelerator

If you're building a B2B storefront on Shopify, our team at XCentium has developed a Shopify Hydrogen B2B Accelerator designed to help businesses launch faster with enterprise-ready capabilities.

The accelerator includes built-in features such as:

  • Quote management
  • Order approval workflows
  • Job Sites management
  • Saved Lists
  • Roles and permissions customization functionality
  • Additional B2B-focused enhancements for complex purchasing flows

If you'd like to learn more about how this accelerator can support your Shopify B2B implementation, feel free to get in touch with the XCentium team. We'd be happy to discuss how it can help accelerate your Hydrogen project.