Storefront APIs
Addresses

Addresses

Get Countries List

GET /companies/addresses/countries

Request

Returns a list of all countries and, if applicable, their states. The response includes the name and code of each returned element and the id of each country.

NOTE: Due to the size of the list returned, the results should be cached for continued use, if possible.

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

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

curl --request GET \
--url https://api-b2b.bigcommerce.com/api/v2/companies/addresses/countries \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json'

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

example

{
"message": "string",
"code": 200,
"data": {
"list": [
{
"id": 226,
"countryName": "United States",
"countryCode": "US",
"states": [
{
"stateName": "Texas",
"stateCode": "TX"
}
]
}
]
}
}

Get Address Edit Permission

GET /companies/addresses/permission

Request

Checks whether or not the storefront allows Company users to modify addresses. This corresponds with the Address book management settings in the B2B Edition control panel. See B2B Edition Settings in the Help Center to learn more.

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

Authentication

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

example

curl --request GET \
--url https://api-b2b.bigcommerce.com/api/v2/companies/addresses/permission \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json'

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

example

{
"message": "string",
"code": 200,
"data": {
"isAllow": "1",
"isEnabled": "1"
}
}

Get a Company Address List

GET /companies/{companyId}/addresses

Request

Returns the billing and shipping addresses associated with a particular Company account.

Equivalent Storefront GraphQL API Query: addresses. 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.

example

curl --request GET \
--url 'https://api-b2b.bigcommerce.com/api/v2/companies/[companyId]/addresses' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json'

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

200 - SUCCESS

{
"addresses": {
"27": {
"addressId": 27,
"firstName": "Marie",
"lastName": "Curie",
"isShipping": 1,
"isBilling": 0,
"phoneNumber": "8001234567",
"addressLine1": "11305 Four Points Drive",
"addressLine2": "Building 2",
"city": "Austin",
"state": {
"stateName": "Texas",
"stateCode": "TX"
},
"zipCode": "78726",
"country": {
"countryName": "United States",
"countryCode": "US"
},
"extraFields": [
{
"fieldName": "Company Tax Code",
"fieldValue": "Code G"
}
]
}
},

Create a Company Address

POST /companies/{companyId}/addresses

Request

Creates an address for a Company account, if address book management is enabled for your storefront. You can designate whether the address is for shipping, billing, or both.

Equivalent Storefront GraphQL API Mutation: addressCreate. 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.

Body

object | application/json
Extra Field Values
  • firstName
    string
    required

    The first name of the address.
    Example: Marie
  • isShipping
    string

    Indicates whether the address can be used as a shipping address.
    Example: 1
  • isBilling
    string

    Indicates whether the address can be used as a billing address.
    Example: 1
  • phoneNumber
    string

    The phone number associated with the address.
    Example: 8001234567
  • addressLine1
    string
    required

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

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

    City of the address.
    Example: Austin
  • zipCode
    string

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

    State of the address as an object with both the name and the two-character code.
  • country
    object
    required

    Country of the address as an object with both the name and the two-character code.
  • isDefaultShipping
    string

    Indicates whether the address is the default shipping address for the Company account.
    Example: 1
  • isDefaultBilling
    string

    Indicates whether the address is the default billing address for the Company account.
    Example: 1
  • label
    string

    The label used on the storefront to identify the address.
    Example: Austin Warehouse
  • extraFields
    array[object]

Create an Address

{
"label": "Austin Warehouse",
"firstName": "Marie",
"isShipping": "1",
"isBilling": "0",
"isDefaultShipping": "0",
"isDefaultBilling": "0",
"phoneNumber": "8001234567",
"addressLine1": "11305 Four Points Drive",
"addressLine2": "Building 2",
"city": "Austin",
"state": {
"stateName": "Texas",
"stateCode": "TX"
},
"zipCode": "78726",
"country": {
"countryName": "United States",
"countryCode": "US"
},
"extraFields": [
{
"fieldName": "Company Tax Code",
"fieldValue": "Code G"
}
]
}

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

example

{
"message": "string",
"code": 200,
"data": {
"addressId": "27"
}
}

Search Company Addresses

GET /companies/{companyId}/addresses/searches

Request

Returns all addresses associated with a Company account that match the query string q

Equivalent Storefront GraphQL API Query: addresses. 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.
  • q in query - string
    The search string for the request.
  • limit in query - string
    required
    The total number of items per page of the response.
  • offset in query - string
    required
    The number of items to skip before the current page of the response.

example

curl --request GET \
--url 'https://api-b2b.bigcommerce.com/api/v2/companies/[companyId]/addresses/searches' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json'

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

example

{
"message": "string",
"code": 200,
"data": {
"addressBookStatus": "string",
"defaultAddress": {
"companyId": "123456",
"companyName": "Great Buys",
"companyAddress": "11305 Four Points Drive, Building 2",
"companyCity": "Austin",
"companyState": "Texas",
"companyStateCode": "TX",
"companyZipCode": "78726",
"companyCountry": "United States",
"companyCountryCode": "US",
"firstName": "Marie",
"lastName": "Curie",
"phoneNumber": "8001234567",
"label": "Austin Warehouse"
},
"list": [
{
"companyId": "123456",
"companyName": "Great Buys",
"companyAddress": "11305 Four Points Drive, Building 2",

Search Addresses with Multiple Filters

POST /companies/{companyId}/addresses/searches

Request

Returns one or more Company addresses based on the filter parameters. You can use this to make refined searches, such as locating a particular address by its label or viewing all addresses in a specific country.

Equivalent Storefront GraphQL API Query: addresses. 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.

Body

object | application/json
  • filters
    object

  • offset
    number

    Pagination offset for the results.
  • limit
    number

    Pagination limit for the results.
    Example: 10
  • q
    string

    The search string for the request. Its value determines the results returned by the request.
    Example: United States

example

{
"filters": {
"firstName": "Marie",
"lastName": "Curie",
"city": "Austin",
"phoneNumber": "8001234567",
"zipCode": "78726",
"label": "Austin Warehouse",
"address": "string",
"state": "Texas",
"country": "United States",
"addressType": {
"isBilling": "1",
"isShipping": "1"
}
},
"offset": 0,
"limit": 10,
"q": "United States"
}

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

Search Addresses

{
"code": 200,
"message": "Success",
"data": {
"list": [
{
"addressId": "27",
"label": "Austin Warehouse",
"firstName": "Marie",
"LastName": "Curie",
"addressLine1": "11305 Four Points Drive",
"addressLine2": "Building 2",
"city": "Austin",
"state": {
"stateName": "Texas",
"stateCode": "TX"
},
"zipCode": "78726",
"country": {
"countryName": "United States",
"countryCode": "US"
},
"phoneNumber": "8001234567",
"extraFields": [
{
"fieldName": "Company Tax Code",

Get an Address

GET /companies/{companyId}/addresses/{addressId}

Request

Returns a specific address based on the companyId and addressId in the path.

Equivalent Storefront GraphQL API Query: address. 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.
  • addressId in path - string
    required
    The unique ID of the address.

example

curl --request GET \
--url 'https://api-b2b.bigcommerce.com/api/v2/companies/[companyId]/addresses/[addressId]' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json'

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

    Extra Field Values
    Example: {"extraFields":[{"fieldName":"string","fieldValue":"string"}]}

Create an Address

{
"addressId": "27",
"label": "Austin Warehouse",
"firstName": "Marie",
"lastName": "Curie",
"isShipping": "1",
"isBilling": "0",
"isDefaultShipping": "0",
"isDefaultBilling": "0",
"phoneNumber": "8001234567",
"addressLine1": "11305 Four Points Drive",
"addressLine2": "Building 2",
"city": "Austin",
"state": {
"stateName": "Texas",
"stateCode": "TX"
},
"zipCode": "78726",
"country": {
"countryName": "United States",
"countryCode": "US"
},
"extraFields": [
{
"fieldName": "Company Tax Code",
"fieldValue": "Code G"
}
]
}

Update Address Information

PUT /companies/{companyId}/addresses/{addressId}

Request

Updates the details of a billing or shipping address, if address book management is enabled for your storefront.

Equivalent Storefront GraphQL API Mutation: addressUpdate. 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.
  • addressId in path - string
    required
    The unique ID of the address.

Body

object | application/json
Extra Field Values
  • firstName
    string
    required

    The first name of the address.
    Example: Marie
  • isShipping
    string
    required

    Indicates whether the address can be used as a shipping address.
    Example: 1
  • isBilling
    string
    required

    Indicates whether the address can be used as a billing address.
    Example: 1
  • phoneNumber
    string
    required

    The phone number associated with the address.
    Example: 8001234567
  • 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
    object
    required

    State of the address as an object with both the name and the two-character code.
  • country
    object
    required

    Country of the address as an object with both the name and the two-character code.
  • addressId
    string
    required

    The unique ID of the address.
    Example: 27
  • lastName
    string
    required

    The last name of the address.
    Example: Curie
  • isDefaultShipping
    string
    required

    Indicates whether the address is the default shipping address for the Company account.
    Example: 1
  • isDefaultBilling
    string
    required

    Indicates whether the address is the default billing address for the Company account.
    Example: 1
  • label
    string
    required

    The label used on the storefront to identify the address.
    Example: Austin Warehouse
  • extraFields
    array[object]

Create an Address

{
"addressId": "27",
"label": "Austin Warehouse",
"firstName": "Marie",
"lastName": "Curie",
"isShipping": "1",
"isBilling": "0",
"isDefaultShipping": "0",
"isDefaultBilling": "0",
"phoneNumber": "8001234567",
"addressLine1": "11305 Four Points Drive",
"addressLine2": "Building 2",
"city": "Austin",
"state": {
"stateName": "Texas",
"stateCode": "TX"
},
"zipCode": "78726",
"country": {
"countryName": "United States",
"countryCode": "US"
},
"extraFields": [
{
"fieldName": "Company Tax Code",
"fieldValue": "Code G"
}
]
}

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

example

{
"message": "string",
"code": 200,
"data": {
"addressId": "27"
}
}

Mark an Address as Active or Inactive

PUT /companies/{companyId}/addresses/{addressId}/activation

Request

Specifies whether or not a Company account can use a particular address on quotes or at checkout.

Equivalent Storefront GraphQL API Mutation: addressDelete. 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.
  • addressId in path - string
    required
    The unique ID of the address.

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

example

{
"message": "string",
"code": 200,
"data": {
"addressId": "27"
}
}

Get Company Default Addresses

GET /companies/{companyId}/default-addresses

Request

Returns a Company’s default shipping and billing addresses. Use Update Address Information to change which addresses are set as the defaults.

Equivalent Storefront GraphQL API Query: defaultBillingAddress for the billing address and defaultShippingAddress for the shipping address. 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.

example

curl --request GET \
--url 'https://api-b2b.bigcommerce.com/api/v2/companies/[companyId]/default-addresses' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json'

Response

OK

Body

object | application/json
  • message
    string

  • code
    number

    Default: 200

  • data
    object

200 - SUCCESS

{
"code": 200,
"message": "Success",
"data": {
"shipping": {
"addressId": "27",
"label": "Austin Warehouse",
"firstName": "Marie",
"lastName": "Curie",
"phoneNumber": "8001234567",
"addressLine1": "11305 Four Points Drive",
"addressLine2": "Building 2",
"city": "Austin",
"state": {
"stateName": "Texas",
"stateCode": "TX"
},
"zipCode": "78726",
"country": {
"countryName": "United States",
"countryCode": "US"
},
"extraFields": [
{
"fieldName": "Company Tax Code",
"fieldValue": "Code G"
}
Did you find what you were looking for?