BigCommerce API: An Overview
This guide will show you the steps to create a BigCommerce API account, token generation, explore different account types, and essential security considerations. By the end, you’ll be ready to leverage the BigCommerce API and unleash the true power of your online business.
What Is The BigCommerce API?
The BigCommerce API (Application Programming Interface) is a suite of tools that empowers developers to programmatically interact with the BigCommerce platform, create apps, automate store processes, and build headless ecommerce solutions, thereby enhancing the functionality and flexibility of online stores hosted on BigCommerce.
At its core, the BigCommerce API provides a way to access and manipulate store data, including products, customers, orders, shipments, and more, through well-defined HTTPS requests. This capability opens up a wide range of possibilities for store owners and developers to
BigCommerce API Benefits
Here’s a glimpse into the key benefits you can get by leveraging Bigcommerce API:
- Enhanced Functionality: Beyond the limitations of BigCommerce’s core features, API allows developers to create custom functionalities tailored to your specific business needs, offering unique shopping experiences to customers.
- Streamlined Integrations: The API enables seamless integration with third-party apps and services, including CRM systems, marketing tools, payment gateways, and shipping providers, creating a more cohesive ecosystem for the online store.
- Scalability: As businesses grow, the BigCommerce API can help manage increasing volumes of data and transactions, supporting scalability with minimal disruption.
- Personalized Customer Experiences: The BigCommerce API enables the creation of customized shopping experiences by allowing for targeted product recommendations, personalized marketing campaigns, and tailored customer service interactions based on detailed customer data analysis.
- Automation: Routine tasks such as inventory management, order processing, and customer updates can be automated, saving time and reducing the potential for human error.
- Headless Commerce: By decoupling the frontend presentation layer from the backend e-commerce functionality, the BigCommerce API supports headless commerce architectures, offering flexibility to use custom frontends for various platforms (web, mobile, IoT devices) while maintaining a unified backend system.
While exploring the vast potential of the BigCommerce API to enhance your store’s capabilities, it’s essential to understand the foundational aspects of BigCommerce app development, which can significantly elevate your e-commerce strategy.
BigCommerce Key APIs
The BigCommerce API ecosystem offers diverse tools to manage your online store. Let’s delve into some key APIs:
REST Store Management API
These APIs provide comprehensive access to manage and retrieve data across various store aspects, including products, customers, orders, and catalog information, enabling developers to automate store operations, streamline workflows, and integrate external systems for enhanced store management and operations.
Example use cases include the following:
- Add and update products in a store
- Update a customer’s order and change the order status
- Create a coupon
- Manage a customer’s store account details
Key areas these APIs encompass include:
- BigCommerce Products API: Enables adding, updating, deleting, and retrieving product details, making it easier to manage inventory.
- BigCommerce Categories API: Allows organizing products into categories, enhancing the shopping experience through easier navigation.
- BigCommerce Orders API: Empowers businesses to automate order processing, including creating, updating, and retrieving orders, as well as handling returns and refunds.
- BigCommerce Customers API: Offers capabilities to manage customer information, including profiles, addresses, and group memberships, aiding in personalized marketing and loyalty programs.
- Coupons & Discounts API: Allows for the creation and management of promotional campaigns, including coupons, discounts, and sales, to drive customer engagement and sales.
GraphQL Storefront API
BigCommerce’s GraphQL Storefront API allows for querying and modifying products, customers, and carts. It also enables initiating a checkout process on both headless and traditional storefronts. Some practical applications include:
- Enhancing a Stencil storefront with extra product information
- Retrieving customer information on a site’s frontend
- Handling shopping carts on a headless storefront
- Obtaining details about categories and brands directly from the store’s frontend
Customer Login API
The Customer Login API provides the capability to log customers into a BigCommerce storefront programmatically. Some practical applications of this include:
- Logging customers into a BigCommerce store from an external account or a headless storefront setup.
- Allowing customers to log in using alternative credentials, like a phone number, instead of the standard email and password.
- Facilitating the integration of a BigCommerce store with a Single Sign-On (SSO) provider.
Current Customer API
BigCommerce’s Current Customer API enables you to identify which customer is logged into a storefront during a session. This can be used to:
- Confirm a customer’s identity directly in the browser.
- Validate a customer’s identity to show them personalized information from an external application.
BigCommerce Product API v2
The BigCommerce Product API v2 enables developers to programmatically manage and access detailed information about the products within a BigCommerce store. This RESTful API provides extensive capabilities to create, read, update, and delete (CRUD) product data, making it an essential tool for merchants and developers looking to automate and enhance their online store operations.
Use cases include:
- Keep product data synchronized between BigCommerce and other systems, such as ERP or PIM software.
- Automate routine tasks like updating prices, stock levels, and product descriptions, ensuring that the store’s catalog remains current with minimal manual intervention.
- Fetch product information, ensuring seamless integration with BigCommerce’s backend capabilities.
- List BigCommerce store products on external marketplaces, expanding the store’s reach and increasing sales opportunities.
BigCommerce Product API v3
The BigCommerce Product API v3 is the latest version of the API. It’s designed to offer more efficient, scalable, and flexible ways to handle product information, building upon the capabilities of its predecessor (Bigcommerce API v2) with enhanced features, improved performance, and a more developer-friendly experience.
Use cases include:
- Headless commerce architectures, where businesses require a flexible backend to pair with custom frontend experiences across various platforms and devices.
- Manage their product listings and sync inventory across multiple platforms from a single source.
- Offer highly customized and personalized products, enhancing customer satisfaction and loyalty.
- Manage extensive product catalogs, update product information in real time, and maintain accurate inventory levels.
How To Create Your BigCommerce API
BigCommerce offers two types of API accounts: Store-level and Account-level. Here’s a guide on creating each type:
Store-Level API Account
- Navigate to API Settings: Log in to your BigCommerce admin panel. Go to Settings and then Store-level API Tokens. Click the + Create API Account button.
- Choose Token Type: Select the type of account you need. Choose V2/V3 API token for general API access or Stencil-CLI token for theme development.
- Provide Account Details: Enter a descriptive Name (minimum 4 characters) for your account.
- Configure V2/V3 Token (Optional):
- If you chose V2/V3 token, note the API Path. You’ll use this later.
- Under OAuth Scopes, choose the level of access your application needs for each resource (read-only or modify). Refer to BigCommerce’s API documentation for details on Scopes.
- Save and Download Credentials: Click Save. Upon successful creation, a pop-up will display your API credentials (Client ID, Access Token, etc.). You’ll also be prompted to download a .txt file containing the same information.
Important: These credentials are critical. You cannot retrieve them later if you close the pop-up. Make sure to copy and paste them or save the downloaded file securely. For V2/V3 tokens, it’s recommended to include the API Path alongside the downloaded credentials.
Account-Level API Account
- Access Account Settings: Go to Settings and then Account-level API Tokens. You’ll be redirected to the Account-level API accounts page. Click the + Create Account-level API account button.
- Provide Account Details: Enter a Name for the app or integration using this API token. Note the API Path displayed.
- Set OAuth Scopes: Under OAuth Scopes, choose the necessary permissions for your application. You can select multiple options per resource. Refer to BigCommerce’s documentation for details on Scopes specific to Account-level accounts.
- Save and Download Credentials: Click Save. Similar to store-level accounts, a pop-up will display your credentials and prompt you to download a .txt file. Remember to securely store these credentials. As with V2/V3 tokens, including the API Path with the downloaded credentials.
Define Permissions (Don’t Overdo It!): Under OAuth Scopes, carefully select the specific API resources and functionalities your application requires. You can choose multiple options per resource, but remember – granting only the necessary permissions enhances your store’s security. Here are some common scopes you might encounter:
- Subscriptions: Manage abandoned cart recovery and email marketing subscriptions.
- Checkouts: View or create customer checkouts within your storefront.
- Charges: Utilize the Payments API to add or remove charges.
- Account: Access account details with GraphQL at the account level.
Save and Secure: Click Save. A pop-up window will appear, showcasing your API credentials. Here’s the most crucial step:
- Download the .txt file: This file contains the API credentials your application needs for secure access. Download it and store it securely.
Important Note: Once you dismiss the pop-up window, there’s no way to retrieve the credentials again. So, be sure to either:
- Save the downloaded .txt file: This is the safest option.
- Copy and paste the credentials: If downloading isn’t an option, carefully copy and paste each credential from the pop-up window and store them securely.
Pro Tip: For an extra layer of security, consider combining the downloaded API Path value (from Step 5) with the credentials you obtain.
How To Create A Product With BigCommerce API
Requirements:
Before creating a product, make sure you have the following:
- A BigCommerce store
- API credentials (store hash)
Steps
- Construct the Request
- You’ll use a POST request to /stores/{store_hash}/v2/products. Replace {store_hash} with your actual store hash.
- In the request body, include a JSON object representing the new product. Here’s an example with the minimum required properties:
JSON
{
“name”: “Plain T-Shirt”,
“type”: “physical”,
“description”: “This timeless fashion staple will never go out of style!”,
“price”: “29.99”,
“categories”: [18], // Replace 18 with your category ID
“availability”: “available”,
“weight”: “0.5”
}
Required properties:
- name: The product name (string)
- type: Product type (“physical” or “digital”)
- description: Product description (string)
- price: Price of the product (string)
- categories: An array of category IDs (integers)
- availability: Product availability (“available” or “disabled”)
- weight: Product weight (decimal)
Optional properties:
- is_visible: Set to true to make the product visible on the storefront (boolean)
- You can add other properties as documented in the BigCommerce API reference [BigCommerce Catalog API].
Send the Request
- Use a tool like Postman to send the POST request with the JSON data to BigCommerce API.
Handle the Response
- If successful, you’ll receive a JSON response with the newly created product details, including its ID.
- In case of errors, the response will contain an error code and message to help you diagnose the issue. Refer to BigCommerce API documentation for error codes [BigCommerce Catalog API].
Additional Notes
- BigCommerce limits the number of categories a product can belong to (maximum 1,000).
- Setting is_visible to true ensures the product appears on the storefront.
- You can update or delete products using PUT and DELETE requests, respectively, following similar principles.
By following these steps and referring to the BigCommerce API documentation for details on additional properties and functionalities, you can effectively create and manage your products using the BigCommerce API.
Bottom Line
With your BigCommerce API credentials safely secured, you’re now equipped to explore the vast possibilities that the BigCommerce API offers.