Public APIs for Customer Groups

How to get the access key

After you install B2Bridge - B2B All in one, go to API and integration, fill out the form and submit your access request. We’ll review it and send the access key to your email.

Rule endpoints

There are fields of Customer Group rule, you need to understand:

  • id: If provided and matches an existing customer group, the group will be updated. If omitted or does not match any existing group, a new customer group will be created.

  • name*: Customer group name.

  • customer_tags*: A tag is necessary to differentiate B2B and B2C customers. Must start with the prefix "b2b-".

  • payment_options*

    • ONLINE: Pay online

    • NETTERM: Net payment term

  • pricing_rule_ids: IDs of the price list rules to assign to the customer group.

  • collect_tax

    • 0: Don't collect tax

    • 1: Collect tax

If the payment_options array includes NETTERM

  • nt_eligible

    • ON_RECEIPT: pay on receipt

    • CUSTOM: custom date net term

    • 7: pay after 7 days

    • 15: pay after 15 days

    • 30: pay after 30 days

    • 60: pay after 60 days

    • 90: pay after 90 days

  • nt_to_final_order

    • 0: Net Terms orders as draft orders

    • 1: Net Terms orders as final orders

  • nt_tag_order_enable

    • 0: disable

    • 1: enable

  • nt_tag_order_list

  • nt_time_custom: Defaults to {"time": "DAY", "value": 1} if not provided. If specified, it must follow the structure

    • time: Must be one of "DAY", "WEEK", or "MONTH".

    • value : If time is "DAY" must be between 1 and 365. If time is "WEEK" or "MONTH" must be between 1 and 99.

Get all customer group by domain

GET https://b2bridge-public-api.b2bridge.io/api/v1/customer-groups/get-by-domain

Headers

KEY
VALUE

x-b2bridge-api-key

xxx

Params

KEY
VALUE

domain

abc.myshopify.com

Response 200

{
    "success": true,
    "message": "Get Customer Groups Successfully",
    "groups": [
        {
            "id": 1,
            "shop_id": 1,
            "name": "cg1",
            "customer_tags": "b2b-cus1",
            "pricing_rule_ids": "[1]",
            "payment_options": "[\"ONLINE\",\"NETTERM\"]",
            "nt_eligible": "ON_RECEIPT",
            "nt_limit_option": 0,
            "nt_limit_type": "QUANTITY",
            "nt_limit_value": "0",
            "nt_tag_order_enable": 0,
            "nt_tag_order_list": "[]",
            "nt_time_custom": "null",
            "nt_to_final_order": 0,
            "customer_ids": "[\"7875968794841\",\"7881979887833\"]",
            "collect_tax": 0,
            "nt_form_id": null,
            "created_at": "2025-05-23T04:46:48.149Z",
            "updated_at": null,
            "customerGroupPricing": [
                {
                    "pricing_rule_id": 1,
                    "customer_group_id": 1,
                    "shop_id": 1,
                    "created_at": "2025-05-23T04:46:48.154Z",
                    "updated_at": null,
                    "pricingListRules": {
                        "id": 1,
                        "name": "pl1"
                    }
                }
            ]
        }
    ]
}

Get customer group by id

GET https://b2bridge-public-api.b2bridge.io/api/v1/customer-groups/get-by-id

Headers

KEY
VALUE

x-b2bridge-api-key

xxx

Params

KEY
VALUE

domain

abc.myshopify.com

id

1

Response 200

{
    "success": true,
    "message": "Get Customer Group By Id Successfully",
    "group": {
        "id": 1,
        "shop_id": 1,
        "name": "cg1",
        "customer_tags": "b2b-cus1",
        "pricing_rule_ids": "[1]",
        "payment_options": "[\"ONLINE\",\"NETTERM\"]",
        "nt_eligible": "ON_RECEIPT",
        "nt_limit_option": 0,
        "nt_limit_type": "QUANTITY",
        "nt_limit_value": "0",
        "nt_tag_order_enable": 0,
        "nt_tag_order_list": "[]",
        "nt_time_custom": "null",
        "nt_to_final_order": 0,
        "customer_ids": "[\"7875968794841\",\"7881979887833\"]",
        "collect_tax": 0,
        "nt_form_id": null,
        "created_at": "2025-05-23T04:46:48.149Z",
        "updated_at": null,
        "customerGroupPricing": [
            {
                "pricing_rule_id": 1,
                "customer_group_id": 1,
                "shop_id": 1,
                "created_at": "2025-05-23T04:46:48.154Z",
                "updated_at": null,
                "pricingListRules": {
                    "id": 1,
                    "name": "pl1"
                }
            }
        ]
    }
}

Save or update customer group

  • If the id field is not provided in the customer group, it will be treated as a new customer group.

  • If the id field is provided and matches an existing, it will be treated as an update to that existing customer group.

POST https://b2bridge-public-api.b2bridge.io/api/v1/customer-groups/save

Headers

KEY
VALUE

Content-Type

application/json

x-b2bridge-api-key

xxx

Body

{
    "domain": "abc.myshopify.com",
    "data": {
        "name": "cg6",
        "collect_tax": 1,
        "customer_ids": [
            "7875968794841"
        ],
        "customer_tags": "b2b-cus4",
        "payment_options": [
            "ONLINE",
            "NETTERM"
        ],
        "pricing_rule_ids": [],
        "nt_to_final_order":0,
        "nt_tag_order_enable": 0,
        "nt_eligible": "CUSTOM",
        "nt_time_custom": {
            "time": "DAY",
            "value": 1
        }
    }
}

Response 200

{
    "success": true,
    "message": "Created customer group successfully",
    "payload": {
        "id": 3
    }
}

Save multiple customer group

POST https://b2bridge-public-api.b2bridge.io/api/v1/customer-groups/bulk-save

Headers

KEY
VALUE

Content-Type

application/json

x-b2bridge-api-key

xxx

Body

{
    "domain": "abc.myshopify.com",
    "groups": [
        {
            "name": "cg7",
            "collect_tax": 1,
            "customer_ids": [
                "7875968794841"
            ],
            "customer_tags": "b2b-cus4",
            "payment_options": [
                "ONLINE"
            ],
            "pricing_rule_ids": []
        },
        {
            "id": 14,
            "name": "cg4",
            "collect_tax": 0,
            "customer_ids": [
                "7875968794841"
            ],
            "customer_tags": "b2b-cus3",
            "payment_options": [
                "ONLINE"
            ],
            "pricing_rule_ids": []
        }
    ]
}

Response 200

{
    "success": true,
    "message": [
        "Create new rule 'cg7' with ID 4 successfully",
        "Update rule ID 14 successfully"
    ]
}

Delete customer group

DELETE https://b2bridge-public-api.b2bridge.io/api/v1/customer-groups/delete-by-id

Headers

KEY
VALUE

x-b2bridge-api-key

xxx

Params

KEY
VALUE

domain

abc.myshopify.com

id

1

Response 200

{
    "success": true,
    "message": "Delete Customer Group Successfully"
}

Mass delete customer group

POST https://b2bridge-public-api.b2bridge.io/api/v1/customer-groups/mass-delete

Headers

KEY
VALUE

Content-Type

application/json

x-b2bridge-api-key

xxx

Body

{
    "domain": "abc.myshopify.com",
    "ids": [
        9,
        10
    ]
}

Response 200

{
    "success": true,
    "message": "Deleted customer groups successfully",
    "deleted": [
        9,
        10
    ],
    "failed": []
}

Last updated