Skip to content

Fetch asset ID

An asset represents a mobile application or website registered in truConsent (e.g. “My React Native App”). You need its assetId to mount TruConsentModal and NativeRightCenter.

Use your admin-scope API key and organization ID from Step 1. Run this from your development machine or a secure backend — not from the React Native app.

Terminal window
curl -X GET "https://truapi-dev.truconsent.io/api/v1/external/public/assets" \
-H "X-API-Key: $ADMIN_API_KEY" \
-H "X-Org-Id: $ORGANIZATION_ID"
{
"data": [
{
"asset_type": "Mobile App",
"name": "My React Native App",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"description": "Production React Native application"
},
{
"asset_type": "Mobile App",
"name": "My React Native App (Staging)",
"id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
"description": "Staging React Native application"
}
],
"count": 2
}

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

Add the value to app.json:

{
"expo": {
"extra": {
"truConsentAssetId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
}
}