Skip to content

Fetch asset ID

An asset represents a website or application registered in truConsent (e.g. “Main Marketing Website”). You need its assetId to mount TruConsentModal.

Use your VITE_TRU_CONSENT_ADMIN_API_KEY and VITE_TRU_CONSENT_ORGANIZATION_ID from Step 1.

Terminal window
curl -X GET "https://truapi-dev.truconsent.io/api/v1/external/public/assets" \
-H "X-API-Key: $VITE_TRU_CONSENT_ADMIN_API_KEY" \
-H "X-Org-Id: $VITE_TRU_CONSENT_ORGANIZATION_ID"
{
"data": [
{
"asset_type": "Web App",
"name": "Main Marketing Website",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"description": "Primary customer-facing website"
},
{
"asset_type": "Mobile App",
"name": "iOS Application",
"id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
"description": "iOS mobile app"
}
],
"count": 2
}

Copy the id of the asset that matches your application — this is your assetId.

Terminal window
VITE_TRU_CONSENT_ASSET_ID=79bf87f5-xxxx-xxxx-xxxx-xxxxxxxxxxxx