Partner Information
Becoming A Partner
Getting Started
POS Solutions
ERP Solutions
PIM Solutions
OMS Solutions
Marketing Solutions
Shipping Solutions
Payment Solutions
Provider APIs
Building Apps
Quick Start
Guide
Tutorials
Building Channels
Quick Start
Guide
Tutorials
new
Building Storefronts
Overview
Embedded Checkout
Managing Currencies
Guide

BigCommerce APIs Quick Start

This quick start guide will take you through making your first requests with BigCommerce’s APIs.

REST API

Obtain API credentials

See Authenticating BigCommerce’s Rest APIs for instructions on obtaining store API credentials.

Use Request Runner

The easiest way to experiment with BigCommerce REST APIs is via the built-in Request Runner:

Open in Request Runner

Just copy and paste your store_hash and access_token into the form, then click Send.

Visual Studio Code REST Client

If you use Visual Studio Code, another way to make API requests is with the REST Client extension. Once you have it installed, create a new file called bigcommerce.http and paste in the following:

@ACCESS_TOKEN = your_access_token
@STORE_HASH = your_store_hash

###

GET https://api.bigcommerce.com/stores/{{STORE_HASH}}/v3/catalog/products
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json

Save and you’ll see the send request link above GET. Click send request and the response will open in a split window.

Import API spec file with Postman

Alternatively, you can import the Specification File into Postman (or any other tool that can import Open API Specification files).

To view sample JSON request bodies for each REST API resource, see the API Reference for that resource.

Storefront API quick start

To make your first requests in a browser with the Storefront APIs, see the step-by-step tutorial Working with Storefront Cart and Checkout APIs.

GraphQL API

Obtain storefront token

We’ll use Request Runner for making an initial request to obtain a Storefront API token. It is a REST API request, so you will need to copy and paste your API credentials.

Open in Request Runner

Include the URL of the storefront you will be making the request from as the allowed_cors_origin.

POST https://api.bigcommerce.com/stores/{store_hash}/v3/storefront/api-token

{
  "channel_id": 1,            // int (only ID 1 currently accepted)
  "expires_at": 1602288000,   // double utc unix timestamp (required)
  "allowed_cors_origins": [   // array (accepts 1 origin currently)
    "https://example.com"
  ]
}

Create sample request in the browser

While viewing your storefront in a browser, navigate to the integrated JavaScript console; for example, Google Chrome’s Console. Use it to run the following code after entering your API token in the authorization header, and adding a valid Product ID for the entityId:

   fetch('/graphql', {
        method: 'POST',
        mode: 'cors',
        headers: { 'Content-Type': 'application/json',
                 'Authorization': `Bearer token`},
        body: JSON.stringify({
            query: `
            query SingleProduct {
                site {
                  products (entityIds: product ID) {
                    edges {
                      node {
                        id
                        entityId
                        name
                        prices {
                          price {
                            value
                            currencyCode
                          }
                        }
                      }
                    }
                  }
                }
              }`

            }),
      })
      .then(res => res.json())
      .then(res => res.data);

Customer Login API

The Customer Login API is a Server-to-Server API, which means to make requests against it, you will need a backend service. To view a sample request, see sample code within our PHP client.