Magento : Custom attributes added in the api2.xml (custom module) are not visible in admin

Magento : Custom attributes added in the api2.xml (custom module) are not visible in admin

September 29, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento : Custom attributes added in the api2.xml (custom module) are not visible in admin

Solving the Magento REST API Extension Issue

Hello developers! Today we’re going to tackle a common challenge when extending the Magento Rest API: making new attributes added via a custom module visible in the admin interface.

The Problem: Missing Attributes in Admin

When you create a new module and add custom attributes, they don’t automatically appear in the “Rest - Attributes” section of your Magento admin panel. This makes it impossible to allow these new attributes for your Rest Role. Sending requests with these new attributes results in a 403 Forbidden error, as the system denies access.

What’s Happening Under the Hood

The issue lies in how Magento handles attribute inheritance and visibility in its API configuration files like api2.xml. When you define resources for your custom module, the system doesn’t automatically include your new attributes unless you specify them explicitly. This is why they aren’t visible in the admin interface.

Solving the Issue: Explicit Attribute Declaration

To make your new attributes available, you need to declare them explicitly within the <attributes> section of your api2.xml file. Let’s modify the provided example:

<config>
    <api2>
        <!-- ... existing resource_groups and resources ... -->
        <resources>
            <categoriesmanagement translate="title" module="api2">
                <!-- ... existing privileges, routes, and versions ... -->
                <attributes>
                    <!-- Your new attributes go here -->
                    <new_attribute_1>New Attribute 1</new_attribute_1>
                    <new_attribute_2>New Attribute 2</new_attribute_2>
                    <!-- Add all your custom attribute names here -->

                    <!-- Existing attributes are still required -->
                    <entity_id>Category ID</entity_id>
                    <name>Name</name>
                    <!-- ... existing attributes ... -->
                </attributes>
            </categoriesmanagement>
        </resources>
    </api2>
</config>

In the updated code, I’ve added two new attributes: new_attribute_1 and new_attribute_2. You should replace these with your actual custom attribute names.

Clearing Cache for Changes to Take Effect

After updating your api2.xml file, remember to clear Magento’s cache. This ensures that the system re-reads the configuration changes:

  1. Log in to your admin panel.
  2. Navigate to “System” > “Cache Management”.
  3. Select all cache types and click the “Flush Cache Magically” button.

Conclusion: Making Your Attributes Visible

Making new attributes visible for Magento’s Rest API involves a simple yet crucial step: declaring them explicitly in your api2.xml file within the <attributes> section of your custom resource.

Remember, always ensure that you’ve cleared your cache after making changes to configuration files. This is a best practice in Magento development and helps avoid unexpected behavior due to cached data.

If you need more detailed guidance on extending Magento’s Rest API or have questions about Magento 2 development, feel free to browse our extensive resources at Laravel Company. We’re always here to help you build powerful e-commerce solutions!

Catalog API Extensions Themes

Our network