Fetch asset ID
An asset represents a mobile application or website registered in truConsent (e.g. “My Flutter 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 Flutter app.
Fetch all assets
Section titled “Fetch all assets”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"import osimport requests
url = "https://truapi-dev.truconsent.io/api/v1/external/public/assets"headers = { "X-API-Key": os.environ["ADMIN_API_KEY"], "X-Org-Id": os.environ["ORGANIZATION_ID"],}response = requests.get(url, headers=headers)data = response.json()["data"]const response = await fetch( "https://truapi-dev.truconsent.io/api/v1/external/public/assets", { headers: { "X-API-Key": process.env.ADMIN_API_KEY, "X-Org-Id": process.env.ORGANIZATION_ID, }, });const { data } = await response.json();interface Asset { id: string; name: string; asset_type: string; description: string;}
const response = await fetch( "https://truapi-dev.truconsent.io/api/v1/external/public/assets", { headers: { "X-API-Key": process.env.ADMIN_API_KEY!, "X-Org-Id": process.env.ORGANIZATION_ID!, }, });const { data }: { data: Asset[] } = await response.json();const asset = data.find(a => a.name === "My Flutter App");Invoke-RestMethod -Method Get ` -Uri "https://truapi-dev.truconsent.io/api/v1/external/public/assets" ` -Headers @{ "X-API-Key" = $env:ADMIN_API_KEY "X-Org-Id" = $env:ORGANIZATION_ID }Sample response
Section titled “Sample response”{ "data": [ { "asset_type": "Mobile App", "name": "My Flutter App", "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "description": "Production Flutter application" }, { "asset_type": "Mobile App", "name": "My Flutter App (Staging)", "id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy", "description": "Staging Flutter application" } ], "count": 2}Copy the id of the asset that matches your Flutter application — this is your assetId.
Result
Section titled “Result”ASSET_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxPass this value as assetId in TruConsentConfig, TruConsentModal, and NativeRightCenter.