Skip to main content
GET
/
v2
/
consent
/
consentSet
/
{consentSetId}

Overview

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

HeaderRequiredDescription
x-client-keyYour public API key
x-us-envSet to true for US region routing

Path Parameters

ParameterTypeRequiredDescription
consentSetIdstring (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

FieldTypeDescription
consentSetIdstring (UUID)Unique identifier for this consent set
userIdstring|nullUser identifier (null if not yet linked)
onboardingIdstringTemporary onboarding identifier
tenantIdstringTenant identifier
policyTypestringPolicy type: global or US
completedAtstring|nullWhen user was linked (null if pending)
createdAtstring (ISO 8601)When consent set was created
updatedAtstring (ISO 8601)Last update timestamp
consentsarrayArray 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

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;
}
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;
}