Skip to content

Groups

Manage customer groups and segments for targeted marketing, pricing strategies, and special benefits. Create VIP tiers, wholesale groups, and custom segments with specific discounts and permissions.

Basic CRUD Actions

Get Groups listing

View on Postman

Get a list of all customer groups.

JS
let groups = await Client.API.Core.Groups.all();
TS
import { Response, Groups } from "@tscommerce/sdk-typescript"

Client.API.Core.Groups.all().then((response:Response<Groups>) => {
    response.resource.forEach((group) => {
        console.log(group.id, group.name);
    });
});
PHP
$groups = $client->API->Core->Groups->all();

Create new Group

View on Postman

Create a new customer group.

JS
const payload = {
    name: 'VIP Customers',
    description: 'Premium customers with special benefits',
    discount_percentage: 10
};
let group = await Client.API.Core.Groups.create(payload);
TS
import { Response, Group, CreateGroupPayload } from "@tscommerce/sdk-typescript"

const payload:CreateGroupPayload = {
    name: 'VIP Customers',
    description: 'Premium customers with special benefits',
    discount_percentage: 10
};

Client.API.Core.Groups.create(payload).then((response:Response<Group>) => {
    console.log('Created group:', response.resource);
});
PHP
$payload = [
    'name' => 'VIP Customers',
    'description' => 'Premium customers with special benefits',
    'discount_percentage' => 10
];
$group = $client->API->Core->Groups->create($payload);

Get Group

View on Postman

Get an existing customer group by ID.

JS
const groupId = 123;
let group = await Client.API.Core.Groups.read(groupId);
TS
import { Response, Group } from "@tscommerce/sdk-typescript"

const groupId:Group['id'] = 123;
Client.API.Core.Groups.read(groupId).then((response:Response<Group>) => {
    console.log('Group:', response.resource);
});
PHP
$groupId = 123;
$group = $client->API->Core->Groups->read($groupId);

Update Group

View on Postman

Update an existing customer group.

JS
const groupId = 123;
const payload = {
    discount_percentage: 15
};
let group = await Client.API.Core.Groups.update(groupId, payload);
TS
import { Response, Group, UpdateGroupPayload } from "@tscommerce/sdk-typescript"

const groupId:Group['id'] = 123;
const payload:UpdateGroupPayload = {
    discount_percentage: 15
};

Client.API.Core.Groups.update(groupId, payload).then((response:Response<Group>) => {
    console.log('Updated group:', response.resource);
});
PHP
$groupId = 123;
$payload = ['discount_percentage' => 15];
$group = $client->API->Core->Groups->update($groupId, $payload);

Delete Group

View on Postman

Delete a customer group.

JS
const groupId = 123;
Client.API.Core.Groups.delete(groupId);
TS
import { Response, Group } from "@tscommerce/sdk-typescript"

const groupId:Group['id'] = 123;
Client.API.Core.Groups.delete(groupId).then((response:Response) => {
    console.log('Group deleted successfully');
});
PHP
$groupId = 123;
$client->API->Core->Groups->delete($groupId);

Duplication

Duplicate Group

View on Postman

Create a copy of an existing customer group.

JS
const groupId = 123;
let duplicate = await Client.API.Core.Groups.duplicate(groupId);
TS
import { Response, Group } from "@tscommerce/sdk-typescript"

const groupId:Group['id'] = 123;
Client.API.Core.Groups.duplicate(groupId).then((response:Response<Group>) => {
    console.log('Duplicated group ID:', response.resource.id);
});
PHP
$groupId = 123;
$duplicate = $client->API->Core->Groups->duplicate($groupId);

Bulk Actions

Bulk delete Groups

View on Postman

Delete multiple customer groups at once.

JS
const groupIds = [123, 456, 789];
Client.API.Core.Groups.bulkDelete({ ids: groupIds });
TS
import { Response, BulkDeleteGroupPayload } from "@tscommerce/sdk-typescript"

const payload:BulkDeleteGroupPayload = {
    ids: [123, 456, 789]
};

Client.API.Core.Groups.bulkDelete(payload).then((response:Response) => {
    console.log('Groups deleted successfully');
});
PHP
$payload = ['ids' => [123, 456, 789]];
$client->API->Core->Groups->bulkDelete($payload);

Search Groups

View on Postman

Search customer groups by name or attributes.

JS
const query = 'VIP';
let results = await Client.API.Core.Groups.search({ query });
TS
import { Response, Groups, SearchGroupsPayload } from "@tscommerce/sdk-typescript"

const payload:SearchGroupsPayload = {
    query: 'VIP'
};

Client.API.Core.Groups.search(payload).then((response:Response<Groups>) => {
    response.resource.forEach((group) => {
        console.log(group.name);
    });
});
PHP
$payload = ['query' => 'VIP'];
$results = $client->API->Core->Groups->search($payload);

Group Customers

Get Group Customers

View on Postman

Get all customers assigned to a specific group.

JS
const groupId = 123;
let customers = await Client.API.Core.Groups.getCustomers(groupId);
TS
import { Response, Customers, Group } from "@tscommerce/sdk-typescript"

const groupId:Group['id'] = 123;
Client.API.Core.Groups.getCustomers(groupId).then((response:Response<Customers>) => {
    response.resource.forEach((customer) => {
        console.log(customer.id, customer.email);
    });
});
PHP
$groupId = 123;
$customers = $client->API->Core->Groups->getCustomers($groupId);

Assign Customers to Group

View on Postman

Add customers to a group for targeted benefits and pricing.

JS
const groupId = 123;
const customerIds = [456, 789, 101];
Client.API.Core.Groups.assignCustomers(groupId, { customer_ids: customerIds });
TS
import { Response, Group, AssignCustomersToGroupPayload } from "@tscommerce/sdk-typescript"

const groupId:Group['id'] = 123;
const payload:AssignCustomersToGroupPayload = {
    customer_ids: [456, 789, 101]
};

Client.API.Core.Groups.assignCustomers(groupId, payload).then((response:Response) => {
    console.log('Customers assigned successfully');
});
PHP
$groupId = 123;
$payload = ['customer_ids' => [456, 789, 101]];
$client->API->Core->Groups->assignCustomers($groupId, $payload);

Remove Customers from Group

View on Postman

Remove customers from a group.

JS
const groupId = 123;
const customerIds = [456, 789];
Client.API.Core.Groups.removeCustomers(groupId, { customer_ids: customerIds });
TS
import { Response, Group, RemoveCustomersFromGroupPayload } from "@tscommerce/sdk-typescript"

const groupId:Group['id'] = 123;
const payload:RemoveCustomersFromGroupPayload = {
    customer_ids: [456, 789]
};

Client.API.Core.Groups.removeCustomers(groupId, payload).then((response:Response) => {
    console.log('Customers removed successfully');
});
PHP
$groupId = 123;
$payload = ['customer_ids' => [456, 789]];
$client->API->Core->Groups->removeCustomers($groupId, $payload);

Copyright © 2025-2025 TeamSystem S.p.A. - Built with ❤️ by TeamSystem Commerce