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

# Get Company by User ID

GET https://api-b2b.bigcommerce.com/api/v2/customers/{userId}/companies

Returns information for the Company account that corresponds to the provided user ID.

Equivalent Storefront GraphQL API Query: `userCompany`. For more information, see the [GraphQL Playground](https://api-b2b.bigcommerce.com/graphql/playground).

You must use the `userId` value for the Company user to return the correct Company; the `customerId` value of the corresponding BigCommerce customer account is not supported.

Reference: https://docs.bigcommerce.com/developer/api-reference/rest/b2b/storefront/company/companies/getcompanybyuserid

## Authentication

- `Authorization` header (bearer token, required) — ### Authentication header | Header | Argument | Description | | :-------------- | :------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Authorization` | `Bearer {{B2B_JWT_TOKEN}}` | You can obtain this token using the steps described in the [REST Storefront API](/developer/docs/b2b-edition/getting-started/authentication#rest-storefront-api) section\[...] |

## Request

### Path parameters

- `userId` (string, required) — The unique ID for the customer account.

## Response

### 200

OK

- `message` (string, optional)
- `code` (double, optional, default: 200)
- `data` (CustomersUserIdCompaniesGetResponsesContentApplicationJsonSchemaData, optional)

## Types

### CustomersUserIdCompaniesGetResponsesContentApplicationJsonSchemaData

- `companyId` (string, optional) — Unique numeric ID of the Company account.
- `companyName` (string, optional) — The name of the Company associated with the order's buyer.
- `bcGroupName` (string, optional) — The internal name of the BigCommerce customer group assigned to the Company account. This field is read-only.
- `copanyStatus` (enum, optional) — The Company’s activity status. See [Company Status Codes](/developer/api-reference/rest/b2b/management/company/companies#company-status-codes) to learn about their corresponding statuses.
  - Allowed values: `0`, `1`, `2`, `3`
- `description` (string, optional) — The name of the business associated with the Company account.
- `catalogId` (string, optional) — The ID of the price list assigned to the Company account.
- `extraFields` (extraFields, optional)
- `addressLine1` (string, optional) — The first line of the address
- `addressLine2` (string, optional) — The second line of the address
- `city` (string, optional) — City of the address.
- `zipCode` (string, optional) — Zip or Postal Code of the address.
- `state` (string, optional) — State of the address.
- `country` (string, optional) — Country of the address.

### extraFields

- `extraFields` (list of ExtraFieldsExtraFieldsItems, optional) — Contains extra field information associated with the order.

### ExtraFieldsExtraFieldsItems

- `fieldName` (string, optional) — The name of the order extra field.
- `fieldValue` (string, optional) — The value of the order extra field.

## Examples

**Response**

```json
{
  "message": "string",
  "code": 200,
  "data": {
    "companyId": "123456",
    "companyName": "Great Buys",
    "bcGroupName": "Tier 3 B2B Clients",
    "copanyStatus": "0",
    "description": "string",
    "catalogId": "123456",
    "extraFields": {
      "extraFields": [
        {
          "fieldName": "Company_Tax_Code",
          "fieldValue": "Code G"
        }
      ]
    },
    "addressLine1": "512 Bluebonnet Lane",
    "addressLine2": "Building 2",
    "city": "Austin",
    "zipCode": "78726",
    "state": "Texas",
    "country": "United States"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api-b2b.bigcommerce.com/api/v2/customers/123/companies"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api-b2b.bigcommerce.com/api/v2/customers/123/companies';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api-b2b.bigcommerce.com/api/v2/customers/123/companies"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

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

url = URI("https://api-b2b.bigcommerce.com/api/v2/customers/123/companies")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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

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

HttpResponse<String> response = Unirest.get("https://api-b2b.bigcommerce.com/api/v2/customers/123/companies")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api-b2b.bigcommerce.com/api/v2/customers/123/companies', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api-b2b.bigcommerce.com/api/v2/customers/123/companies");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api-b2b.bigcommerce.com/api/v2/customers/123/companies")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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