---
title: "How to Get Category Information Using SOAP API in Magento 2"
url: "https://magecomp.com/blog/get-category-information-using-soap-api-magento-2/"
date: "2022-01-17T11:05:26+00:00"
modified: "2025-02-19T05:31:44+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 451
reading_time: "3 min read"
summary: "Hello Magento Friends,"
description: "Get all categories and specific category information with the help of SOAP API in Magento 2. Check out both the ways"
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to get Module Version Programmatically in Magento 2"
    url: "https://magecomp.com/blog/get-module-version-programmatically-magento-2/"
  - title: "Magento 2: How to Get Custom Column Value of Order using GraphQL"
    url: "https://magecomp.com/blog/magento-2-get-custom-column-value-of-order-using-graphql/"
  - title: "How to hide product page Add to Cart Button for Guest Users in Magento 2"
    url: "https://magecomp.com/blog/hide-product-page-add-cart-button-guest-users-magento-2/"
---

# How to Get Category Information Using SOAP API in Magento 2

_Published: January 17, 2022_  
_Author: Dhiren Vasoya_  

![How to Get Category Information Using SOAP API in Magento 2](https://magecomp.com/blog/wp-content/uploads/2022/01/How-to-Get-Category-Information-Using-SOAP-API-in-Magento-2-1024x512.webp)

**Hello Magento Friends,**

In our Magento 2 Tutorial series on SOAP API, today I am going to explain How to Get Category Information Using SOAP API in Magento 2.
[![hyva theme development](https://magecomp.com/blog/wp-content/uploads/2025/02/hyva-theme-development-CTA-1.webp)](https://magecomp.com/services/hyva-theme-development/)

SOAP API is the connection between the Magento 2 and external systems to transfer data smoothly. When you need the product, category, order, or any other information outside the Magento platform, you can use the SOAP API in Magento 2.
- [**How to Get Order Information Using SOAP API in Magento 2**](https://magecomp.com/blog/get-order-information-using-soap-application-program-interface-magento-2/)
- [**How to Get Customer Information Using SOAP API in Magento 2**](https://magecomp.com/blog/get-customer-information-using-soap-application-program-interface-magento-2/)

## Introduction:
Magento 2 stores hold various categories for the products. Categories help to organize products in a way that makes it easy for the customer and admin both to locate the product quickly.
This blog is used to get a category tree (category information) using SOAP API. There are two ways to get category information: First, is to get all the categories and the Second is to get specific categories using category ID.
Here I have explained both the methods to Get Category Information Using SOAP API in Magento 2.
## How to Get Category Information Using SOAP API in Magento 2:
### Method 1: Get All Category Information
**Step 1:** Create **getCatTreeSoap.php** file anywhere and add the following code
```
<?php

// changes your store url.
$request = new SoapClient("http://yourdomain/soap/?wsdl&services=integrationAdminTokenServiceV1", array("soap_version" => SOAP_1_2));

$token = $request->integrationAdminTokenServiceV1CreateAdminAccessToken(array("username"=>"youradminusername", "password"=>"youradminpassword"));

// changes your store url.
$request = new SoapClient(
    'http://yourdomain/soap/default?wsdl&services=catalogCategoryManagementV1',
    array(
        'soap_version' => SOAP_1_2,
        'stream_context' => stream_context_create(array(
            'http'=> array('header' => 'Authorization: Bearer '.$token->result)
        ))
    )
);

$response = $request->catalogCategoryManagementV1GetTree();

echo "";
print_r($response);
echo "";

?>
```

### [![Magento version upgrade](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Version-Upgrade-CTA-2.webp)](https://magecomp.com/services/magento-upgrade-services/)

### Method 2: Get Specific Category Information using Category ID
**Step 1:** Create **getCatTreeSoap.ph**p file anywhere and add the following code
```
<?php

// changes your store url.
$request = new SoapClient("http://yourdomain/soap/?wsdl&services=integrationAdminTokenServiceV1", array("soap_version" => SOAP_1_2));

$token = $request->integrationAdminTokenServiceV1CreateAdminAccessToken(array("username"=>"youradminusername", "password"=>"youradminpassword"));

// changes your store url.
$request = new SoapClient(
    'http://yourdomain/soap/default?wsdl&services=catalogCategoryRepositoryV1',
    array(
        'soap_version' => SOAP_1_2,
        'stream_context' => stream_context_create(array(
            'http'=> array('header' => 'Authorization: Bearer '.$token->result)
        ))
    )
);

$response = $request->catalogCategoryRepositoryV1Get(array("categoryId" => 13));

echo "";
print_r($response);
echo "";

?>
```

## Conclusion:
This way you can get all category and specific category information using SOAP API in Magento 2. In case of any errors, reach out to me in the comment section. Share the article with your friends and stay in touch with us for more tutorials on SOAP API in Magento 2.
[![Magento 2 Speed & Performance Optimization Services](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Speed-Performance-Optimization-Services-CTA-3.webp)](https://magecomp.com/magento-performance-optimization.html)

**Happy Coding!**


---

_View the original post at: [https://magecomp.com/blog/get-category-information-using-soap-api-magento-2/](https://magecomp.com/blog/get-category-information-using-soap-api-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-10-08 06:39:16 UTC_  
