> This page is for Developer.

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

# Bulk Create Company User

POST https://api-b2b.bigcommerce.com/api/v2/io/companies/{companyId}/users/bulk_create
Content-Type: application/json

Create company users in batch

Reference: https://docs.bigcommerce.com/developer/docs/archive/b2b-edition/v2-api/user/companies-users-bulk-create-create

## Authentication

- `authToken` header (required) — API Key authentication via header

## Request

### Path parameters

- `companyId` (string, required)

### Headers

- `authToken` (string, required) — Auth token in header.

### Body (application/json)

This endpoint expects an object.

- `acceptWelcomeEmail` (enum, optional) — (0=will not receive email 1=will receive email)
  - Allowed values: `0`, `1`
- `users` (list of CompaniesCompanyIdUsersBulkCreatePostRequestBodyContentApplicationJsonSchemaUsersItems, optional)

## Response

### 200

Response Success

- `code` (double, optional) — Response status code
- `data` (CompaniesCompanyIdUsersBulkCreatePostResponsesContentApplicationJsonSchemaData, optional) — Response data
- `message` (string, optional) — Response message

## Errors

### 400 Bad Request Error

Response Bad Request

- `code` (double, optional) — Response status code
- `data` (CompaniesCompanyIdUsersBulkCreatePostResponsesContentApplicationJsonSchemaData, optional) — Response data
- `message` (string, optional) — Response message

### 404 Not Found Error

Not Found Error

- `code` (double, optional) — Response status code
- `data` (CompaniesCompanyIdUsersBulkCreatePostResponsesContentApplicationJsonSchemaData, optional) — Response data
- `message` (string, optional) — Response message

## Types

### CompaniesCompanyIdUsersBulkCreatePostRequestBodyContentApplicationJsonSchemaUsersItems

Extra Field Values

- `email` (string, required)
- `firstName` (string, required)
- `lastName` (string, required)
- `phone` (string, required)
- `userRole` (string, optional) — user role(0=admin 1=senior_buyer 2=junior_buyer 3=sales_rep)
- `channelIds` (list of integer, optional) — BigCommerce channel id list
- `originChannelId` (integer, optional) — BigCommerce channel id, used for BigCommerce customer origin channel id. This field takes effect only when the store default b2b channel is not configured
- `companyRoleId` (integer, optional) — The company role id. This field is only applicable to the company's RBAC feature. If your store doesn't utilize this feature, please do not use this field. When it has a value, it will override the value of the userRole field.
- `extraFields` (list of CompaniesCompanyIdUsersBulkCreatePostRequestBodyContentApplicationJsonSchemaUsersItemsExtraFieldsItems, optional)

### CompaniesCompanyIdUsersBulkCreatePostResponsesContentApplicationJsonSchemaData

Response data

- `errMsg` (string, optional) — Error message info

### CompaniesCompanyIdUsersBulkCreatePostRequestBodyContentApplicationJsonSchemaUsersItemsExtraFieldsItems

- `fieldName` (string, required) — Field name that config in you store
- `fieldValue` (string, required) — Value of the extra field.

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "code": 200,
  "data": {
    "failedItems": [],
    "successfulItems": [
      {
        "customerId": 2,
        "email": "user1@example.com",
        "firstName": "Jane",
        "lastName": "Smith",
        "phone": "555-123-4567",
        "userRole": 1
      },
      {
        "customerId": 2,
        "email": "user2@example.com",
        "firstName": "John",
        "lastName": "Doe",
        "phone": "555-987-6543",
        "userRole": 1
      }
    ]
  },
  "message": "Success"
}
```

**SDK Code**

```shell Shell

curl --location --request POST 'https://api-b2b.bigcommerce.com/api/v2/io/companies/4/users/bulk_create'                         --header 'authToken: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdG9yZV9oYXNoIjoiZjJvc3hqam54aiIsImRiIjoiZGVmYXVsdCIsImVtYWlsIjoiYnJ1Y2UuaHVhbmdAc2lsa3NvZnR3YXJlLmNvbSJ9._DQFg-3FgtztdQVCGU5Gxfv8j8V3U9Ssaw7ARxUU6pY'                         --header 'Content-Type: application/json'                         --data-raw '{
    "users": [
        {
            "firstName": "Jane",
            "lastName": "Smith",
            "email": "jane.smith@example.com",
            "phone": "5551234567",
            "userRole": 1
        },
        {
            "firstName": "John",
            "lastName": "Doe",
            "email": "john.doe@example.com",
            "phone": "5559876543",
            "userRole": 1
        }
    ]
}'

```

```python Python

import requests

url = "https://api-b2b.bigcommerce.com/api/v2/io/companies/4/users/bulk_create"

payload = {
    "users": [
        {
            "firstName": "Jane",
            "lastName": "Smith",
            "email": "jane.smith@example.com",
            "phone": "5551234567",
            "userRole": 1
        },
        {
            "firstName": "John",
            "lastName": "Doe",
            "email": "john.doe@example.com",
            "phone": "5559876543",
            "userRole": 1
        }
    ]
}
headers = {
  'authToken': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdG9yZV9oYXNoIjoiZjJvc3hqam54aiIsImRiIjoiZGVmYXVsdCIsImVtYWlsIjoiYnJ1Y2UuaHVhbmdAc2lsa3NvZnR3YXJlLmNvbSJ9._DQFg-3FgtztdQVCGU5Gxfv8j8V3U9Ssaw7ARxUU6pY',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data = payload)

print(response.text.encode('utf8'))

```

```javascript JavaScript

var myHeaders = new Headers();
myHeaders.append("authToken", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdG9yZV9oYXNoIjoiZjJvc3hqam54aiIsImRiIjoiZGVmYXVsdCIsImVtYWlsIjoiYnJ1Y2UuaHVhbmdAc2lsa3NvZnR3YXJlLmNvbSJ9._DQFg-3FgtztdQVCGU5Gxfv8j8V3U9Ssaw7ARxUU6pY");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({"users":[{"firstName":"Jane","lastName":"Smith","email":"jane.smith@example.com","phone":"5551234567","userRole":1},{"firstName":"John","lastName":"Doe","email":"john.doe@example.com","phone":"5559876543","userRole":1}]});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api-b2b.bigcommerce.com/api/v2/io/companies/4/users/bulk_create", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

```

```go User_companies_users_bulk_create_create_example
package main

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

func main() {

	url := "https://api-b2b.bigcommerce.com/api/v2/io/companies/companyId/users/bulk_create"

	payload := strings.NewReader("{}")

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

	req.Header.Add("authToken", "<apiKey>")
	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 User_companies_users_bulk_create_create_example
require 'uri'
require 'net/http'

url = URI("https://api-b2b.bigcommerce.com/api/v2/io/companies/companyId/users/bulk_create")

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

request = Net::HTTP::Post.new(url)
request["authToken"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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

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

HttpResponse<String> response = Unirest.post("https://api-b2b.bigcommerce.com/api/v2/io/companies/companyId/users/bulk_create")
  .header("authToken", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-b2b.bigcommerce.com/api/v2/io/companies/companyId/users/bulk_create', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'authToken' => '<apiKey>',
  ],
]);

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

```csharp User_companies_users_bulk_create_create_example
using RestSharp;

var client = new RestClient("https://api-b2b.bigcommerce.com/api/v2/io/companies/companyId/users/bulk_create");
var request = new RestRequest(Method.POST);
request.AddHeader("authToken", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift User_companies_users_bulk_create_create_example
import Foundation

let headers = [
  "authToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api-b2b.bigcommerce.com/api/v2/io/companies/companyId/users/bulk_create")! 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()
```