Skip to content

Consents

Manage GDPR and privacy consents for your customers. Handle consent collection, tracking, and compliance with data protection regulations. Create required and optional consent types for terms of service, marketing communications, and data processing.

Basic CRUD Actions

Get Consents listing

View on Postman

Get a list of all consent types.

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

Client.API.Core.Consents.all().then((response:Response<Consents>) => {
    response.resource.forEach((consent) => {
        console.log(consent.id, consent.name, consent.required);
    });
});
PHP
$consents = $client->API->Core->Consents->all();
View on Postman

Create a new consent type.

JS
const payload = {
    name: 'Marketing Communications',
    description: 'Consent for promotional emails and offers',
    required: false
};
let consent = await Client.API.Core.Consents.create(payload);
TS
import { Response, Consent, CreateConsentPayload } from "@tscommerce/sdk-typescript"

const payload:CreateConsentPayload = {
    name: 'Marketing Communications',
    description: 'Consent for promotional emails and offers',
    required: false
};

Client.API.Core.Consents.create(payload).then((response:Response<Consent>) => {
    console.log('Created consent:', response.resource);
});
PHP
$payload = [
    'name' => 'Marketing Communications',
    'description' => 'Consent for promotional emails and offers',
    'required' => false
];
$consent = $client->API->Core->Consents->create($payload);
View on Postman

Get an existing consent type by ID.

JS
const consentId = 123;
let consent = await Client.API.Core.Consents.read(consentId);
TS
import { Response, Consent } from "@tscommerce/sdk-typescript"

const consentId:Consent['id'] = 123;
Client.API.Core.Consents.read(consentId).then((response:Response<Consent>) => {
    console.log('Consent:', response.resource);
});
PHP
$consentId = 123;
$consent = $client->API->Core->Consents->read($consentId);
View on Postman

Update an existing consent type.

JS
const consentId = 123;
const payload = {
    description: 'Updated consent description'
};
let consent = await Client.API.Core.Consents.update(consentId, payload);
TS
import { Response, Consent, UpdateConsentPayload } from "@tscommerce/sdk-typescript"

const consentId:Consent['id'] = 123;
const payload:UpdateConsentPayload = {
    description: 'Updated consent description'
};

Client.API.Core.Consents.update(consentId, payload).then((response:Response<Consent>) => {
    console.log('Updated consent:', response.resource);
});
PHP
$consentId = 123;
$payload = ['description' => 'Updated consent description'];
$consent = $client->API->Core->Consents->update($consentId, $payload);
View on Postman

Delete a consent type.

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

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

Duplication

View on Postman

Create a copy of an existing consent type.

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

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

Bulk Actions

Bulk delete Consents

View on Postman

Delete multiple consent types at once.

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

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

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

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