Fetch collection point details
A collection point is a named location where consent is requested (e.g. “Main Cookie Banner”). Its display_id is the bannerId you pass to TruConsentModal.
Use the assetId you discovered in Step 2.
Fetch collection points for an asset
Section titled “Fetch collection points for an asset”curl -X GET "https://truapi-dev.truconsent.io/api/v1/external/public/collection-points?asset_id=$VITE_TRU_CONSENT_ASSET_ID" \ -H "X-API-Key: $VITE_TRU_CONSENT_ADMIN_API_KEY" \ -H "X-Org-Id: $VITE_TRU_CONSENT_ORGANIZATION_ID"const assetId = import.meta.env.VITE_TRU_CONSENT_ASSET_ID;const response = await fetch( "https://truapi-dev.truconsent.io/api/v1/external/public/collection-points?asset_id=" + assetId, { headers: { "X-API-Key": import.meta.env.VITE_TRU_CONSENT_ADMIN_API_KEY, "X-Org-Id": import.meta.env.VITE_TRU_CONSENT_ORGANIZATION_ID, }, });const { data } = await response.json();interface CollectionPoint { id: string; display_id: string; name: string; status: string;}
const assetId = import.meta.env.VITE_TRU_CONSENT_ASSET_ID;const response = await fetch( "https://truapi-dev.truconsent.io/api/v1/external/public/collection-points?asset_id=" + assetId, { headers: { "X-API-Key": import.meta.env.VITE_TRU_CONSENT_ADMIN_API_KEY, "X-Org-Id": import.meta.env.VITE_TRU_CONSENT_ORGANIZATION_ID, }, });const { data }: { data: CollectionPoint[] } = await response.json();import osimport requests
asset_id = os.environ["VITE_TRU_CONSENT_ASSET_ID"]url = "https://truapi-dev.truconsent.io/api/v1/external/public/collection-points"params = {"asset_id": asset_id}headers = { "X-API-Key": os.environ["VITE_TRU_CONSENT_ADMIN_API_KEY"], "X-Org-Id": os.environ["VITE_TRU_CONSENT_ORGANIZATION_ID"],}response = requests.get(url, params=params, headers=headers)data = response.json()["data"]Invoke-RestMethod -Method Get ` -Uri "https://truapi-dev.truconsent.io/api/v1/external/public/collection-points?asset_id=$env:VITE_TRU_CONSENT_ASSET_ID" ` -Headers @{ "X-API-Key" = $env:VITE_TRU_CONSENT_ADMIN_API_KEY "X-Org-Id" = $env:VITE_TRU_CONSENT_ORGANIZATION_ID }Sample response
Section titled “Sample response”{ "data": [ { "asset_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", "name": "Main Cookie Banner", "display_id": "CP010", "description": "Main consent banner for website visitors", "status": "active", "version": "v1.0.0", "purposes": [ "pppppppp-pppp-pppp-pppp-pppppppppppp", "qqqqqqqq-qqqq-qqqq-qqqq-qqqqqqqqqqqq" ] }, { "asset_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb", "name": "Signup Form Banner", "display_id": "CP011", "description": "Consent banner shown on signup", "status": "draft", "version": "v1.0.1", "purposes": [ "rrrrrrrr-rrrr-rrrr-rrrr-rrrrrrrrrrrr" ] } ], "count": 2}The display_id (e.g. CP010) is your bannerId. Use the collection point whose status is active and whose name matches the consent flow you are integrating.
Result
Section titled “Result”VITE_TRU_CONSENT_BANNER_ID=CP010Your .env is now fully populated.