# Linking a UBO to an entity

When you've created an entity, use this endpoint to link other applicants or entities as ultimate beneficial owners (UBOs) to the original entity. This will allow you to clearly view the company structure.

{% hint style="warning" %}
Note: You don't need to use this endpoint if you're verifying an entity using a verification link. Verification links require representatives to input UBOs during the verification process.
{% endhint %}

Before linking a UBO, make sure you have created the applicant or entity using the required endpoints: [creating-an-applicant](https://manual.personr.co/api-documentation/applicants/creating-an-applicant "mention")or [creating-an-entity](https://manual.personr.co/api-documentation/entities/creating-an-entity "mention"). You will need to remember their `applicantId` for this call and input them into `uboApplicantId`.

***

## Link a UBO to the entity

<mark style="color:green;">`POST`</mark> `/api-add-ubo`

| Name          | Value                 |
| ------------- | --------------------- |
| Content-Type  | `multipart/form-data` |
| Authorization | `Bearer YOUR_TOKEN`   |

**Body**

<table><thead><tr><th>Name</th><th width="165">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>applicantId</code></td><td>string</td><td>The entity's applicantId you wish for others to be linked to <mark style="color:red;">(required)</mark></td></tr><tr><td><code>uboApplicantId</code></td><td>string</td><td>Unique applicantId generated on applicant or entity creation <mark style="color:red;">(required)</mark></td></tr><tr><td><code>position</code></td><td>string</td><td>The type of UBO - see below for options <mark style="color:red;">(required)</mark></td></tr></tbody></table>

**UBO** `position` **types**

| Name          | Description                        |
| ------------- | ---------------------------------- |
| `Director`    | A director of the entity           |
| `Shareholder` | A shareholder of the entity        |
| `Other`       | Use this when nothing else applies |

{% tabs %}
{% tab title="cURL" %}

```sh
curl --location 'https://enterprise.personr.co/api/1.1/wf/api-add-ubo' \
--form 'applicantId="4242424242424x424242424242424242"' \
--form 'uboApplicantId="4242424242424x424242424242424242"' \
--form 'position="Director"' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const axios = require('axios');
const FormData = require('form-data');

const formData = new FormData();

formData.append('applicantId', '4242424242424x424242424242424242');
formData.append('uboApplicantId', '4242424242424x424242424242424242');
formData.append('position', 'Director');

axios.post('https://enterprise.personr.co/api/1.1/wf/api-add-ubo', formData, {
  headers: {
    ...formData.getHeaders(),
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
  },
})
.then((response) => {
  console.log(response.data);
})
.catch((error) => {
  console.error(error);
});
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
const formData = new FormData();
formData.append('applicantId', '4242424242424x424242424242424242');
formData.append('uboApplicantId', '4242424242424x424242424242424242');
formData.append('position', 'Director');

fetch('https://enterprise.personr.co/api/1.1/wf/api-add-ubo', {
  method: 'POST',
  body: formData,
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
  },
})
.then(response => response.json())
.then(data => {
  console.log(data);
})
.catch(error => {
  console.error('Error:', error);
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'uri'
require 'json'
require 'net/http/post/multipart'

url = URI('https://enterprise.personr.co/api/1.1/wf/api-add-ubo')

req = Net::HTTP::Post::Multipart.new url,
  'applicantId' => '4242424242424x424242424242424242',
  'uboApplicantId' => '4242424242424x424242424242424242',
  'position' => 'Director'

req['Authorization'] = 'Bearer YOUR_ACCESS_TOKEN'

res = Net::HTTP.start(url.hostname, url.port, use_ssl: url.scheme == 'https') do |http|
  http.request(req)
end

puts JSON.parse(res.body)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://enterprise.personr.co/api/1.1/wf/api-add-ubo'

data = {
    'applicantId': '4242424242424x424242424242424242',
    'uboApplicantId': '4242424242424x424242424242424242',
    'position': 'Director'
}

headers = {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}

response = requests.post(url, data=data, headers=headers)

print(response.json())
```

{% endtab %}
{% endtabs %}

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
"status":"success",
"applicantId":"4242424242424x424242424242424242",
"ubos":[   {
        "applicantId":"4242424242424x424242424242424242",
        "type":"Individual",
        "position":"Director"
    }],
"errors":[]
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "statusCode": 400,
    "message": "Error: incorrect applicantId provided"
}
```

{% endtab %}
{% endtabs %}
