BigCommerce API authentication failing with 401 error in Zapier JavaScript

I’m having trouble with BigCommerce API authentication when using JavaScript in Zapier. Every time I try to make a request, I get a 401 unauthorized error. Here’s my current setup:

var credentials = 'Basic ****************';
var endpoint = 'https://mystore.mybigcommerce.com/api/v2/orders?status=completed';

var request = {
    url: endpoint,
    type: 'GET',
    dataType: 'json',
    contentType: 'application/json',
    headers: {
        'Authorization': credentials
    },
    success: function(data) {
        console.log('Success:', data);
    },
    error: function(xhr, status, error) {
        console.log('Error response:', xhr.responseText);
        console.log('Status:', status);
        console.log('Error:', error);
    }
};

$.ajax(request);

I’ve double-checked my credentials and tried running this from a secure HTTPS environment, but the authentication keeps failing. Has anyone successfully integrated BigCommerce API with Zapier using JavaScript? What am I missing here?

check your store url - dont use the old mystore.mybigcommerce.com format. switch to the proper api endpoint: api.bigcommerce.com/stores/your-store-hash/v3/orders. zapier can be flaky with bigcommerce auth, so throw in a delay or retry logic. switching to v3 fixed it for me.

Had the exact same problem last month with BigCommerce integration. Your JavaScript looks fine - the real issue is you’re hitting the wrong API version. BigCommerce killed their v2 API for most stuff, so you need v3 instead. Switch your endpoint to https://api.bigcommerce.com/stores/{store_hash}/v3/orders and use the X-Auth-Token header with your access token (ditch Basic auth). Also, Zapier’s weird about execution context - try their built-in HTTP request action instead of jQuery’s ajax. You’ll find your store hash in BigCommerce admin under Advanced Settings > API Accounts. Once I made these changes, everything worked perfectly.

Had the same BigCommerce API authentication headache in Zapier about six months back. It’s probably your credential format. BigCommerce wants specific headers based on your auth method. Legacy API accounts need both X-Auth-Client and X-Auth-Token headers - don’t use Authorization header. Newer OAuth apps just need X-Auth-Token with your access token. Also, Zapier’s JavaScript environment hates jQuery ajax calls. Use Zapier’s built-in fetch or their HTTP request action instead. And check your API account has the right OAuth scopes for reading orders - that one bit me too.