Server to Server Management APIs
User

User

BigCommerce B2B Edition Company User

Get a User

GET /users/{userId}

Request

Get a company user's information by user ID.

Authentication

  • authToken in header

Parameters

  • userId in path - integer
    required
    The unique numeric ID of this user.

example

curl --request GET \
--url 'https://api-b2b.bigcommerce.com/api/v3/io/users/[userId]' \
--header 'Content-Type: application/json' \
--header 'authToken: {{token}}'

Response

Response Success

Body

object | application/json
Response for successful request
  • code
    integer

    Response code of success request.
    Example: 200
  • meta
    object

  • data
    object

    Company user base model.
    Example: {"extraFields":[{"fieldName":"string","fieldValue":"string"}]}

example

{
"code": 200,
"meta": {
"message": "SUCCESS"
},
"data": {
"extraFields": [
{
"fieldName": "string",
"fieldValue": "string"
}
]
}
}

Update a User

PUT /users/{userId}

Request

Update a company user info

Authentication

  • authToken in header

Parameters

  • userId in path - integer
    required
    The unique numeric ID of this user.

Body

object | application/json
Company user base model.
  • id
    integer
    required
    read-only

    Unique numeric ID of this User. This is a READ-ONLY field; do not set or modify its value in a POST or PUT request.
    Example: 1
  • uuid
    string

    UUID of user
    Example: 095be615
  • createdAt
    integer
    read-only

    Create timestamp of the user
    Example: 1574999690
  • updatedAt
    integer
    read-only

    Update timestamp of the user
    Example: 1574999690
  • firstName
    string
    required

    First name of the user
    <= 150 characters
    Example: Tom
  • lastName
    string
    required

    Last name of the user
    <= 150 characters
    Example: Cat
  • phoneNumber
    string

    Phone number of the user
    <= 150 characters
    Example: 112233
  • role
    integer
    required

    User role (0=admin 1=senior_buyer 2=junior_buyer)

    Allowed: 0 | 1 | 2

    Example: 1
  • customerId
    integer
    read-only

    The BigCommerce customer ID
    Example: 12
  • extraFields
    array[object]

  • channelIds
    array[integer]

    BigCommerce channel ID list. Do not input this field if you don't want to update user channels.
  • companyRoleId
    integer

    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.

example-1

{
"id": 4,
"email": "string",
"firstName": "Tom",
"lastName": "Cat",
"phoneNumber": "112233",
"role": 1,
"uuid": "1e01472b-858f-49cd-be85-91aa0ae3bbc9"
}

Response

Updated successful

Body

object | application/json
Response for successful request
  • code
    integer

    Response code of success request.
    Example: 200
  • meta
    object

  • data
    object

    Company user base model.
    Example: {"extraFields":[{"fieldName":"string","fieldValue":"string"}]}

example-1

{
"code": 200,
"meta": {
"message": "SUCCESS"
},
"data": {
"id": 1,
"uuid": "095be615",
"createdAt": 1574999690,
"updatedAt": 1574999690,
"companyId": 2,
"email": "user@example.com",
"firstName": "Tom",
"lastName": "Cat",
"phoneNumber": "112233",
"role": 1,
"customerId": 12
}
}

Delete a User

DELETE /users/{userId}

Request

Delete a company user; if this user is the only administrator of the company, it will return a 500 Error.

Authentication

  • authToken in header

Parameters

  • userId in path - integer
    required
    The unique numeric ID of this user.

example

curl --request DELETE \
--url 'https://api-b2b.bigcommerce.com/api/v3/io/users/[userId]' \
--header 'Content-Type: application/json' \
--header 'authToken: {{token}}'

Response

Response Success

Body

object | application/json
Response for successful request
  • code
    integer

    Response code of success request.
    Example: 200
  • meta
    object

  • data
    object

example-1

{
"code": 200,
"meta": {
"message": "SUCCESS"
},
"data": {
"userId": 1
}
}

Get Users

GET /users

Request

Get company users, with pagination data

Authentication

  • authToken in header

Parameters

  • offset in query - integer
    Pagination offset default: 0
  • limit in query with default of 10 - integer
    Pagination limit default: 10
  • minModified in query - number
    Minimum modified timestamp
  • maxModified in query - number
    Maximum modified timestamp
  • minCreated in query - number
    Minimum created timestamp
  • maxCreated in query - number
    Maximum created timestamp
  • roles in query - array
    user roles(0=admin 1=senior_buyer 2=junior_buyer) e.g., role[]=1, 2. default empty to get all.
    Type: array[number]
  • companyId in query - integer
    Company ID
  • q in query - string
    User query string.Supported fields: email, e.g., ?q=xyz@abc.com
  • email in query - string
    Filter users accurately by email. Should be a correct email.
  • isIncludeExtraFields in query - string
    Is show extra fields in the response

    Allowed: 0 | 1

  • channelId in query - integer
    BigCommerce channel ID

example

curl --request GET \
--url https://api-b2b.bigcommerce.com/api/v3/io/users \
--header 'Content-Type: application/json' \
--header 'authToken: {{token}}'

Response

Response Success

Body

object | application/json
Response for successful request
  • code
    integer

    Response code of success request.
    Example: 200
  • meta
    object

    Used to response pagination information
    Example: {"pagination":{"limit":10,"offset":0,"totalCount":1}}
  • data
    array[object]

example

{
"code": 200,
"meta": {
"pagination": {
"limit": 10,
"offset": 0,
"totalCount": 1
}
},
"data": [
{
"extraFields": [
{
"fieldName": "string",
"fieldValue": "string"
}
]
}
]
}

Create a User

POST /users

Request

Create a company user within an existing company.

  • When you enable independent company behavior, B2B Edition company accounts are the source of truth for defining a company user’s customer group assignment. If no default customer group is configured or the set value of customerGroupId is 0, the B2B company will not be associated with any customer group. The company users will have their corresponding customer records assigned to No Group in BigCommerce.

  • When you turn off independent company behavior, the BigCommerce customer record's customer group assignment will be the source of truth for defining a company user's company assignment.

Authentication

  • authToken in header

Body

object | application/json
Extra Field Values
  • companyId
    integer
    required

    Company ID
    Example: 2
  • firstName
    string
    required

    First name of the user
    <= 150 characters
    Example: Tom
  • lastName
    string
    required

    Last name of the user
    <= 150 characters
    Example: Cat
  • phoneNumber
    string

    Phone number of the user
    <= 150 characters
    Example: 112233
  • role
    integer
    required

    User role (0=admin 1=senior_buyer 2=junior_buyer)

    Allowed: 0 | 1 | 2

    Example: 1
  • customerId
    integer
    read-only

    The BigCommerce customer ID
    Example: 12
  • acceptWelcomeEmail
    boolean

    If the user accepts, send a welcome email.
  • uuid
    string

    UUID of user
  • channelIds
    array[integer]

    BigCommerce channel ID
  • originChannelId
    integer

    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

    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 role field.
  • extraFields
    array[object]

example-1

{
"companyId": 2,
"email": "user@example.com",
"firstName": "Tom",
"lastName": "Cat",
"phoneNumber": "112233",
"role": 1,
"acceptWelcomeEmail": true,
"uuid": "1e01472b-858f-49cd-be85-91aa0ae3bbc9",
"channelIds": [
1
],
"originChannelId": 1,
"extraFields": [
{
"fieldName": "string",
"fieldValue": "string"
}
]
}

Response

Response Success

Body

object | application/json
Response for successful request
  • code
    integer

    Response code of success request.
    Example: 200
  • meta
    object

  • data
    object

example-1

{
"code": 200,
"data": {
"bcId": 1,
"userId": 2
},
"message": "success"
}

Bulk Create Company User

POST /users/bulk

Request

Create company users in batch. All of the user should be in same company.

  • When the independent company behavior is enabled, B2B Edition company accounts are the source of truth for defining a company user’s customer group assignment. If you do not configure a default customer group or the value of customerGroupId is 0, the B2B company will not be associated with any customer group, and the company users within the company will have their corresponding customer record assigned to "No Group" in BigCommerce.
    • When the independent company behavior is turned off, the BigCommerce customer record’s customer group assignment will be the source of truth for defining a company user’s company assignment.

Authentication

  • authToken in header
Whether the field is required, please refer to the Create User API.

Body

array | application/json
Request body
  • companyId
    integer
    required

    Company ID
    Example: 2
  • firstName
    string
    required

    First name of the user
    <= 150 characters
    Example: Tom
  • lastName
    string
    required

    Last name of the user
    <= 150 characters
    Example: Cat
  • phoneNumber
    string

    Phone number of the user
    <= 150 characters
    Example: 112233
  • role
    integer
    required

    User role (0=admin 1=senior_buyer 2=junior_buyer)

    Allowed: 0 | 1 | 2

    Example: 1
  • customerId
    integer
    read-only

    The BigCommerce customer ID
    Example: 12
  • acceptWelcomeEmail
    boolean

    (0=will not receive email 1=will receive email)
  • uuid
    string

    UUID of user
  • channelIds
    array[integer]

    BigCommerce channel ID list
  • originChannelId
    integer

    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

    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 role field.
  • extraFields
    array[object]

example-1

[
{
"companyId": 31,
"email": "user@example.com",
"firstName": "Tom",
"lastName": "Cat",
"phoneNumber": "112233",
"role": 1,
"acceptWelcomeEmail": true,
"uuid": "095be615",
"channelId": 1,
"extraFields": [
{
"fieldName": "string",
"fieldValue": "string"
}
]
}
]

Response

Response Success

Body

object | application/json
Response for successful request
  • code
    integer

    Response code of success request.
    Example: 200
  • meta
    object

  • data
    array[object]

example-1

{
"code": 200,
"meta": {
"message": "SUCCESS"
},
"data": [
{
"bcId": 1,
"userId": 2
},
{
"bcId": 2,
"userId": 3
}
]
}

Get a User by Customer ID

GET /users/customer/{customerId}

Request

Get a userʼs information by BigCommerce customer ID field.

Authentication

  • authToken in header

Parameters

  • customerId in path - integer
    required
    Customer ID of BigCommerce customer user.

example

curl --request GET \
--url 'https://api-b2b.bigcommerce.com/api/v3/io/users/customer/[customerId]' \
--header 'Content-Type: application/json' \
--header 'authToken: {{token}}'

Response

Response Success

Body

object | application/json
Response for successful request
  • code
    integer

    Response code of success request.
    Example: 200
  • meta
    object

  • data
    object

    Company user base model.
    Example: {"extraFields":[{"fieldName":"string","fieldValue":"string"}]}

example

{
"code": 200,
"meta": {
"message": "SUCCESS"
},
"data": {
"extraFields": [
{
"fieldName": "string",
"fieldValue": "string"
}
]
}
}

Get User Extra Field Configs

GET /users/extra-fields

Request

Get user extra field configs

Authentication

  • authToken in header

Parameters

  • limit in query with default of 10 - integer
    Pagination limit default: 10
  • offset in query - integer
    Pagination offset default: 0

example

curl --request GET \
--url https://api-b2b.bigcommerce.com/api/v3/io/users/extra-fields \
--header 'Content-Type: application/json' \
--header 'authToken: {{token}}'

Response

OK

Body

object | application/json
Response for successful request
  • code
    integer

    Response code of success request.
    Example: 200
  • meta
    object

    Used to response pagination information
    Example: {"pagination":{"limit":10,"offset":0,"totalCount":1}}
  • data
    array[object]

example

{
"code": 200,
"meta": {
"pagination": {
"limit": 10,
"offset": 0,
"totalCount": 1
}
},
"data": [
{
"id": 0,
"uuid": "string",
"fieldName": "string",
"fieldType": 0,
"isRequired": true,
"isUnique": true,
"visibleToEnduser": true,
"configType": 1,
"defaultValue": "string",
"maximumLength": "string",
"numberOfRows": "string",
"maximumValue": "string",
"listOfValue": [
"string"
]
}
]
}

See something you can improve? Edit this file on GitHub

Did you find what you were looking for?