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

# List UBO Declarations for a User

<Warning>
  **Caution – Legacy endpoints being superseded by the hosted KYC/KYB solution**

  Mangopay's [hosted KYC/KYB solution](/guides/users/verification/hosted) is becoming mandatory for all platforms, and allows Legal Users to declare and verify all beneficial owners in the same [IDV Session](/api-reference/idv-sessions/idv-session-object) object.

  The [criteria defining beneficial owners](/guides/glossary#beneficial-owner-ubo) remain the same.
</Warning>

### Query parameters

<ParamField query="page" type="integer">
  Start value: `1`

  **Default value:** `1`

  Indicates the index of the page for the pagination.
</ParamField>

<ParamField query="per_page" type="integer">
  Min. value: `1`; max. value: `100`

  **Default value:** `10`

  Indicates the number of items returned for each page of the pagination.
</ParamField>

<ParamField query="Sort" type="string">
  **Possible values:** `CreationDate:ASC`, `CreationDate:DESC`

  **Default value:** `CreationDate:ASC`

  Indicates the direction in which to sort the list.
</ParamField>

### Path parameters

<ParamField path="UserId" type="string" required>
  The unique identifier of the user.
</ParamField>

### Responses

<AccordionGroup>
  <Accordion title="200">
    <ResponseField name="Id" type="string">
      Max length: 128 characters (see [data formats](/api-reference/overview/data-formats) for details)

      The unique identifier of the object.
    </ResponseField>

    <ResponseField name="UserId" type="string">
      The unique identifier of the user.
    </ResponseField>

    <ResponseField name="CreationDate" type="Unix timestamp">
      The date and time at which the object was created.
    </ResponseField>

    <ResponseField name="ProcessedDate" type="Unix timestamp">
      The date and time at which the UBO Declaration was processed by Mangopay’s team.
    </ResponseField>

    <ResponseField name="Status" type="string">
      **Returned values:** `CREATED`, `VALIDATION_ASKED`, `INCOMPLETE`, `VALIDATED`, `REFUSED`

      The status of the declaration:

      * `CREATED` – The UBO Declaration is created, but not submitted yet.
      * `VALIDATION_ASKED` – The UBO Declaration is submitted for validation.
      * `INCOMPLETE` – The UBO Declaration is deemed incomplete by Mangopay teams.
      * `VALIDATED` – The UBO Declaration is validated by Mangopay’s team.
      * `REFUSED` – The UBO Declaration is rejected by Mangopay’s team. You can learn more about the reasons for refusal in the `Reason` and  `Message` fields.
    </ResponseField>

    <ResponseField name="Reason" type="string">
      The reason for which the UBO Declaration was `REFUSED` or considered as `INCOMPLETE`.
    </ResponseField>

    <ResponseField name="Message" type="string">
      Additional information about why the UBO Declaration was refused or marked as incomplete, provided by Mangopay’s team.
    </ResponseField>

    <ResponseField name="Ubos" type="array">
      The list of UBOs attached to the UBO Declaration.

      <Expandable title="properties" defaultOpen>
        <ResponseField name="Object (UBO)" type="object">
          The UBO object created by the platform.

          <Expandable title="properties" defaultOpen>
            <ResponseField name="Id" type="string">
              Max length: 128 characters (see [data formats](/api-reference/overview/data-formats) for details)

              The unique identifier of the object.
            </ResponseField>

            <ResponseField name="CreationDate" type="Unix timestamp">
              The date and time at which the object was created.
            </ResponseField>

            <ResponseField name="LastName" type="string">
              Max. length: 100 characters

              The last name of the beneficial owner.
            </ResponseField>

            <ResponseField name="Nationality" type="string">
              The nationality of the beneficial owner.
            </ResponseField>

            <ResponseField name="Address" type="object">
              The postal address of the beneficial owner.

              <Expandable title="properties">
                <ResponseField name="AddressLine1" type="string">
                  Max. length: 255 characters

                  The first line of the address.
                </ResponseField>

                <ResponseField name="AddressLine2" type="string">
                  Max. length: 255 characters

                  The second line of the address.
                </ResponseField>

                <ResponseField name="City" type="string">
                  Max. length: 255 characters

                  The city of the address.
                </ResponseField>

                <ResponseField name="Region" type="string">
                  Max. length: 255 characters

                  The region of the address. This field is optional except if the `Country` is US, CA, or MX.
                </ResponseField>

                <ResponseField name="PostalCode" type="string">
                  Max. length: 255 characters

                  The postal code of the address. The postal code can contain the following characters: alphanumeric, dashes, and spaces.
                </ResponseField>

                <ResponseField name="Country" type="string">
                  Format: Two-letter country code ([ISO 3166-1 alpha-2 format](/api-reference/overview/data-formats))

                  The country of the address.
                </ResponseField>
              </Expandable>
            </ResponseField>

            <ResponseField name="Birthplace" type="object">
              Information about the beneficial owner's place of birth.

              <Expandable title="properties">
                <ResponseField name="City" type="string">
                  The city in which the beneficial owner was born.
                </ResponseField>

                <ResponseField name="Country" type="string">
                  Format: Two-letter country code ([ISO 3166-1 alpha-2 format](/api-reference/overview/data-formats))

                  The country in which the beneficial owner was born.
                </ResponseField>
              </Expandable>
            </ResponseField>

            <ResponseField name="IsActive" type="boolean">
              Whether or not the UBO is considered in the declaration. To disregard a UBO, this parameter must be set to `false`. This action is irreversible.
            </ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Accordion>
</AccordionGroup>

<ResponseExample>
  ```json 200   theme={null}
  [
      {
          "Id": "158947737",
          "UserId": "158947634",
          "CreationDate": 1672153298,
          "ProcessedDate": null,
          "Status": "CREATED",
          "Reason": null,
          "Message": null,
          "Ubos": [
              {
                  "Id": "158947898",
                  "CreationDate": 1672153693,
                  "LastName": "Wiza",
                  "FirstName": "Jess",
                  "Birthday": 652117514,
                  "Nationality": "FR",
                  "Address": {
                      "AddressLine1": "669 Ratke Forge",
                      "AddressLine2": "Schamberger Walk",
                      "City": "Paris",
                      "Region": "Île-de-France",
                      "PostalCode": "75001",
                      "Country": "FR"
                  },
                  "Birthplace": {
                      "City": "Paris",
                      "Country": "FR"
                  },
                  "IsActive": true
              }
          ]
      }
  ]  
  ```
</ResponseExample>

<RequestExample>
  ```php PHP theme={null}
  <?php 

  require_once 'vendor/autoload.php';

  use MangoPay\MangoPayApi;
  use MangoPay\Libraries\ResponseException as MGPResponseException;
  use MangoPay\Libraries\Exception as MGPException;

  $api = new MangoPayApi();

  $api->Config->ClientId = 'your-client-id';
  $api->Config->ClientPassword = 'your-api-key';
  $api->Config->TemporaryFolder = 'tmp/';

  try {
      $userId = '170853400';

      $response = $api->UboDeclarations->GetAll($userId);

      print_r($response);
  } catch(MGPResponseException $e) {
      print_r($e);
  } catch(MGPException $e) {
      print_r($e);
  }  
  ```

  ```javascript NodeJS   theme={null}
  const mangopayInstance = require('mangopay4-nodejs-sdk')
  const mangopay = new mangopayInstance({
    clientId: 'your-client-id',
    clientApiKey: 'your-api-key',
  })

  let myUser = {
    Id: '170853400',
  }

  const listUboDeclarations = async (userId) => {
    return await mangopay.UboDeclarations.getAll(userId)
      .then((response) => {
        console.info(response)
        return response
      })
      .catch((err) => {
        console.log(err)
        return false
      })
  }

  listUboDeclarations(myUser.Id)  
  ```

  ```java Java   theme={null}
  import com.mangopay.MangoPayApi;
  import com.mangopay.entities.UboDeclaration;
  import com.mangopay.core.Pagination;

  import java.lang.reflect.Field;
  import java.util.List;

  public class ListUserUboDeclarations {
      public static void main(String[] args) throws Exception {
          MangoPayApi mangopay = new MangoPayApi();
          mangopay.getConfig().setClientId("your-client-id");
          mangopay.getConfig().setClientPassword("your-api-key");
          
          String userId = "user_m_01HRS7PQEGE4YGCM1AZK1ENTGE";

          Pagination pagination = new Pagination(1, 100);

          List<UboDeclaration> uboDeclaractions = mangopay.getUboDeclarationApi().getAll(userId, pagination, null);

          var i = 1;
          for (UboDeclaration uboDeclaraction : uboDeclaractions) {
              Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
              String prettyJson = prettyPrint.toJson(uboDeclaraction);

              System.out.println(prettyJson);
          }
      }
  }  
  ```

  ```python Python   theme={null}
  from pprint import pprint
  import mangopay

  mangopay.client_id='your-client-id'
  mangopay.apikey='your-api-key'

  from mangopay.api import APIRequest
  handler = APIRequest(sandbox=True)

  from mangopay.resources import UboDeclaration, LegalUser

  legal_user = LegalUser(
      id = '210760575'  
  )

  ubo_declarations = UboDeclaration.all(user_id = legal_user.id)

  for ubo_declaration in ubo_declarations:
      pprint(vars(ubo_declaration))  
  ```

  ```csharp .NET  theme={null}
  using MangoPay.SDK;
  using MangoPay.SDK.Entities;
  using Newtonsoft.Json;

  class Program
  {
      static async Task Main(string[] args)
      {
          MangoPayApi api = new MangoPayApi();

          api.Config.ClientId = "your-client-id";
          api.Config.ClientPassword = "your-api-key";

          var userId = "user_m_01J2V0P9B1WCX46GEBDWCTXNQ0";

          var userUboDeclarations = await api.UboDeclarations.GetUboDeclarationByUserIdAsync(userId, new Pagination(1, 100));

          string prettyPrint = JsonConvert.SerializeObject(userUboDeclarations, Formatting.Indented);
          Console.WriteLine(prettyPrint);
      }
  }
  ```
</RequestExample>
