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

# Get account hierarchy ascendants

Get account hierarchy information including all parent/ancestor accounts.

This endpoint returns the account details along with an array of all parent accounts in the hierarchy, with each parent containing information about its level, centralizer status, and relationship to other accounts in the hierarchy.


# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Core platform - Accounts",
    "version": "1.0.0",
    "description": "API used to manage accounts domain",
    "contact": {
      "name": "API Support",
      "url": "https://developers.pismo.io/support/"
    },
    "license": {
      "name": "Copyright Pismo"
    }
  },
  "servers": [
    {
      "url": "https://sandbox.pismolabs.io",
      "description": "API server for testing."
    }
  ],
  "tags": [
    {
      "name": "Accounts",
      "description": "Endpoints to manage accounts"
    }
  ],
  "components": {
    "parameters": {
      "AccountIdPath": {
        "name": "accountId",
        "in": "path",
        "description": "Account ID",
        "required": true,
        "schema": {
          "type": "integer",
          "format": "int64",
          "minimum": 1,
          "example": 123
        }
      }
    },
    "schemas": {
      "AccountCreationDatetime": {
        "type": "string",
        "format": "date-time",
        "description": "Account creation date/time in UTC. Format = yyyy-mm-dd:hr:mm:ss.",
        "example": "2017-07-21T17:32:28Z"
      },
      "AccountExternalId": {
        "type": "string",
        "description": "\nClient-created ID from an external system or application. **REQUIRED** for `VIRTUAL` accounts.\n",
        "maxLength": 60,
        "example": "8c8a4dd7-e48f-4c15-85b7-9d12f401057f"
      },
      "AccountID": {
        "type": "integer",
        "format": "int64",
        "description": "Account ID",
        "example": 1001
      },
      "AccountName": {
        "type": "string",
        "description": "Custom account's name",
        "maxLength": 60,
        "example": "Account cash management"
      },
      "AccountStatus": {
        "type": "string",
        "description": "Account status. The pre-defined account statuses are `DEBIT_ONLY`, `NORMAL`, `BLOCKED`, and `CANCELLED`. You can create your own account statuses with the [Create status](https://developers.pismo.io/pismo-docs/reference/v4-post-account-status) endpoint. \n",
        "maxLength": 200,
        "example": "NORMAL"
      },
      "AccountType": {
        "type": "string",
        "description": "\nAccount type:\n\n- `PHYSICAL`&mdash;Default. A parent account is always physical. A child account can be physical or virtual. \n\n  A *physical* card is a plastic or metal embossed card. \"Physical\" here means an account that represents an actual client entity (person or company). A physical account supports full operations&mdash; transfers, payments, cards, interest, statements, and so on. \n\n- `VIRTUAL`&mdash;Always a child account. \n\n  `parent_account_id` and `external_id` are **REQUIRED** for virtual accounts. \n\n  Virtual accounts can have a many to one mapping to a physical account where the balance lives at the parent account. \n\nWhile a `document_number` is **REQUIRED** for a virtual account, it is ignored since it shares a parent account's entity and `document_number`.\n\n**Key difference summary**\n\n| Feature                        | Physical           | Virtual                    |\n| ------------------------------ | ------------------ | -------------------------- |\n| Fund ownership                 | Yes                | No (parent owns funds)     |\n| Independent balance            | Usually            | Typically parent balance   |\n| Persistent ID                  | One account        | Can be many to one parent  |\n| Regulatory/KYC link            | Direct             | Inherited/indirect         |\n| Primary use                    | Real account       | Segmentation & routing     | \n",
        "enum": [
          "PHYSICAL",
          "VIRTUAL"
        ],
        "example": "PHYSICAL"
      },
      "CurrencyNumericCode": {
        "type": "string",
        "description": "ISO 4217 code for account's currency. If not defined, the Pismo platform uses the program currency code. If not defined at the program level, the platform uses the currency code defined at the organization level.\n",
        "maxLength": 3,
        "example": "986"
      },
      "IsCentralizer": {
        "type": "boolean",
        "description": "Is this a centralizer account? A centralizer account, within the account hierarchy, is the account responsible for invoice billing. Defaults to `false`.",
        "example": false
      },
      "CustomerID": {
        "type": "integer",
        "format": "int64",
        "description": "Customer ID",
        "example": 100211299
      },
      "DivisionID": {
        "type": "integer",
        "format": "int64",
        "description": "Account's administrative division ID",
        "example": 2856813
      },
      "DocumentNumber": {
        "type": "string",
        "maxLength": 15,
        "description": "Document number, such as a government tax ID.",
        "example": "31457828046"
      },
      "EntityID": {
        "type": "integer",
        "format": "int64",
        "description": "Entity ID",
        "minimum": 1,
        "example": 1234567891
      },
      "ExternalServiceCode": {
        "type": "string",
        "description": "Code returned from the external service"
      },
      "IndividualsName": {
        "type": "string",
        "description": "Name",
        "example": "Hyman Roth"
      },
      "MessageDetailsResponse": {
        "type": "object",
        "description": "Object response for a user message",
        "properties": {
          "payload": {
            "type": "array",
            "description": "Details for the request payload errors",
            "items": {
              "$ref": "#/components/schemas/MessagePayloadResponse"
            }
          },
          "parameters": {
            "type": "array",
            "description": "Details for the query parameter errors",
            "items": {
              "$ref": "#/components/schemas/MessageParameterResponse"
            }
          },
          "external": {
            "type": "array",
            "description": "Details for the external service error",
            "items": {
              "$ref": "#/components/schemas/MessageExternalResponse"
            }
          }
        }
      },
      "MessageExternalResponse": {
        "type": "object",
        "description": "Object response for detailing external errors for a user message",
        "properties": {
          "code": {
            "$ref": "#/components/schemas/ExternalServiceCode"
          },
          "message": {
            "type": "string",
            "description": "Message description from the external service"
          }
        }
      },
      "MessageParameterResponse": {
        "type": "object",
        "description": "Object response for detailing query parameters errors for a user message",
        "properties": {
          "field": {
            "$ref": "#/components/schemas/ValidationErrorField"
          },
          "message": {
            "$ref": "#/components/schemas/ValidationErrorMessage"
          }
        }
      },
      "MessagePayloadResponse": {
        "type": "object",
        "description": "Object response for detailing request payload errors for a user message",
        "properties": {
          "field": {
            "$ref": "#/components/schemas/ValidationErrorField"
          },
          "message": {
            "$ref": "#/components/schemas/ValidationErrorMessage"
          }
        }
      },
      "UserMessageCode": {
        "type": "string",
        "description": "Code that identifies the user message",
        "example": "EACC0000"
      },
      "UserMessage": {
        "type": "string",
        "description": "User message",
        "example": "Timeout while executing the request"
      },
      "MessageResponse": {
        "type": "object",
        "description": "Object response for user message",
        "properties": {
          "code": {
            "$ref": "#/components/schemas/UserMessageCode"
          },
          "message": {
            "$ref": "#/components/schemas/UserMessage"
          },
          "details": {
            "$ref": "#/components/schemas/MessageDetailsResponse"
          }
        }
      },
      "PostalAddressID": {
        "type": "integer",
        "format": "int64",
        "description": "Postal address ID",
        "example": 456
      },
      "HierarchyParents": {
        "type": "array",
        "description": "Array of parent accounts in the hierarchy",
        "items": {
          "$ref": "#/components/schemas/HierarchyParent"
        }
      },
      "ProgramID": {
        "type": "integer",
        "format": "int64",
        "description": "Program ID",
        "example": 12345
      },
      "SocialName": {
        "type": "string",
        "description": "Social name.",
        "maxLength": 64,
        "example": "Jack"
      },
      "ValidationErrorField": {
        "type": "string",
        "description": "Non-valid field"
      },
      "ValidationErrorMessage": {
        "type": "string",
        "description": "Validation error description"
      },
      "AccountHierarchyResponse": {
        "type": "object",
        "description": "Account hierarchy information with parent accounts",
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountID"
          },
          "name": {
            "$ref": "#/components/schemas/IndividualsName"
          },
          "document_number": {
            "$ref": "#/components/schemas/DocumentNumber"
          },
          "customer_id": {
            "$ref": "#/components/schemas/CustomerID"
          },
          "social_name": {
            "$ref": "#/components/schemas/SocialName"
          },
          "entity_id": {
            "$ref": "#/components/schemas/EntityID"
          },
          "program_id": {
            "$ref": "#/components/schemas/ProgramID"
          },
          "status": {
            "$ref": "#/components/schemas/AccountStatus"
          },
          "postal_address_id": {
            "$ref": "#/components/schemas/PostalAddressID"
          },
          "creation_datetime": {
            "$ref": "#/components/schemas/AccountCreationDatetime"
          },
          "external_id": {
            "$ref": "#/components/schemas/AccountExternalId"
          },
          "account_type": {
            "$ref": "#/components/schemas/AccountType"
          },
          "account_name": {
            "$ref": "#/components/schemas/AccountName"
          },
          "division_id": {
            "$ref": "#/components/schemas/DivisionID"
          },
          "currency_numeric_code": {
            "$ref": "#/components/schemas/CurrencyNumericCode"
          },
          "parents": {
            "$ref": "#/components/schemas/HierarchyParents"
          }
        }
      },
      "HierarchyParent": {
        "type": "object",
        "description": "Parent account information in the hierarchy",
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountID"
          },
          "is_centralizer": {
            "$ref": "#/components/schemas/IsCentralizer"
          },
          "level": {
            "type": "integer",
            "format": "int32",
            "description": "Hierarchy level (`1` = direct parent, `2` = grandparent, and so on.)",
            "example": 1
          },
          "parent_account_id": {
            "$ref": "#/components/schemas/AccountID"
          },
          "currency_numeric_code": {
            "$ref": "#/components/schemas/CurrencyNumericCode"
          },
          "program_id": {
            "$ref": "#/components/schemas/ProgramID"
          },
          "division_id": {
            "$ref": "#/components/schemas/DivisionID"
          }
        }
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true,
    "samples-enabled": true
  },
  "paths": {
    "/accounts/v4/accounts/{accountId}/hierarchy/ascendants": {
      "get": {
        "operationId": "get-accounts-v4-accounts-accountId-hierarchy-ascendants",
        "summary": "Get account hierarchy ascendants",
        "description": "Get account hierarchy information including all parent/ancestor accounts.\n\nThis endpoint returns the account details along with an array of all parent accounts in the hierarchy, with each parent containing information about its level, centralizer status, and relationship to other accounts in the hierarchy.\n",
        "tags": [
          "Accounts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/AccountIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountHierarchyResponse"
                },
                "examples": {
                  "Account with hierarchy": {
                    "value": {
                      "account_id": 123,
                      "name": "John Doe",
                      "document_number": "31457828046",
                      "customer_id": 456,
                      "social_name": "Johnny",
                      "entity_id": 789,
                      "program_id": 100,
                      "status": "NORMAL",
                      "postal_address_id": 111,
                      "creation_datetime": "2021-07-21T17:32:28Z",
                      "external_id": "8c8a4dd7-e48f-4c15-85b7-9d12f401057f",
                      "account_type": "PHYSICAL",
                      "account_name": "Main Account",
                      "division_id": 222,
                      "currency_numeric_code": "986",
                      "parents": [
                        {
                          "account_id": 124,
                          "is_centralizer": false,
                          "level": 1,
                          "parent_account_id": 125,
                          "currency_numeric_code": "986",
                          "program_id": 100,
                          "division_id": 222
                        },
                        {
                          "account_id": 125,
                          "is_centralizer": true,
                          "level": 2,
                          "parent_account_id": 8675309,
                          "currency_numeric_code": "986",
                          "program_id": 100,
                          "division_id": 222
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageResponse"
                },
                "examples": {
                  "Invalid account ID": {
                    "value": {
                      "code": "EACC0005",
                      "message": "One or more parameters with invalid format",
                      "detail": {
                        "parameters": [
                          {
                            "field": "accountId",
                            "message": "Value must be a valid integer"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageResponse"
                },
                "examples": {
                  "Account not found": {
                    "value": {
                      "code": "WACC0017",
                      "message": "Account not found"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageResponse"
                },
                "examples": {
                  "Timeout execution": {
                    "value": {
                      "code": "EACC0000",
                      "message": "Timeout while executing the request"
                    }
                  },
                  "Generic message": {
                    "value": {
                      "code": "EACC9999",
                      "message": "Something went wrong, please try again later"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
```