Create Onboarding Consent
Consent
Create Onboarding Consent
Create a new consent set during user onboarding before a userId exists
POST
Create Onboarding Consent
Documentation Index
Fetch the complete documentation index at: https://docs.baanx.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Creates a new consent set during user onboarding using theonboardingId from the registration flow. This endpoint is typically called after personal details submission and before address submission during the registration flow.
Use Cases
Mobile App Registration
Collect consent during mobile app onboarding flows
Web Registration
Capture consent on web registration forms
KYC Processes
Record consent during identity verification
Pre-Registration Consent
Collect consent before user account creation
Endpoint
Headers
| Header | Required | Description |
|---|---|---|
x-client-key | ✅ | Your public API key |
x-secret-key | ✅ | Your secret API key (keep secure) |
Content-Type | ✅ | Must be application/json |
x-us-env | ❌ | Set to true for US region routing |
Request Body
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
onboardingId | string | ✅ | Unique temporary identifier for this onboarding session |
tenantId | string | ✅ | Your tenant identifier (provided by Baanx) |
policyType | string | ✅ | Policy type: global or US |
consents | array | ✅ | Array of consent items to record (min 1 item) |
metadata | object | ❌ | Additional metadata about the consent capture session |
Consent Item Structure
| Field | Type | Required | Description |
|---|---|---|---|
consentType | string | ✅ | Type of consent (see Consent Types) |
consentStatus | string | ✅ | Status: granted or denied |
metadata | object | ❌ | Additional context for this specific consent |
Consent Types
| Type | Description | Required In |
|---|---|---|
eSignAct | Electronic signature agreement (E-Sign Act compliance) | US policy only |
termsAndPrivacy | Terms of service and privacy policy | All policies |
marketingNotifications | Marketing communications opt-in | All policies |
smsNotifications | SMS/text message notifications | All policies |
emailNotifications | Email notifications | All policies |
Metadata Fields (Optional)
| Field | Type | Description |
|---|---|---|
ipAddress | string | User’s IP address at time of consent |
userAgent | string | Browser/device user agent string |
timestamp | string | ISO 8601 timestamp when consent was captured |
clientId | string | Client application identifier |
version | string | API or app version |
Additional custom fields can be included in
metadata. All fields must be JSON-serializable.Examples
US Policy (All 5 Consents)
Global Policy (4 Consents, No eSignAct)
Response
201 Created
Success Response:| Field | Type | Description |
|---|---|---|
consentSetId | string (UUID) | Generated unique identifier for this consent set |
onboardingId | string | Your provided onboarding identifier |
tenantId | string | Your tenant identifier |
createdAt | string (ISO 8601) | Timestamp when consent set was created |
_links | object | HATEOAS links for related resources |
Store the
consentSetId: You’ll need this to link the user after account creation completes.400 Bad Request - Missing Required Consents
- US Policy: All 5 types (including
eSignActfor E-Sign Act compliance) - Global Policy: 4 types (excludes
eSignAct)
400 Bad Request - Invalid Consent Type
409 Conflict - Duplicate Onboarding ID
onboardingId has already been used.
Solution: Generate a new unique onboardingId and retry.
498 Invalid Client Key
499 Missing Client Key
x-client-key header.
Validation Rules
Onboarding ID Requirements
Onboarding ID Requirements
- Must be the
onboardingIdfrom registration email verification - Do NOT generate a new ID - use the ID from
POST /v1/auth/register/email/verify - Format: UUID string (e.g.,
100a99cf-f4d3-4fa1-9be9-2e9828b20ebb)
Policy Type Requirements
Policy Type Requirements
US Policy requires all 5 consent types (E-Sign Act compliance):
eSignAct(required for E-Sign Act compliance)termsAndPrivacymarketingNotificationssmsNotificationsemailNotifications
eSignAct):termsAndPrivacymarketingNotificationssmsNotificationsemailNotifications
Consent Status Values
Consent Status Values
Only two status values are valid for creation:
granted: User has provided consentdenied: User has explicitly refused consent
Both
granted and denied are acceptable. However, if required consents are denied, the user’s overall consent status will be incomplete.Metadata Best Practices
Metadata Best Practices
Include these fields for comprehensive audit trails:All values must be JSON-serializable (no functions, circular references, or undefined).
Code Examples
TypeScript
Python
cURL
Next Steps
After creating the consent set:- Store the
consentSetId: You’ll need it to link the user later - Complete user registration: Finalize account creation in your system
- Link user to consent: Call Link User to Consent Set
Related Endpoints
Link User to Consent
Associate userId with consent set after registration
Get User Consent Status
Check user’s consent status
Get Consent Audit Trail
Retrieve complete consent change history
Implementation Guide
Full integration guide with examples