Redirects

Manage 301 redirects for one or more storefronts powered by a single BigCommerce backend. For a list of redirects that are not allowed, see the 301 Redirects FAQ (opens in a new tab) in our Help Center.

Get Redirects

GET /storefront/redirects

Request

Returns a collection of the store's 301 redirects across all sites.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Accept in header with default of application/json - string
    required
    The MIME type of the response body.
  • site_id in query - integer
    Filters items by site ID.
  • id:in in query - array
    Filters items by redirect ID. Also accepts comma-separated values to filter for multiple redirects.
    Type: array[integer]
  • id:min in query - integer
    Filters items by minimum redirect ID.
  • id:max in query - integer
    Filters items by maximum redirect ID.
  • limit in query - integer
    Controls the number of items to return per page.
  • page in query - integer
    Specifies the page number in a limited (paginated) list of items. Used to paginate large collections.
  • sort in query - string

    Field name to sort by. Since redirect IDs increment when new redirects are added, you can sort by ID to return results in redirect create date order.

    Allowed: from_path | type | site_id | id

  • direction in query - string
    Sort direction. Acceptable values are asc, desc.

    Allowed: asc | desc

  • include in query - array
    Indicates whether to include redirect sub-resources. Only to_url is supported.
    Type: array[string]

    Allowed: to_url

  • keyword in query - string
    Filters redirects by the specified keyword. Will only search from the beginning of a URL path. For example, blue will match /blue and /blue-shirt , not /royal-blue-shirt.

example

curl --request GET \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/storefront/redirects' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: {{token}}'

Response

Body

object | application/json
  • data
    array[object]

  • meta
    object

example

{
"data": [
{
"id": 0,
"site_id": 0,
"from_path": "/old-url",
"to": {
"type": "product",
"entity_id": 0,
"url": "/new-url/"
},
"to_url": "https://store-domain.com/new-url"
}
],
"meta": {
"pagination": {
"total": 246,
"count": 5,
"per_page": 5,
"current_page": 1,
"total_pages": 50,
"links": {
"next": "?limit=5&page=2",
"current": "?limit=5&page=1"
}
}
}
}

Upsert Redirects

PUT /storefront/redirects

Request

Upserts new redirect data across all storefronts.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Accept in header with default of application/json - string
    required
    The MIME type of the response body.
  • Content-Type in header with default of application/json - string
    required
    The MIME type of the request body.

Body

array | application/json
  • from_path
    string
    required

    Example: /old-url/
  • site_id
    integer
    required

  • to
    object

example

[
{
"from_path": "/old-url/",
"site_id": 0,
"to": {
"type": "product",
"entity_id": 0,
"url": "/new-url/"
}
}
]

Response

Created

Body

object | application/json
  • data
    array[object]

  • meta
    object

example

{
"data": [
{
"id": 0,
"site_id": 0,
"from_path": "/old-url",
"to": {
"type": "product",
"entity_id": 0,
"url": "/new-url/"
},
"to_url": "https://store-domain.com/new-url"
}
],
"meta": {
"pagination": {
"total": 246,
"count": 5,
"per_page": 5,
"current_page": 1,
"total_pages": 50,
"links": {
"next": "?limit=5&page=2",
"current": "?limit=5&page=1"
}
}
}
}

Delete Redirects

DELETE /storefront/redirects

Request

Deletes redirects.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • Accept in header with default of application/json - string
    required
    The MIME type of the response body.
  • id:in in query - array
    required
    A comma-separated list of redirect IDs to delete explicitly.
    Type: array[integer]
  • site_id in query - integer
    To delete all redirects for a given site, provide the site ID.

example

curl --request DELETE \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/storefront/redirects' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: {{token}}'

Response

No Content

See something you can improve? Edit this file on GitHub

Did you find what you were looking for?