---
title: "API: getCustomFieldHierarchy"
slug: "api-getcustomfieldhierarchy"
updated: 2022-08-23T16:36:13Z
published: 2022-08-23T16:36:13Z
canonical: "support.smarteru.com/api-getcustomfieldhierarchy"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.smarteru.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API: getCustomFieldHierarchy

- Starting June 1, 2022, SmarterU will require all API calls to POST to HTTPS. Any POST to HTTP will result in the SU:01 error (i.e., No POST data detected.).
- If you are viewing the help in a language other than English, please change your language to English before copying and pasting any code. All API attributes and functions are in English.
- Tags are required unless specified.

## **Des****cription**

The getCustomFieldHierarchy method retrieves details about the levels and values for a [custom user field's hierarchy](/v1/docs/account-custom-user-fields#adding-levels-and-values-to-a-hierarchical-custom-user-fields).

## **Who** **Has Access**

[Administrators and owners](/v1/docs/user-profile-information#access-level) have access to the getCustomFieldHierarchy method.

## **AP****I Call XML Package**

```markup
<SmarterU>
   <AccountAPI><![CDATA[]]></AccountAPI>
   <UserAPI><![CDATA[]]></UserAPI>
   <Method>getCustomFieldHierarchy</Method>
   <Parameters>
      <CustomField>
         <ID><![CDATA[]]></ID>
            - OR -
         <Name><![CDATA[]]></Name>
      </CustomField>
   </Parameters>
</SmarterU>
```

## **Cu****stomField Tag Group**

The CustomField tag group is a container for the custom user field filters.

```markup
<CustomField>
   <ID><![CDATA[]]></ID>
      - OR -
   <Name><![CDATA[]]></Name>
</CustomField>
```

The CustomField tag contains one of the following.

### **ID**

The custom user field's system-generated identifier. This is the ID returned by the [listCustomFields](/v1/docs/api-listcustomfields) method. This is mutually exclusive with the Name tag.

### **Na****me**

The [custom user field's name](/v1/docs/account-custom-user-fields#name). This is mutually exclusive with the ID tag.

## **API Respo****nse XML Package**

The API response XML package will always include a Result, Info, and [Errors](/v1/docs/api-getcustomfieldhierarchy#error-codes) tag.

```markup
<SmarterU>
   <Result></Result>
   <Info>
      <CustomField>
         <ID>![CDATA[]]</ID>
         <Name><![CDATA[]]></Name>
         <Levels>
            <Level>
               <LevelID>![CDATA]]</LevelID>
               <Name><![CDATA[]]></Name>
               <Values>
                  <Value>
                     <ValueID>![CDATA[]]</ValueID>
                     <ParentValueID>![CDATA[]]<ParentValueID/>
                     <Value><![CDATA[]]></Value>
                  </Value>
                </Values>
             </Level>
         </Levels>
      </CustomField>
   </Info>
   <Errors>
      <Error>
         <ErrorID></ErrorID>
         <ErrorMessage></ErrorMessage>
      </Error>
   </Errors>
</SmarterU>
```

The custom user field is contained in a CustomField tag and may contain the following.

### ID

The custom user field's system-generated identifier.

### Name

The custom user field's name.

### Levels

The Levels tag is a container for the [hierarchical custom user field's](/v1/docs/account-custom-user-fields#data-type) levels. Each level is contained in a Level tag and may contain the following.

| Tag | Description |
| --- | --- |
| **LevelID** | The custom user field level's system-generated identifier. |
| **Name** | The custom user field level's name. |
| **Values** | The Values tag is a container for the values assigned to the level. Each value is contained in a Value tag and contains the following: - ValueID - The value's system-generated identifier. - ParentValueID - The system-generated identifier for the value's parent. This tag will be blank if the value does not have a parent (i.e., it's the top value). - Value - The value's name. |

### Example API Response XML Package

```markup
<SmarterU>
   <Result>Success</Result>
   <Info>
      <CustomField>
         <ID>1824</ID>
         <Name><![CDATA[Location]]></Name>
         <Levels>
            <Level>
               <LevelID>1825</LevelID>
               <Name><![CDATA[Country]]></Name>
               <Values>
                  <Value>
                     <ValueID>17</ValueID>
                     <ParentValueID/>
                     <Value><![CDATA[United States]]></Value>
                  </Value>
                  <Value>
                     <ValueID>4162</ValueID>
                     <ParentValueID/>
                     <Value><![CDATA[Canada]]></Value>
                  </Value>
               </Values>
            </Level>

            <Level>
               <LevelID>1827</LevelID>
               <Name><![CDATA[Region]]></Name>
               <Values>
                  <Value>
                     <ValueID>19</ValueID>
                     <ParentValueID>17</ParentValueID>
                     <Value><![CDATA[California]]></Value>
                  </Value>
                  <Value>
                     <ValueID>4163</ValueID>
                     <ParentValueID>4162</ParentValueID>
                     <Value><![CDATA[Manitoba]]></Value>
                  </Value>
                  <Value>
                     <ValueID>4164</ValueID>
                     <ParentValueID>4162</ParentValueID>
                     <Value><![CDATA[Ontario]]></Value>
                  </Value>
               </Values>
            </Level>
      </CustomField>
   </Info>

   <Errors>
   </Errors>

</SmarterU>
```

## **Error Codes**

| Error Code | Message |
| --- | --- |
| GCFH:01 | The ID provided is not valid. |
| GCFH:02 | The name provided is not valid. |
| GCFH:03 | The required permissions are not met to call the getCustomFieldHierarchy method. |
| GCFH:04 | The custom hierarchy field requested does not exist. |

## Related

- [Account: Custom User Fields](/account-custom-user-fields.md)
- [API: listCustomFields](/api-listcustomfields.md)
