Get Consent Sets by Onboarding ID
curl --request GET \
--url https://api.example.com/v2/consent/onboarding/{onboardingId}import requests
url = "https://api.example.com/v2/consent/onboarding/{onboardingId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v2/consent/onboarding/{onboardingId}', 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/onboarding/{onboardingId}",
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/onboarding/{onboardingId}"
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/onboarding/{onboardingId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v2/consent/onboarding/{onboardingId}")
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 Sets by Onboarding ID
Retrieve all consent sets associated with an onboarding ID
GET
/
v2
/
consent
/
onboarding
/
{onboardingId}
Get Consent Sets by Onboarding ID
curl --request GET \
--url https://api.example.com/v2/consent/onboarding/{onboardingId}import requests
url = "https://api.example.com/v2/consent/onboarding/{onboardingId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v2/consent/onboarding/{onboardingId}', 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/onboarding/{onboardingId}",
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/onboarding/{onboardingId}"
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/onboarding/{onboardingId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v2/consent/onboarding/{onboardingId}")
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 all consent sets associated with a specificonboardingId. Useful for recovering consent set information during registration flows.
This endpoint returns all consent sets created with the given
onboardingId, including those that may have already been linked to users.Endpoint
GET https://api.baanx.com/v2/consent/onboarding/{onboardingId}
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 |
|---|---|---|---|
onboardingId | string | ✅ | Onboarding identifier used during consent creation |
Response
200 OK
{
"onboardingId": "onboarding_abc123xyz",
"consentSets": [
{
"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"
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
]
}
],
"_links": {
"self": {
"href": "https://api.baanx.com/v2/consent/onboarding/onboarding_abc123xyz",
"method": "GET"
}
}
}
404 Not Found
{
"error": "Not found",
"details": [
"No consent sets found for onboardingId 'onboarding_abc123xyz'"
]
}
Code Examples
TypeScript
async function getConsentSetsByOnboardingId(onboardingId: string) {
const response = await fetch(
`https://api.baanx.com/v2/consent/onboarding/${onboardingId}`,
{
headers: {
'x-client-key': process.env.BAANX_CLIENT_KEY!
}
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(`Failed to retrieve consent sets: ${error.details.join(', ')}`);
}
return response.json();
}
const { consentSets } = await getConsentSetsByOnboardingId('onboarding_abc123xyz');
console.log(`Found ${consentSets.length} consent set(s)`);
Python
import requests
def get_consent_sets_by_onboarding_id(onboarding_id):
response = requests.get(
f'https://api.baanx.com/v2/consent/onboarding/{onboarding_id}',
headers={
'x-client-key': os.getenv('BAANX_CLIENT_KEY')
}
)
response.raise_for_status()
return response.json()
result = get_consent_sets_by_onboarding_id('onboarding_abc123xyz')
print(f"Found {len(result['consentSets'])} consent set(s)")
cURL
curl -X GET "https://api.baanx.com/v2/consent/onboarding/onboarding_abc123xyz" \
-H "x-client-key: your_client_key"
Use Cases
Session Recovery
Session Recovery
Recover consent set ID from onboarding ID:
async function recoverConsentSetId(onboardingId: string): Promise<string | null> {
try {
const { consentSets } = await getConsentSetsByOnboardingId(onboardingId);
if (consentSets.length === 0) {
return null;
}
return consentSets[0].consentSetId;
} catch (error) {
console.error('Failed to recover consent set:', error);
return null;
}
}
const consentSetId = await recoverConsentSetId('onboarding_abc123xyz');
Duplicate Detection
Duplicate Detection
Check if onboarding ID has already been used:
async function hasExistingConsent(onboardingId: string): Promise<boolean> {
try {
const { consentSets } = await getConsentSetsByOnboardingId(onboardingId);
return consentSets.length > 0;
} catch (error) {
if (error.status === 404) {
return false;
}
throw error;
}
}
Link Status Check
Link Status Check
Verify if consent set has been linked:
async function isOnboardingComplete(onboardingId: string): Promise<boolean> {
const { consentSets } = await getConsentSetsByOnboardingId(onboardingId);
return consentSets.some(cs => cs.userId !== null && cs.completedAt !== null);
}
Related Endpoints
Get by Consent Set ID
Retrieve specific consent set
Link User to Consent
Link userId to consent set
Create Onboarding Consent
Create new consent set with onboarding ID
Was this page helpful?
⌘I