> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.mercoa.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mercoa.com/_mcp/server.

# Add Entities

POST https://api.mercoa.com/entityGroup/{entityGroupId}/addEntities
Content-Type: application/json

Add entities to an entity group

Reference: https://docs.mercoa.com/embedded-ap-ar/api-reference/entity-group/add-entities

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `entityGroupId` (string, required) — Entity Group ID or Entity Group ForeignID

### Body (application/json)

This endpoint expects an object.

- `entityIds` (list of string, required) — List of entity IDs or foreign IDs to add to the group
- `copyUsersFrom` (boolean or string, optional) — Entity ID / foreign ID of an entity currently in the group to copy users and roles from OR a boolean defining if users should be copied to the new entities. If not provided or false, users and roles will not be copied. If true, users and roles will be copied from the entity with the most users that has been updated most recently. If a valid ID is provided, users and roles will be copied from the corresponding provided entity in the group. Note: If users copied, any preexisting users will be left alone, and users with the same foreign ID will not be copied.
- `filterRoles` (list of string, optional) — List of roles to filter users by. If not provided, all users will be copied. If provided, only users with the provided roles will be copied.

## Response

### 200

- `id` (string, required)
- `entities` (list of object, required)
  - `id` (string, required)
  - `name` (string, required)
  - `email` (string, required)
  - `isCustomer` (boolean, required) — True if this entity has a direct relationship with your organization.
  - `accountType` (enum, required)
    - Allowed values: `business`, `individual`
  - `profile` (object, required)
    - `business` (object, optional) — Will be set if the entity is a business
      - `legalBusinessName` (string, required)
      - `taxIDProvided` (boolean, required)
      - `email` (string, optional)
      - `businessType` (enum, optional)
        - Allowed values: `soleProprietorship`, `unincorporatedAssociation`, `trust`, `publicCorporation`, `privateCorporation`, `llc`, `partnership`, `unincorporatedNonProfit`, `incorporatedNonProfit`
      - `phone` (object, optional)
        - `countryCode` (string, required)
        - `number` (string, required)
      - `doingBusinessAs` (string, optional)
      - `website` (string, optional)
      - `description` (string, optional)
      - `address` (object, optional)
        - `addressLine1` (string, required)
        - `city` (string, required)
        - `stateOrProvince` (string, required) — State or province code. Must be in the format XX.
        - `postalCode` (string, required) — Postal code. Must be in the format XXXXX or XXXXX-XXXX.
        - `addressLine2` (string, optional)
        - `country` (string, optional)
      - `ownersProvided` (boolean, optional) — True if all representatives have been provided for this business.
      - `taxId` (object, optional)
        - `ein` (object, required)
          - `number` (string, required) — Must be in the format XX-XXXXXXX.
      - `formationDate` (datetime, optional)
      - `industryCodes` (object, optional)
        - `mcc` (string, optional)
      - `averageMonthlyTransactionVolume` (double, optional)
      - `averageTransactionSize` (double, optional)
      - `maxTransactionSize` (double, optional)
    - `individual` (object, optional) — Will be set if the entity is a individual
      - `name` (object, required)
        - `firstName` (string, required)
        - `lastName` (string, required)
        - `middleName` (string, optional)
        - `suffix` (string, optional)
      - `birthDateProvided` (boolean, required)
      - `governmentIDProvided` (boolean, required)
      - `email` (string, optional)
      - `phone` (object, optional)
        - `countryCode` (string, required)
        - `number` (string, required)
      - `address` (object, optional)
        - `addressLine1` (string, required)
        - `city` (string, required)
        - `stateOrProvince` (string, required) — State or province code. Must be in the format XX.
        - `postalCode` (string, required) — Postal code. Must be in the format XXXXX or XXXXX-XXXX.
        - `addressLine2` (string, optional)
        - `country` (string, optional)
  - `status` (enum, required)
    - Allowed values: `unverified`, `pending`, `resubmit`, `review`, `verified`, `failed`
  - `acceptedTos` (boolean, required) — True if this entity has accepted the terms of service.
  - `isPayor` (boolean, required) — True if this entity can pay invoices.
  - `isPayee` (boolean, required) — True if this entity can receive payments.
  - `isNetworkPayor` (boolean, required) — True if this entity is available as a payor to any entity on your platform. Otherwise this entity will only be available as a payor to entities that have a direct relationship with this entity.
  - `isNetworkPayee` (boolean, required) — True if this entity is available as a payee to any entity on your platform. Otherwise this entity will only be available as a payee to entities that have a direct relationship with this entity.
  - `createdAt` (datetime, required)
  - `updatedAt` (datetime, required)
  - `foreignId` (string, optional) — The ID used to identify this entity in your system
  - `emailTo` (string, optional) — Local-part/username of the email address to which to send invoices to be added to the Invoice Inbox.
  - `emailToAlias` (list of string, optional) — Email inbox alias addresses. Used when forwarding emails to the emailTo address from an alias.
  - `logo` (string, optional) — URL for the entity logo
  - `oatfiStatus` (string, optional) — The OatFi status of this entity
  - `oatfiUnderwritingResponse` (map from string to string, optional) — The OatFi underwriting response of this entity
  - `metadata` (map from string to string, optional) — Simple key/value metadata associated with this entity. For more complex metadata, use the Metadata API.
- `metadata` (map from string to string, required)
- `foreignId` (string, optional)
- `name` (string, optional)
- `emailToName` (string, optional)

## Errors

### 400 Bad Request

- `errorName` ("BadRequest", required)
- `content` (string, required)

### 401 Unauthorized

- `errorName` ("Unauthorized", required)
- `content` (string, required)

### 403 Forbidden

- `errorName` ("Forbidden", required)
- `content` (string, required)

### 404 Not Found

- `errorName` ("NotFound", required)
- `content` (string, required)

### 409 Conflict

- `errorName` ("Conflict", required)
- `content` (string, required)

### 500 Internal Server Error

- `errorName` ("InternalServerError", required)
- `content` (string, required)

### 501 Unimplemented

- `errorName` ("Unimplemented", required)
- `content` (string, required)

## Examples

### Default (Will Not Copy Users)

**Request**

```json
{
  "entityIds": [
    "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
    "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"
  ]
}
```

**Response**

```json
{
  "id": "entg_a3582b70-fd04-4888-9185-a640ae9048be",
  "entities": [
    {
      "id": "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
      "name": "Acme Inc.",
      "email": "customer@acme.com",
      "isCustomer": true,
      "accountType": "business",
      "profile": {
        "business": {
          "legalBusinessName": "Acme Inc.",
          "taxIDProvided": true,
          "email": "customer@acme.com",
          "businessType": "llc",
          "phone": {
            "countryCode": "1",
            "number": "4155551234"
          },
          "address": {
            "addressLine1": "123 Main St",
            "city": "San Francisco",
            "stateOrProvince": "CA",
            "postalCode": "94105",
            "addressLine2": "Unit 1",
            "country": "US"
          },
          "ownersProvided": true,
          "taxId": {
            "ein": {
              "number": "12-3456789"
            }
          }
        }
      },
      "status": "verified",
      "acceptedTos": true,
      "isPayor": true,
      "isPayee": false,
      "isNetworkPayor": false,
      "isNetworkPayee": false,
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-02T00:00:00Z",
      "foreignId": "MY-DB-ID-12345"
    },
    {
      "id": "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
      "name": "Big Box Store",
      "email": "vendor@bigboxstore.com",
      "isCustomer": false,
      "accountType": "business",
      "profile": {
        "business": {
          "legalBusinessName": "Big Box Store",
          "taxIDProvided": false,
          "email": "vendor@bigboxstore.com",
          "businessType": "publicCorporation",
          "ownersProvided": false
        }
      },
      "status": "unverified",
      "acceptedTos": false,
      "isPayor": false,
      "isPayee": true,
      "isNetworkPayor": false,
      "isNetworkPayee": false,
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-02T00:00:00Z",
      "foreignId": "MY-DB-ID-90909"
    }
  ],
  "metadata": {
    "key1": "value1"
  },
  "foreignId": "your-group-id",
  "name": "AcmeConglomerate",
  "emailToName": "acmegroup"
}
```

**SDK Code**

```python Default (Will Not Copy Users)
import requests

url = "https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities"

payload = { "entityIds": ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```typescript Default (Will Not Copy Users)
import { MercoaClient } from "@mercoa/javascript";

const client = new MercoaClient({ token: "YOUR_TOKEN" });
await client.entityGroup.addEntities("entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced", {
    entityIds: ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"]
});

```

```go Default (Will Not Copy Users)
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities"

	payload := strings.NewReader("{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Default (Will Not Copy Users)
require 'uri'
require 'net/http'

url = URI("https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Default (Will Not Copy Users)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ]\n}")
  .asString();
```

```php Default (Will Not Copy Users)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities', [
  'body' => '{
  "entityIds": [
    "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
    "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Default (Will Not Copy Users)
using RestSharp;

var client = new RestClient("https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Default (Will Not Copy Users)
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["entityIds": ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### ExplicitlyCopyUsers

**Request**

```json
{
  "entityIds": [
    "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
    "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"
  ],
  "copyUsersFrom": true
}
```

**Response**

```json
{
  "id": "entg_a3582b70-fd04-4888-9185-a640ae9048be",
  "entities": [
    {
      "id": "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
      "name": "Acme Inc.",
      "email": "customer@acme.com",
      "isCustomer": true,
      "accountType": "business",
      "profile": {
        "business": {
          "legalBusinessName": "Acme Inc.",
          "taxIDProvided": true,
          "email": "customer@acme.com",
          "businessType": "llc",
          "phone": {
            "countryCode": "1",
            "number": "4155551234"
          },
          "address": {
            "addressLine1": "123 Main St",
            "city": "San Francisco",
            "stateOrProvince": "CA",
            "postalCode": "94105",
            "addressLine2": "Unit 1",
            "country": "US"
          },
          "ownersProvided": true,
          "taxId": {
            "ein": {
              "number": "12-3456789"
            }
          }
        }
      },
      "status": "verified",
      "acceptedTos": true,
      "isPayor": true,
      "isPayee": false,
      "isNetworkPayor": false,
      "isNetworkPayee": false,
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-02T00:00:00Z",
      "foreignId": "MY-DB-ID-12345"
    },
    {
      "id": "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
      "name": "Big Box Store",
      "email": "vendor@bigboxstore.com",
      "isCustomer": false,
      "accountType": "business",
      "profile": {
        "business": {
          "legalBusinessName": "Big Box Store",
          "taxIDProvided": false,
          "email": "vendor@bigboxstore.com",
          "businessType": "publicCorporation",
          "ownersProvided": false
        }
      },
      "status": "unverified",
      "acceptedTos": false,
      "isPayor": false,
      "isPayee": true,
      "isNetworkPayor": false,
      "isNetworkPayee": false,
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-02T00:00:00Z",
      "foreignId": "MY-DB-ID-90909"
    }
  ],
  "metadata": {
    "key1": "value1"
  },
  "foreignId": "your-group-id",
  "name": "AcmeConglomerate",
  "emailToName": "acmegroup"
}
```

**SDK Code**

```python ExplicitlyCopyUsers
import requests

url = "https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities"

payload = {
    "entityIds": ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"],
    "copyUsersFrom": True
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```typescript ExplicitlyCopyUsers
import { MercoaClient } from "@mercoa/javascript";

const client = new MercoaClient({ token: "YOUR_TOKEN" });
await client.entityGroup.addEntities("entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced", {
    entityIds: ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"],
    copyUsersFrom: true
});

```

```go ExplicitlyCopyUsers
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities"

	payload := strings.NewReader("{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ],\n  \"copyUsersFrom\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby ExplicitlyCopyUsers
require 'uri'
require 'net/http'

url = URI("https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ],\n  \"copyUsersFrom\": true\n}"

response = http.request(request)
puts response.read_body
```

```java ExplicitlyCopyUsers
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ],\n  \"copyUsersFrom\": true\n}")
  .asString();
```

```php ExplicitlyCopyUsers
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities', [
  'body' => '{
  "entityIds": [
    "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
    "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"
  ],
  "copyUsersFrom": true
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp ExplicitlyCopyUsers
using RestSharp;

var client = new RestClient("https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ],\n  \"copyUsersFrom\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift ExplicitlyCopyUsers
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "entityIds": ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"],
  "copyUsersFrom": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### DoNotCopyUsers

**Request**

```json
{
  "entityIds": [
    "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
    "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"
  ],
  "copyUsersFrom": false
}
```

**Response**

```json
{
  "id": "entg_a3582b70-fd04-4888-9185-a640ae9048be",
  "entities": [
    {
      "id": "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
      "name": "Acme Inc.",
      "email": "customer@acme.com",
      "isCustomer": true,
      "accountType": "business",
      "profile": {
        "business": {
          "legalBusinessName": "Acme Inc.",
          "taxIDProvided": true,
          "email": "customer@acme.com",
          "businessType": "llc",
          "phone": {
            "countryCode": "1",
            "number": "4155551234"
          },
          "address": {
            "addressLine1": "123 Main St",
            "city": "San Francisco",
            "stateOrProvince": "CA",
            "postalCode": "94105",
            "addressLine2": "Unit 1",
            "country": "US"
          },
          "ownersProvided": true,
          "taxId": {
            "ein": {
              "number": "12-3456789"
            }
          }
        }
      },
      "status": "verified",
      "acceptedTos": true,
      "isPayor": true,
      "isPayee": false,
      "isNetworkPayor": false,
      "isNetworkPayee": false,
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-02T00:00:00Z",
      "foreignId": "MY-DB-ID-12345"
    },
    {
      "id": "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
      "name": "Big Box Store",
      "email": "vendor@bigboxstore.com",
      "isCustomer": false,
      "accountType": "business",
      "profile": {
        "business": {
          "legalBusinessName": "Big Box Store",
          "taxIDProvided": false,
          "email": "vendor@bigboxstore.com",
          "businessType": "publicCorporation",
          "ownersProvided": false
        }
      },
      "status": "unverified",
      "acceptedTos": false,
      "isPayor": false,
      "isPayee": true,
      "isNetworkPayor": false,
      "isNetworkPayee": false,
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-02T00:00:00Z",
      "foreignId": "MY-DB-ID-90909"
    }
  ],
  "metadata": {
    "key1": "value1"
  },
  "foreignId": "your-group-id",
  "name": "AcmeConglomerate",
  "emailToName": "acmegroup"
}
```

**SDK Code**

```python DoNotCopyUsers
import requests

url = "https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities"

payload = {
    "entityIds": ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"],
    "copyUsersFrom": False
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```typescript DoNotCopyUsers
import { MercoaClient } from "@mercoa/javascript";

const client = new MercoaClient({ token: "YOUR_TOKEN" });
await client.entityGroup.addEntities("entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced", {
    entityIds: ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"],
    copyUsersFrom: false
});

```

```go DoNotCopyUsers
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities"

	payload := strings.NewReader("{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ],\n  \"copyUsersFrom\": false\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby DoNotCopyUsers
require 'uri'
require 'net/http'

url = URI("https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ],\n  \"copyUsersFrom\": false\n}"

response = http.request(request)
puts response.read_body
```

```java DoNotCopyUsers
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ],\n  \"copyUsersFrom\": false\n}")
  .asString();
```

```php DoNotCopyUsers
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities', [
  'body' => '{
  "entityIds": [
    "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
    "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"
  ],
  "copyUsersFrom": false
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp DoNotCopyUsers
using RestSharp;

var client = new RestClient("https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ],\n  \"copyUsersFrom\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift DoNotCopyUsers
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "entityIds": ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"],
  "copyUsersFrom": false
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### CopyUsersFromID

**Request**

```json
{
  "entityIds": [
    "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
    "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"
  ],
  "copyUsersFrom": "ent_1176dd0c-12e1-41c7-85a5-ae9b4746e64b"
}
```

**Response**

```json
{
  "id": "entg_a3582b70-fd04-4888-9185-a640ae9048be",
  "entities": [
    {
      "id": "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
      "name": "Acme Inc.",
      "email": "customer@acme.com",
      "isCustomer": true,
      "accountType": "business",
      "profile": {
        "business": {
          "legalBusinessName": "Acme Inc.",
          "taxIDProvided": true,
          "email": "customer@acme.com",
          "businessType": "llc",
          "phone": {
            "countryCode": "1",
            "number": "4155551234"
          },
          "address": {
            "addressLine1": "123 Main St",
            "city": "San Francisco",
            "stateOrProvince": "CA",
            "postalCode": "94105",
            "addressLine2": "Unit 1",
            "country": "US"
          },
          "ownersProvided": true,
          "taxId": {
            "ein": {
              "number": "12-3456789"
            }
          }
        }
      },
      "status": "verified",
      "acceptedTos": true,
      "isPayor": true,
      "isPayee": false,
      "isNetworkPayor": false,
      "isNetworkPayee": false,
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-02T00:00:00Z",
      "foreignId": "MY-DB-ID-12345"
    },
    {
      "id": "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
      "name": "Big Box Store",
      "email": "vendor@bigboxstore.com",
      "isCustomer": false,
      "accountType": "business",
      "profile": {
        "business": {
          "legalBusinessName": "Big Box Store",
          "taxIDProvided": false,
          "email": "vendor@bigboxstore.com",
          "businessType": "publicCorporation",
          "ownersProvided": false
        }
      },
      "status": "unverified",
      "acceptedTos": false,
      "isPayor": false,
      "isPayee": true,
      "isNetworkPayor": false,
      "isNetworkPayee": false,
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-02T00:00:00Z",
      "foreignId": "MY-DB-ID-90909"
    }
  ],
  "metadata": {
    "key1": "value1"
  },
  "foreignId": "your-group-id",
  "name": "AcmeConglomerate",
  "emailToName": "acmegroup"
}
```

**SDK Code**

```python CopyUsersFromID
import requests

url = "https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities"

payload = {
    "entityIds": ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"],
    "copyUsersFrom": "ent_1176dd0c-12e1-41c7-85a5-ae9b4746e64b"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```typescript CopyUsersFromID
import { MercoaClient } from "@mercoa/javascript";

const client = new MercoaClient({ token: "YOUR_TOKEN" });
await client.entityGroup.addEntities("entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced", {
    entityIds: ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"],
    copyUsersFrom: "ent_1176dd0c-12e1-41c7-85a5-ae9b4746e64b"
});

```

```go CopyUsersFromID
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities"

	payload := strings.NewReader("{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ],\n  \"copyUsersFrom\": \"ent_1176dd0c-12e1-41c7-85a5-ae9b4746e64b\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby CopyUsersFromID
require 'uri'
require 'net/http'

url = URI("https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ],\n  \"copyUsersFrom\": \"ent_1176dd0c-12e1-41c7-85a5-ae9b4746e64b\"\n}"

response = http.request(request)
puts response.read_body
```

```java CopyUsersFromID
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ],\n  \"copyUsersFrom\": \"ent_1176dd0c-12e1-41c7-85a5-ae9b4746e64b\"\n}")
  .asString();
```

```php CopyUsersFromID
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities', [
  'body' => '{
  "entityIds": [
    "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
    "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"
  ],
  "copyUsersFrom": "ent_1176dd0c-12e1-41c7-85a5-ae9b4746e64b"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp CopyUsersFromID
using RestSharp;

var client = new RestClient("https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"entityIds\": [\n    \"ent_8545a84e-a45f-41bf-bdf1-33b42a55812c\",\n    \"ent_21661ac1-a2a8-4465-a6c0-64474ba8181d\"\n  ],\n  \"copyUsersFrom\": \"ent_1176dd0c-12e1-41c7-85a5-ae9b4746e64b\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift CopyUsersFromID
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "entityIds": ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"],
  "copyUsersFrom": "ent_1176dd0c-12e1-41c7-85a5-ae9b4746e64b"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/entityGroup/entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced/addEntities")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```