REST API Overview

This page covers REST API HTTP status codes and common query parameters for BigCommerce REST APIs.

REST HTTP status codes

BigCommerce REST APIs respond to each request with an HTTP status code that depends on the result from the request. Error responses might also include an error message in the body to assist in resolving the problem.

2xx Success

2xx codes are returned for requests that were understood and processed successfully.

CodeTextPurpose
200OKFor successful GET and PUT requests.
201CreatedFor a successful POST request.
202AcceptedFor a request that resulted in a scheduled task being created to perform the actual request.
204No ContentFor a successful request that produced no response (such as DELETE requests).
207Multi-StatusMultiple operations have taken place and the status for each operation can be viewed in the body of the response. Typically indicates that a partial failure has occurred.

3xx Redirection

3xx codes are returned for requests that require further action.

CodeTextPurpose
301Moved PermanentlyWhen the API routes have changed (unlikely), or if the incoming request is not secure (http), the request will be redirected to the secure (https) version.
304Not ModifiedThis response will be sent if the request included an If-Modified-Since header, but the resource has not been modified since the specified date.

4xx Client Error

4xx codes are returned for requests that could not be processed due to problems with the request or the data. For more information on handling 400 errors skillfully, see API Request Architecture.

CodeTextPurpose
400Bad RequestIssued when a malformed request was sent. The request could not be completed due to a URL restriction. Check the URL for ports that may conflict with site permissions.
401UnauthorizedThis response is sent when your client failed to provide credentials or its credentials were invalid.
403ForbiddenReturned when permissions do not allow the operation.
404Does Not ExistThe requested entity does not exist.
405Method Not AllowedThe resource was found, but doesn’t support the request method. Issued when either a specific method isn’t yet implemented on a resource, or the resource doesn’t support the method at all. For example, a PUT on /orders is invalid, but a PUT on /orders/{_id_} is valid.
406Not AcceptableWhen the client specifies a response content type in the Accept header that is not supported.
409ConflictA change requested by the client is being rejected, due to a condition imposed by the server. The exact reasons for this response will vary from one resource to the next. An example might be attempting to delete a category whose deletion would cause products to be orphaned. Additional information about the conflict, and about how to resolve it, might be available in the response’s details section.
413Request Entity Too LargeWhen the client requests too many objects. For example, the limit parameter exceeded the maximum.
415Unsupported Media TypeReturned due to issues with the Content-Type header.
422Missing or Invalid DataThe request cannot be processed either because it omitted required fields or because it contained invalid data. See the response for more details.
423Locked Status CodeThe requested resource is currently locked and unavailable.
429Too Many RequestsWhen an OAuth client exceeds the rate limit for API requests to a store.
499Client Closed RequestA client terminates the connection before receiving a response.

5xx Server Error

5xx codes are returned for requests that could not be processed due to an internal error with the API or server. For more information on handling 500 errors skillfully, see API Request Architecture.

CodeTextPurpose
500Internal Server ErrorWhen an error has occurred within the API.
501Not ImplementedWhen a request method is sent that is not supported by the API (e.g., TRACE, PATCH).
503Service UnavailableWhen the store is “Down for Maintenance,” being upgraded to a new version, or is suspended due to administrative action or a billing issue.
507Insufficient StorageWhen the store has reached a limitation for the resource, according to their BigCommerce plan (e.g., 500-product limit).

Troubleshooting

CodeCommon CausesSolutions
204, 301, and 302RedirectsTry the www or non-www version of the URL.
400Invalid syntax, required data missing, content-type header missingDouble-check request body for syntax errors and missing data; check content-type header.
401API credentials are missing or invalid.Double-check the access_token and client_id.
Send cURL request with the same credentials to rule app or config issues.
403App lacks required OAuth scopes, a store-owner account changed, operations resulting from API request exceed a platform limit, or URL requested is incorrect. User does not have app install or uninstall permissions.Double-check OAuth Scopes in control panel > API Accounts or in Developer Portal > My Apps.
Check the URL. Are the endpoint and store hash correct?
Ensure platform limits have not been reached.
415Request headers specify an unsupported content-type (or header is missing).Double-check content-type request header.
500Expensive API calls or an internal server error in BigCommerce.Re-attempt the request three to five times, with increasing delays of at least a minute between attempts.
Try reducing the number of objects being requested. You can request fewer objects in the v2 API, by using ?limit={count}. In v2 and v3 API, fewer objects can be requested by excluding certain fields or only requesting certain fields.
Check the BigCommerce Status Page.

Filtering

To filter collections down to a particular set of items, you can add filters to your request as URL query parameters.

The maximum number of products returned is 250. Viewing more products requires creating a script that can loop through each subsequent page.

These are the most common filter options available for the REST Management API:

OperatorExpressionExample
Equals/equivalencyattribute=value/v3/catalog/products?price=10 /v3/catalog/products?name=My Product
Greater than or equal to (for numbers or dates)attribute:min=value/v3/catalog/products?price:min=10
Less than or equal to (for numbers or dates)attribute:max=value/v3/catalog/products?price:max=10
Greater than (for numbers or dates)attribute:greater=value/v3/catalog/products?price:greater=10
Less than (for numbers or dates)attribute:less=value/v3/catalog/products?price:less=10
SQL LIKE operator (for strings)attribute:like=pattern/v3/catalog/categories?name:like=Shirts
SQL IN operator (for arrays)attribute:in=csv,list of values/v3/catalog/products?categories:in=123,456
SQL NOT IN operator (for arrays)attribute:not_in=csv,list of values/v3/catalog/products?categories:not_in=123,456

Available filters vary by endpoint. For up-to-date information on supported filters, refer to the GET method documentation of each endpoint.

Include

Certain endpoints support the include query parameter used to include sub-resources and specific attributes in the primary GET response for a parent object. For example, you can include a product’s variants and images with the product response:

/v3/catalog/products?include=variants,images

The availability of the include query parameter varies by endpoint. For up-to-date filter information, refer to the GET method documentation of each endpoint.

For more information about whether an endpoint supports the include parameter, consult the API reference for the endpoint in question.

Include and exclude fields

Many of BigCommerce’s REST API endpoints support both include_fields and exclude_fields query parameters.

  • include_fields query parameter will return ONLY the specified fields in the response.
  • exclude_fields query parameter will omit the specified fields from the response.

You can request any field that is available on the object. Speed up your API request response time by excluding unnecessary fields from your request, especially large fields like descriptions.

The following example shows product name and price included in a single request:

Example response: Product name and price
GET https://api.bigcommerce.com/stores/{{store_hash}}/v3/catalog/products?include_fields=name,price
{
"data": [
{
"id": 77,
"name": "Red printed scarf",
"price": 12
}
]
}

The availability of the include_fields and exclude_fields query parameters varies by endpoint. For up-to-date filter information, refer to the GET method documentation of each endpoint.

Pagination and limit

  • page is the number of pages that are returned by the API.
  • limit is the number of results per page that are returned.
  • page=2&limit=10 will return page 2 of the results with 10 items per page.
  • The maximum number of products returned is 250.

Media types

A media type is the format of the request or response body. BigCommerce APIs accept requests and send responses in JSON. Encode requests using the UTF-8 character set; other character sets can have unpredictable results.

Requests

For more information about required request headers, consult the API reference for the endpoint or graph you want to use.

Standard request headers

HeaderExpected value or typeDescriptionExample
AcceptMIME typesThe MIME type format that indicates which response type the request expects. For more information, see HTTP Docs: Accept Header (MDN).application/json
Content-TypeMIME typesThe MIME type of the request body. The API uses this value to validate and parse the request. For more information, see HTTP Docs: Content-Type Header (MDN).application/json
User-AgentStringWe ask that you specify a user agent to identify your integration or client.PostmanRuntime/7.32.3
AuthorizationStringRequests to the Process payments endpoint and the GraphQL Storefront API use the Authorization header to authenticate. For more information, see HTTP Docs: Authorization Header (MDN).Bearer {{STOREFRONT_TOKEN}} or PAT {{PAYMENT_ACCESS_TOKEN}}

BigCommerce-specific request headers

HeaderExpected value or typeDescription
X-Auth-TokenAPI account access tokenRequests to the REST Management, Catalog, GraphQL Admin, and GraphQL Account APIs use this header to authenticate. Some Payment endpoints also use this header.
X-Auth-ClientAPI account client IDNo longer required for any requests to BigCommerce.
X-Correlation-IdUUID in an 8-4-4-4-12 formatAn identifier unique to a set of related requests. For use on headless storefronts, excluding BigCommerce for WordPress. For more information, see Best Practices or the Headless Guide.

Request content type

When performing a request that contains a body, specify the type of content you are sending with the Content-Type header. This typically applies to PUT and POST requests.

Request structure

The body of a JSON request is an object containing a set of key-value pairs. A simple representation of a product object is:

Example request body: Product object
{
"id": 5,
"name": "iPod",
"description": "A portable MP3 music player."
}

Responses

Response headers

HTTP response header names are case-insensitive; see the HTTP specification on field names for more information. For example, your application may receive x-rate-limit-requests-left rather than X-Rate-Limit-Requests-Left, so plan your implementation accordingly. Most open source HTTP clients treat headers with the appropriate case insensitivity.

Standard response headers

HeaderPossible ValuesDescriptionExample
DateAn RFC 2822 date.The date the response was sent.Tue, 15 Nov 2011 12:45:26 GMT
last-modifiedAn RFC 2822 date.The date the resource was last modified. Please refer to the individual resource pages for support for this header.Tue, 15 Nov 2011 12:45:26 GMT
Content-Typeapplication/jsonThe MIME type of the response, dependent on the extension of the endpoint that was requested.application/json
Content-LocationA URISent if the request was redirected./api/v2/orders/5.json
LocationA URIThe URI of a newly created resource. Sent with a 201 Created response./api/v2/products/7
Content-EncodinggzipAllows API clients to request content to be compressed before being sent back in the response to an API request.gzip
Transfer-EncodingchunkedSpecifies the form of encoding used to transfer the resource.chunked

BigCommerce-specific response headers

HeaderPossible ValuesDescriptionExample
X-Rate-Limit-Time-Window-MsnumberShows the size of your current rate-limiting window, in milliseconds.30000
X-Rate-Limit-Time-Reset-MsnumberShows how many milliseconds are remaining in the window. In this case, 15000 milliseconds – so, 15000 milliseconds after this request, the API quota will be refreshed.15000
X-Rate-Limit-Requests-QuotanumberShows how many API requests are allowed in the current window for your client.150
X-Rate-Limit-Requests-LeftnumberDetails how many remaining requests your client can make in the current window before being rate-limited. In this case, you would expect to be able to make 35 more requests in the next 15000 milliseconds; on the 36th request within 15000 milliseconds, you would be rate-limited and receive an HTTP 429 response.35
X-Retry-AfterintegerRate limited response, indicating the number of seconds before the quota refreshes. See Rate Limits for more information.15
X-BC-ApiLimit-RemainingintegerThe number of API requests remaining for the current period (rolling one hour).987
X-BC-Store-VersionA version numberThe version of BigCommerce on which the store is running. This header is available on versions 7.3.6+. 7.3.6

Response content type

When requesting a resource that returns a body, specify the type of content you want to receive with the Accept header. Alternatively, you can supply an extension to the resource you’re requesting.

The priorities with which you can process these methods are:

  • Accept header high-priority types (e.g. Accept: application/json) extensions on the resource (e.g. customers.json).
  • Accept header low priority types (priorities less than 1, e.g. Accept: application/json;q=0.9)

Response structure

Responses are structured similarly to requests. If a request returns a single object, then the response will contain a single object containing the fields for that resource.

Example request: Get a category
GET https://api.bigcommerce.com/stores/{{store_hash}}/v3/catalog/categories/{{category_id}}
Example response: Get a category
{
"data": {
"id": 39,
"parent_id": 19,
"name": "Bath",
"description": "",
"views": 0,
"sort_order": 0,
"page_title": "",
"meta_keywords": [
""
],
"meta_description": "",
"layout_file": "category.html",
"image_url": "",
"is_visible": true,
"search_keywords": "",
"default_product_sort": "use_store_settings",
"custom_url": {
"url": "/garden/bath/",
"is_customized": false
}
},
"meta": {}
}