Get all options for configurable product Magento 2.0 REST Api

Get all options for configurable product Magento 2.0 REST Api

September 27, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Get all options for configurable product Magento 2.0 REST Api

Retrieving Configurable Product Options and Values via Magento 2 REST API

In Magento 2, configurable products allow you to manage multiple product variations efficiently. The REST API provides a way to interact with these product options programmatically.

Understanding the Current API Response Structure

The provided API endpoint {{base_url}}index.php/rest/V1/configurable-products/:sku/options/all returns an array of option objects for a specific configurable product identified by its SKU:

[
  {
    "id": 9,
    "attribute_id": "93",
    "label": "Color",
    "position": 0,
    "values": [
      {
        "value_index": 15
      },
      {
        "value_index": 16
      },
      {
        "value_index": 17
      }
    ],
    "product_id": 19
  },
  // More options...
]

Each option object contains relevant metadata such as the ID, attribute ID, label, position, and an array of values. The values are represented by their internal value_index.

However, you’ve correctly observed that these value_index do not include the actual value labels.

Retrieving Option Value Labels

The current API response does not directly provide option value labels. To obtain these labels, you would typically need to make additional requests to fetch each attribute’s options separately using the /V1/attributes/:attribute_id/swatches endpoint or similar.

However, this approach requires multiple separate requests, which can be inefficient if you have a large number of attributes and options.

An Alternative Approach: Using the Configurable Product API

An optimized way to retrieve both option metadata and their corresponding value labels in a single request is by utilizing the /V1/configurable-products/:sku endpoint directly. This endpoint returns a comprehensive product object that includes all configurable options with their respective values:

curl -X GET "http://magento2 instance/index.php/rest/V1/configurable-products/your_sku"

The response will include an options array within the product object, which contains option and value labels:

"options": [
  {
    "id": 9,
    "attribute_id": 93,
    "label": "Color",
    "position": 0,
    "values": [
      {
        "value_index": 15,
        "label": "Red"
      },
      // More values...
    ]
  }
]

This approach allows you to fetch all the required information in a single API call, making it more efficient for your use case.

Conclusion

In Magento 2 REST API, retrieving configurable product options and their respective value labels requires careful consideration of available endpoints. While the /V1/configurable-products/:sku/options/all endpoint provides option metadata, it does not include value labels directly.

However, by utilizing an alternative approach—the /V1/configurable-products/:sku endpoint—you can efficiently retrieve both option metadata and their corresponding value labels in a single API request.

Remember to integrate proper error handling and authentication mechanisms for your API calls. For more information on Magento 2 development best practices, visit Laravel Company.

Magento 2 Catalog API Configuration

Our network