Get Consent Set by ID
curl --request GET \
--url https://api.example.com/v2/consent/consentSet/{consentSetId}import requests
url = "https://api.example.com/v2/consent/consentSet/{consentSetId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v2/consent/consentSet/{consentSetId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v2/consent/consentSet/{consentSetId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v2/consent/consentSet/{consentSetId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v2/consent/consentSet/{consentSetId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v2/consent/consentSet/{consentSetId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyConsent
Get Consent Set by ID
Retrieve a specific consent set with all consent records
GET
/
v2
/
consent
/
consentSet
/
{consentSetId}
Get Consent Set by ID
curl --request GET \
--url https://api.example.com/v2/consent/consentSet/{consentSetId}import requests
url = "https://api.example.com/v2/consent/consentSet/{consentSetId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v2/consent/consentSet/{consentSetId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v2/consent/consentSet/{consentSetId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v2/consent/consentSet/{consentSetId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v2/consent/consentSet/{consentSetId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v2/consent/consentSet/{consentSetId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyOverview
Retrieves a specific consent set by its UUID, including all consent records with detailed metadata.Use this endpoint when you have a
consentSetId and need to retrieve the complete consent set details.Endpoint
GET https://api.baanx.com/v2/consent/consentSet/{consentSetId}
Headers
| Header | Required | Description |
|---|---|---|
x-client-key | ✅ | Your public API key |
x-us-env | ❌ | Set to true for US region routing |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
consentSetId | string (UUID) | ✅ | UUID of the consent set to retrieve |
Response
200 OK
{
"consentSetId": "550e8400-e29b-41d4-a716-446655440001",
"userId": "user_123abc456def",
"onboardingId": "onboarding_abc123xyz",
"tenantId": "tenant_baanx_prod",
"policyType": "global",
"completedAt": "2024-01-15T10:35:00Z",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:35:00Z",
"consents": [
{
"consentId": "consent_001",
"consentType": "eSignAct",
"consentStatus": "granted",
"metadata": {
"timestamp": "2024-01-15T10:30:00Z",
"ipAddress": "192.168.1.1",
"userAgent": "Mozilla/5.0..."
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
},
{
"consentId": "consent_002",
"consentType": "termsAndPrivacy",
"consentStatus": "granted",
"metadata": {
"timestamp": "2024-01-15T10:30:00Z"
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
],
"_links": {
"self": {
"href": "https://api.baanx.com/v2/consent/consentSet/550e8400-e29b-41d4-a716-446655440001",
"method": "GET"
},
"audit": {
"href": "https://api.baanx.com/v2/consent/user/user_123abc456def/audit",
"method": "GET"
}
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
consentSetId | string (UUID) | Unique identifier for this consent set |
userId | string|null | User identifier (null if not yet linked) |
onboardingId | string | Temporary onboarding identifier |
tenantId | string | Tenant identifier |
policyType | string | Policy type: global or US |
completedAt | string|null | When user was linked (null if pending) |
createdAt | string (ISO 8601) | When consent set was created |
updatedAt | string (ISO 8601) | Last update timestamp |
consents | array | Array of consent records |
404 Not Found
{
"error": "Not found",
"details": [
"Consent set with ID '550e8400-e29b-41d4-a716-446655440001' not found"
]
}
Code Examples
TypeScript
async function getConsentSetById(consentSetId: string) {
const response = await fetch(
`https://api.baanx.com/v2/consent/consentSet/${consentSetId}`,
{
headers: {
'x-client-key': process.env.BAANX_CLIENT_KEY!
}
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(`Failed to retrieve consent set: ${error.details.join(', ')}`);
}
return response.json();
}
const consentSet = await getConsentSetById('550e8400-e29b-41d4-a716-446655440001');
console.log(`Consent set for user: ${consentSet.userId}`);
console.log(`Total consents: ${consentSet.consents.length}`);
Python
import requests
def get_consent_set_by_id(consent_set_id):
response = requests.get(
f'https://api.baanx.com/v2/consent/consentSet/{consent_set_id}',
headers={
'x-client-key': os.getenv('BAANX_CLIENT_KEY')
}
)
response.raise_for_status()
return response.json()
consent_set = get_consent_set_by_id('550e8400-e29b-41d4-a716-446655440001')
print(f"User: {consent_set['userId']}")
print(f"Policy: {consent_set['policyType']}")
cURL
curl -X GET "https://api.baanx.com/v2/consent/consentSet/550e8400-e29b-41d4-a716-446655440001" \
-H "x-client-key: your_client_key"
Use Cases
Verify Linking Status
Verify Linking Status
Check if a consent set has been linked to a user:
async function isConsentSetLinked(consentSetId: string): Promise<boolean> {
const consentSet = await getConsentSetById(consentSetId);
return consentSet.userId !== null && consentSet.completedAt !== null;
}
Retrieve Specific Consent
Retrieve Specific Consent
Find a specific consent within the set:
async function getSpecificConsent(
consentSetId: string,
consentType: string
) {
const consentSet = await getConsentSetById(consentSetId);
return consentSet.consents.find(c => c.consentType === consentType);
}
const marketingConsent = await getSpecificConsent(
'550e8400-e29b-41d4-a716-446655440001',
'marketingNotifications'
);
Policy Verification
Policy Verification
Verify the policy type for a consent set:
async function verifyPolicyType(
consentSetId: string,
expectedPolicy: 'global' | 'US'
): Promise<boolean> {
const consentSet = await getConsentSetById(consentSetId);
return consentSet.policyType === expectedPolicy;
}
Related Endpoints
Get by Onboarding ID
Retrieve consent sets by onboarding ID
Get User Consent Status
Get consent status by userId
Link User to Consent
Link userId to this consent set
Was this page helpful?
⌘I