> ## 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.

# View a UBO Declaration

<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>

### Path parameters

<ParamField path="UboDeclarationId" type="string" required>
  The unique identifier of the UBO Declaration.
</ParamField>

### Responses

<AccordionGroup>
  <Accordion title="200" 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="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 = '198557165';
      $uboDeclarationId = '198692872';

      $response = $api->UboDeclarations->Get($userId, $uboDeclarationId);

      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',
  }

  let myUboDeclaration = {
    Id: '180932134',
  }

  const getUboDeclaration = async (userId, uboDeclarationId) => {
    return await mangopay.UboDeclarations.get(userId, uboDeclarationId)
      .then((response) => {
        console.info(response)
        return response
      })
      .catch((err) => {
        console.log(err)
        return false
      })
  }

  getUboDeclaration(myUser.Id, myUboDeclaration.Id)  
  ```

  ```ruby Ruby   theme={null}
  require 'mangopay'

  MangoPay.configure do |client|
      client.preproduction = true
      client.client_id = 'your-client-id'
      client.client_apiKey = 'your-api-key'
      client.log_file = File.join(Dir.pwd, 'mangopay.log')
  end

  def viewUboDeclaration(legalUserId, uboDeclarationId)
      begin
          response = MangoPay::UboDeclaration.fetch(legalUserId, uboDeclarationId)
          puts response
          return response
      rescue MangoPay::ResponseError => error
          puts "Failed to update UBO: #{error.message}"
          puts "Error details: #{error.details}"
          return false
      end
  end

  myLegalUser = {
      Id: '194338122'
  }

  myUboDeclaration = {
      Id: '194511216'
  }

  viewUboDeclaration(myLegalUser[:Id], myUboDeclaration[:Id])  
  ```

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

  import java.lang.reflect.Field;

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

          UboDeclaration uboDeclaration = mangopay.getUboDeclarationApi().get("ubo_m_01HRYRKZN51BFXDWD6CCE22PHN");
          System.out.println(String.format("id: %s", uboDeclaration.getId()));
          printObjectFields(uboDeclaration);
      }

      private static void printObjectFields(Object obj) {
          Class<?> objClass = obj.getClass();
          Field[] fields = objClass.getDeclaredFields();
          for (Field field : fields) {
              field.setAccessible(true);
              try {
                  Object value = field.get(obj);
                  System.out.println(field.getName() + ": " + value);
              } catch (IllegalAccessException e) {
                  e.printStackTrace();
              }
          }
      }
  }  
  ```

  ```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

  ubo_declaration = UboDeclaration( 
    id = '210896999' 
  )

  legal_user = LegalUser(
      id = '210602889'  
  )

  try:
      view_ubo_declaration = UboDeclaration.get(reference = ubo_declaration.id, user_id = legal_user.id)
      pprint(vars(view_ubo_declaration))
  except UboDeclaration.DoesNotExist:
      print('The UBO declaration {} does not exist for User n.{}'.format(ubo_declaration, legal_user.id))  
  ```

  ```csharp .NET  theme={null}
  using MangoPay.SDK;
  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 uboDeclarationId = "ubo_m_01J2V64AD2C8G7PYACCP16ZS74";

          var viewUboDeclaration = await api.UboDeclarations.GetUboDeclarationByIdAsync(uboDeclarationId);

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