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

# Create Company From CG

POST https://api-b2b.bigcommerce.com/api/v2/io/companies/convert-from-customer-group
Content-Type: application/json

Create company from bigCommerce customer group. This API only enable for non-MSF store.

Reference: https://docs.bigcommerce.com/developer/docs/archive/b2b-edition/v2-api/company/companies-convert-from-customer-group-create

## Authentication

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

## Request

### Headers

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

### Body (application/json)

This endpoint expects an object.

- `adminEmail` (string, required) — Company admin user email
- `adminFirstName` (string, required) — Company admin user's first name
- `adminLastName` (string, required) — Company admin user's last name
- `companyEmail` (string, required)
- `companyName` (string, required)
- `customerGroupId` (string, required) — BC customer group ID
- `phoneNumber` (string, required)
- `acceptWelcomeEmail` (enum, optional) — (0=will not receive email 1=will receive email)
  - Allowed values: `0`, `1`
- `addressLine1` (string, optional) — Address string line 1
- `addressLine2` (string, optional) — Address string line 2
- `adminPhoneNumber` (string, optional) — Company admin user phone number
- `city` (string, optional)
- `country` (string, optional)
- `extraFields` (list of CompaniesConvertFromCustomerGroupPostRequestBodyContentApplicationJsonSchemaExtraFieldsItems, optional) — To use customized extra fields with field names you need to first add company extra fields in Settings > Extra fields inside B2B edition. eg. If you want to create a new company with an extra integer field named licenseNO, you can use this structure \[\{'fieldName': 'LicenseNO', 'fieldValue': 10342340323}] in the request body.
- `state` (string, optional)
- `zipCode` (string, optional)
- `userExtraFields` (list of CompaniesConvertFromCustomerGroupPostRequestBodyContentApplicationJsonSchemaUserExtraFieldsItems, optional)

## Response

### 200

Response Success

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

## Errors

### 400 Bad Request Error

Response Bad Request

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

### 404 Not Found Error

Not Found Error

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

## Types

### CompaniesConvertFromCustomerGroupPostRequestBodyContentApplicationJsonSchemaExtraFieldsItems

- `fieldName` (string, optional)
- `fieldValue` (string, optional)

### CompaniesConvertFromCustomerGroupPostRequestBodyContentApplicationJsonSchemaUserExtraFieldsItems

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

### CompaniesConvertFromCustomerGroupPostResponsesContentApplicationJsonSchemaData

Response data

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

## Examples

**Request**

```json
{
  "adminEmail": "string",
  "adminFirstName": "string",
  "adminLastName": "string",
  "companyEmail": "string",
  "companyName": "string",
  "customerGroupId": "string",
  "phoneNumber": "string"
}
```

**Response**

```json
{
  "code": 200,
  "data": {
    "companyId": "2"
  },
  "message": "Success"
}
```

**SDK Code**

```shell Shell

curl --location --request POST 'https://api-b2b.bigcommerce.com/api/v2/io/companies/convert-from-customer-group'                         --header 'authToken: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdG9yZV9oYXNoIjoiZjJvc3hqam54aiIsImRiIjoiZGVmYXVsdCIsImVtYWlsIjoiYnJ1Y2UuaHVhbmdAc2lsa3NvZnR3YXJlLmNvbSJ9._DQFg-3FgtztdQVCGU5Gxfv8j8V3U9Ssaw7ARxUU6pY'                         --header 'Content-Type: application/json'                         --data-raw '{
    "companyName": "Acme Corporation",
    "phoneNumber": 5551234567,
    "companyEmail": "contact@acme.com",
    "addressLine1": "123 Business Street",
    "addressLine2": "",
    "city": "Austin",
    "state": "TX",
    "zipCode": "78701",
    "country": "United States",
    "adminFirstName": "John",
    "adminLastName": "Doe",
    "adminEmail": "admin@acme.com",
    "adminPhoneNumber": "5551234567",
    "customerGroupId": 4
}'

```

```python Python

import requests

url = "https://api-b2b.bigcommerce.com/api/v2/io/companies/convert-from-customer-group"

payload = {
    "companyName": "Acme Corporation",
    "phoneNumber": 5551234567,
    "companyEmail": "contact@acme.com",
    "addressLine1": "123 Business Street",
    "addressLine2": "",
    "city": "Austin",
    "state": "TX",
    "zipCode": "78701",
    "country": "United States",
    "adminFirstName": "John",
    "adminLastName": "Doe",
    "adminEmail": "admin@acme.com",
    "adminPhoneNumber": "5559876543",
    "customerGroupId": 4
}
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({"companyName":"Acme Corporation","phoneNumber":5551234567,"companyEmail":"contact@acme.com","addressLine1":"123 Business Street","addressLine2":"","city":"Austin","state":"TX","zipCode":"78701","country":"United States","adminFirstName":"John","adminLastName":"Doe","adminEmail":"admin@acme.com","adminPhoneNumber":"5559876543","customerGroupId":4});

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

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

```

```go Company_companies_convert-from-customer-group_create_example
package main

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

func main() {

	url := "https://api-b2b.bigcommerce.com/api/v2/io/companies/convert-from-customer-group"

	payload := strings.NewReader("{\n  \"adminEmail\": \"string\",\n  \"adminFirstName\": \"string\",\n  \"adminLastName\": \"string\",\n  \"companyEmail\": \"string\",\n  \"companyName\": \"string\",\n  \"customerGroupId\": \"string\",\n  \"phoneNumber\": \"string\"\n}")

	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 Company_companies_convert-from-customer-group_create_example
require 'uri'
require 'net/http'

url = URI("https://api-b2b.bigcommerce.com/api/v2/io/companies/convert-from-customer-group")

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 = "{\n  \"adminEmail\": \"string\",\n  \"adminFirstName\": \"string\",\n  \"adminLastName\": \"string\",\n  \"companyEmail\": \"string\",\n  \"companyName\": \"string\",\n  \"customerGroupId\": \"string\",\n  \"phoneNumber\": \"string\"\n}"

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

```java Company_companies_convert-from-customer-group_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/convert-from-customer-group")
  .header("authToken", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"adminEmail\": \"string\",\n  \"adminFirstName\": \"string\",\n  \"adminLastName\": \"string\",\n  \"companyEmail\": \"string\",\n  \"companyName\": \"string\",\n  \"customerGroupId\": \"string\",\n  \"phoneNumber\": \"string\"\n}")
  .asString();
```

```php Company_companies_convert-from-customer-group_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/convert-from-customer-group', [
  'body' => '{
  "adminEmail": "string",
  "adminFirstName": "string",
  "adminLastName": "string",
  "companyEmail": "string",
  "companyName": "string",
  "customerGroupId": "string",
  "phoneNumber": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'authToken' => '<apiKey>',
  ],
]);

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

```csharp Company_companies_convert-from-customer-group_create_example
using RestSharp;

var client = new RestClient("https://api-b2b.bigcommerce.com/api/v2/io/companies/convert-from-customer-group");
var request = new RestRequest(Method.POST);
request.AddHeader("authToken", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"adminEmail\": \"string\",\n  \"adminFirstName\": \"string\",\n  \"adminLastName\": \"string\",\n  \"companyEmail\": \"string\",\n  \"companyName\": \"string\",\n  \"customerGroupId\": \"string\",\n  \"phoneNumber\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Company_companies_convert-from-customer-group_create_example
import Foundation

let headers = [
  "authToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "adminEmail": "string",
  "adminFirstName": "string",
  "adminLastName": "string",
  "companyEmail": "string",
  "companyName": "string",
  "customerGroupId": "string",
  "phoneNumber": "string"
] 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/convert-from-customer-group")! 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()
```