Storefront APIs
Companies

Companies

Create a Company

POST /frontend/companies

Request

Submit a Business Account application on the storefront to create a Company account in the Pending status. This is an anonymous operation which does not require a storefront authToken for a particular customer.

Equivalent Storefront GraphQL API Mutation: companyCreate. For more information, see the GraphQL Playground.

If you have configured required information fields in your store’s Extra Fields settings for Company accounts or Company users, you must include the field’s name and value in the extraFields array of the request body. For more information on extra fields, see B2B Edition Settings in the Help Center.

Authentication

  • Authorization in header in the format of Bearer {{token}}

Body

object | application/json
  • companyName
    string
    required

    The name of the business associated with the Company account.
    Example: Great Buys
  • companyPhoneNumber
    string
    required

    The primary phone number for the Company account.
    Example: 1234567890
  • companyFirstName
    string
    required

    The first name of the Company account administrator.
    Example: Robert
  • companyLastName
    string
    required

    The last name of the Company account administrator.
    Example: Robertson
  • customerId
    string
    required

    The ID of the BigCommerce customer account for the Company account administrator.
  • storeHash
    string
    required

    The unique store hash for the BigCommerce store.
    Example: abc123
  • companyEmail
    string
    required

    The primary email address of the company.
    Example: user@example.com
  • addressLine1
    string
    required

    The first line of the address
    Example: 11305 Four Points Drive
  • addressLine2
    string
    required

    The second line of the address
    Example: Building 2
  • city
    string
    required

    City of the address.
    Example: Austin
  • zipCode
    string
    required

    Zip or Postal Code of the address.
    Example: 78726
  • state
    string
    required

    State of the address.
    Example: Texas
  • country
    string
    required

    Country of the address.
    Example: United States
  • extraFields
    array[object]

example

Response

OK

Body

object | application/json
  • code
    number

    Default: 200

  • message
    string

  • data
    object

example

Get Company Extra Fields

GET /companies/extra-fields/storefront

Request

Returns a list of available extra fields for Company accounts.

Equivalent Storefront GraphQL API Query: companyExtraFields. For more information, see the GraphQL Playground.

This request will only return Company extra fields that are configured to be visible on the storefront.

Authentication

  • Authorization in header in the format of Bearer {{token}}

Parameters

  • storeHash in query - string
    required
    The unique alphanumeric store hash for the BigCommerce store.

example

Response

OK

Body

object | application/json
  • message
    string

  • data
    array[object]

  • code
    number

    Default: 200

example

Get a Company by User ID

GET /customers/{userId}/companies

Request

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.

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.

Authentication

  • Authorization in header in the format of Bearer {{token}}

Parameters

  • userId in path - string
    required
    The unique ID for the customer account.

example

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

example

Get a Company User List

GET /companies/{companyId}/users

Request

Returns a list of users associated with a Company account.

Equivalent Storefront GraphQL API Query: users. For more information, see the GraphQL Playground.

Authentication

  • Authorization in header in the format of Bearer {{token}}

Parameters

  • companyId in path - string
    required
    The unique numeric ID of the Company account.
  • role[] in query - string
    The ID of the role assigned to the Company user account as defined at Specifying User Role.

    Allowed: 0 | 1 | 2

  • limit in query with default of 10 - string
    The total number of items per page of the response.
  • offset in query - string
    The number of items to skip before the current page of the response.
  • q in query - string
    The search string for the request.
  • minLastModifiedTime in query - string
    The earliest Unix timestamp for when the Company account was modified that can be returned.
  • maxLastModifiedTime in query - string
    The latest Unix timestamp for when the Company account was modified that can be returned.
  • minLastCreatedTime in query - string
    The earliest Unix timestamp for when the Company account was created that can be returned.
  • maxLastCreatedTime in query - string
    The earliest Unix timestamp for when the Company account was created that can be returned.

example

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

example

Create a Company User

POST /companies/{companyId}/users

Request

Creates a user associated with a particular Company account.

Equivalent Storefront GraphQL API Mutation: userCreate. For more information, see the GraphQL Playground.

If you enter an email address in the email field that is associated with a BigCommerce customer account, and the customer account does not already have a corresponding Company user account, it will link the existing customer account with the new Company user. If the email is not associated with a customer account, a new one will be created with the Company user.

You can confirm if a particular email address is associated with a BigCommerce customer account by using the Validate a Frontend User Email endpoint.

Authentication

  • Authorization in header in the format of Bearer {{token}}

Parameters

  • companyId in path - string
    required
    The unique numeric ID of the Company account.

Body

object | application/json
  • firstName
    string
    required

    The user's first name.
    Example: Marie
  • lastName
    string
    required

    The user's last name.
    Example: Curie
  • userRole
    number
    required

    The ID of the role assigned to the Company user account as defined at Specifying User Role.

    Allowed: 0 | 1 | 2

    Example: 1
  • phone
    string
    required

    The phone number associated with the user's account.
    Example: 8001234567

example

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

example

Validate a Frontend User Email

GET /companies/validations/frontend/user-emails/{email}

Request

Checks if an email address is associated with a BigCommerce customer account and a Company user account.

Equivalent Storefront GraphQL API Query: userEmailCheck. For more information, see the GraphQL Playground.

The isValid value in the response indicates whether or not the email address is used by an existing customer or Company user. The following values are possible:

  • 0 — The email address is associated with a Company user account and a corresponding customer account.
  • 1 — The email address is not associated with a customer account or a Company user account.
  • 2 — The email address is associated with a customer account, but not a Company user account.

Authentication

  • Authorization in header in the format of Bearer {{token}}

Parameters

  • email in path - string
    required
    The email address of the user to be validated.
    Example: user@example.com
  • storeHash in query - string
    required
    The unique alphanumeric store hash for the BigCommerce store.
  • role in query - string
    required

    The ID of the role assigned to the Company user account as given below.

    ValueCode
    0Admin
    1Senior Buyer
    2Junior Buyer
    3Super Admin
    4Unknown

    Allowed: 0 | 1 | 2 | 3 | 4

  • companyId in query - string
    The unique numeric ID of the Company account.

example

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

example

Did you find what you were looking for?