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

# Update a UBO

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

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

### Body parameters

<ParamField body="LastName" type="string">
  Max. length: 100 characters

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

<ParamField body="FirstName" type="string">
  Max. length: 100 characters

  The first name of the beneficial owner.
</ParamField>

<ParamField body="Birthday" type="Unix timestamp">
  The date of birth of the beneficial owner.

  **Note:** This is a Unix timestamp in UTC. Ensure you convert your timezone to UTC to avoid midnight being interpreted as the day before.
</ParamField>

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

  The nationality of the beneficial owner.
</ParamField>

<ParamField body="Address" type="object">
  The postal address of the beneficial owner.

  <Expandable title="properties">
    <ParamField body="AddressLine1" type="string" required>
      Max. length: 255 characters

      The first line of the address.
    </ParamField>

    <ParamField body="AddressLine2" type="string">
      Max. length: 255 characters

      The second line of the address.
    </ParamField>

    <ParamField body="City" type="string" required>
      Max. length: 255 characters

      The city of the address.
    </ParamField>

    <ParamField body="Region" type="string">
      Max. length: 255 characters

      Required if `Country` is US, CA, or MX.

      The region of the address.
    </ParamField>

    <ParamField body="PostalCode" type="string" required>
      Max. length: 255 characters

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

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

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

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

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

    <ParamField body="Country" type="string" required>
      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.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="IsActive" type="boolean">
  Whether or not the UBO is considered in the declaration. To disregard a UBO, set this parameter to `false`. This action is irreversible.
</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="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="FirstName" type="string">
      Max. length: 100 characters

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

    <ResponseField name="Birthday" type="Unix timestamp">
      The date of birth of the beneficial owner.

      **Note:** This is a Unix timestamp in UTC. Ensure you convert your timezone to UTC to avoid midnight being interpreted as the day before.
    </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>
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="400 - Deactivated UBO can't be reactivated or modified">
    ```json theme={null}
    {
        "Message": "You can not update an UBO that is inactive",
        "Type": "invalid_action",
        "Id": "583a9b71-c820-46ea-805d-f6152746bcc6#1736503621",
        "Date": 1736503622,
        "errors": null
    }
    ```
  </Accordion>
</AccordionGroup>

<ResponseExample>
  ```json 200   theme={null}
  {
      "Id": "ubo_m_01JH7TS5ZHW3R501ACJEKD5G39",
      "CreationDate": 1736503498,
      "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>
  ```json REST   theme={null}
  {
      "FirstName": "AcceptUBO",
      "LastName": "Effertz",
      "Birthday": 652117514,
      "Nationality": "FR",
      "Address": {
          "AddressLine1": "804 Hane Mountains",
          "AddressLine2": "Adriel Overpass",
          "City": "Paris",
          "Region": "Île-de-France",
          "PostalCode": "75001",
          "Country": "FR"
      },
      "Birthplace": {
          "City": "Paris",
          "Country": "FR"
      }
  }  
  ```

  ```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 = '199385330';
      $uboDeclarationId = '199461371';
      $uboId = '199461374';

      $ubo = $api->UboDeclarations->GetUbo($userId, $uboDeclarationId, $uboId);

      $address = new \MangoPay\Address();
      $address->AddressLine1 = 'Address line 1';
      $address->AddressLine2 = 'Address line 2';
      $address->City = 'Paris';
      $address->Country = 'FR';
      $address->PostalCode = '75000';
      $address->Region = 'Region';

      $ubo->Address = $address;
      $ubo->FirstName = 'Alex';
      $ubo->LastName = 'Smith';
      $ubo->Nationality = 'FR';
      $ubo->Birthday = mktime(0, 0, 0, 12, 21, 1975); 

      $Birthplace = new \MangoPay\Birthplace();
      $Birthplace->City = 'Paris';
      $Birthplace->Country = 'FR';

      $ubo->Birthplace = $Birthplace;


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

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

  let myUboDeclaration = {
    Id: '192604617',
  }

  let myUbo = {
    Id: '192607656',
    FirstName: 'Alexis',
    LastName: 'Smith',
    Address: {
      AddressLine1: '669 Ratke Forge',
      AddressLine2: 'Schamberger Walk',
      City: 'Paris',
      Region: 'Île-de-France',
      PostalCode: '75001',
      Country: 'FR',
    },
    Nationality: 'FR',
    Birthday: 652117514,
    Birthplace: {
      City: 'Paris',
      Country: 'FR',
    },
  }

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

  updateUbo(myUser.Id, myUboDeclaration.Id, myUbo)  
  ```

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

  myLegalUser = {
      Id: '194338122'
  }

  myUboDeclaration = {
      Id: '194511216'
  }

  myUbo = {
      Id: '194511740',
      FirstName: 'Alexa',
      LastName: 'Smith',
      Address: {
              AddressLine1: '669 Ratke Forge',
              AddressLine2: 'Schamberger Walk',
              City: 'Paris',
              Region: 'Île-de-France',
              PostalCode: '75001',
              Country: 'FR'
          },
      Nationality: 'FR',
      Birthday: 652117514,
      Birthplace: {
          City: 'Paris',
          Country: 'FR'
      }
  }

  updateUbo(myLegalUser[:Id], myUboDeclaration[:Id], myUbo[:Id], myUbo)  
  ```

  ```java Java   theme={null}
  import com.google.gson.Gson;
  import com.google.gson.GsonBuilder;
  import com.mangopay.MangoPayApi;
  import com.mangopay.core.enumerations.CountryIso;
  import com.mangopay.entities.Birthplace;
  import com.mangopay.entities.Ubo;

  public class UpdateUbo {
       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";
          String uboDeclarationId = "ubo_m_01HRYRKZN51BFXDWD6CCE22PHN";
          String uboId = "ubo_m_01HRYTZJS07SP4GAMKYMB9YPCG";

          Ubo ubo = mangopay.getUboDeclarationApi().getUbo(userId, uboDeclarationId, uboId);
          
          Birthplace birthplace = new Birthplace();

          birthplace.setCity("Lyon");
          birthplace.setCountry(CountryIso.FR);

          ubo.setBirthplace(birthplace);

          Ubo updateUbo = mangopay.getUboDeclarationApi().updateUbo(userId, uboDeclarationId, ubo);

          Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
          String prettyJson = prettyPrint.toJson(updateUbo);

          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 Ubo, UboDeclaration, LegalUser
  from mangopay.utils import Address, Birthplace

  legal_user = LegalUser(
      id = '210602889'  
  )

  user_ubo_declaration = UboDeclaration(
      id = '210896999'
  )

  user_ubo = Ubo(
      id = '210897219', # ID of UBO we want to update
      # List ALL details and change what's needed
      first_name = "Robbie", 
      last_name = "Adams", 
      address = Address(
          address_line_1 = '223 Winchester Street',
          city = 'Bolton',
          postal_code = 'BL1 3GA',
          country = 'GB',
      ),
      nationality = 'GB',
      birthday = 336873600,
      birthplace = Birthplace(
          city = 'London',
          country='GB'
      ),
      user = legal_user,
      ubo_declaration = user_ubo_declaration,
      isActive = True
  )

  update_ubo = user_ubo.save()

  pprint(update_ubo)  
  ```

  ```csharp .NET  theme={null}
  using MangoPay.SDK;
  using MangoPay.SDK.Core.Enumerations;
  using MangoPay.SDK.Entities.PUT;
  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 uboDeclarationId = "ubo_m_01J2XHVDCVBB9N2J5ANN04RR88";
          var uboId = "ubo_m_01J2XJVEGZT9WJGPN1E23AKB9H";

          var ubo = new UboPutDTO("Alice", "Smith", 
              new Address {
                  AddressLine1 = "17 Rue de la République",
                  City = "Paris",
                  PostalCode = "75001",
                  Country = CountryIso.FR
              }, CountryIso.FR, new DateTime(1985, 3, 15), 
              new Birthplace {
                  City = "Paris",
                  Country = CountryIso.FR
              })
              {
                  IsActive = true
              };


          var updateUbo  = await api.UboDeclarations.UpdateUboAsync(ubo, userId, uboDeclarationId, uboId);

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