Get asset ID
GET /api/v1/external/public/assets
An asset represents a website or application registered in truConsent (e.g. “Main Website” or “iOS App”). You need its id — the assetId — to mount the consent banner and to query collection points.
Use your admin-scope API key and organization ID from the Platform Setup steps. Run this from your development machine or a secure backend.
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"const response = await fetch( "https://truapi-dev.truconsent.io/api/v1/external/public/assets", { headers: { "X-API-Key": ADMIN_API_KEY, "X-Org-Id": 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": ADMIN_API_KEY, "X-Org-Id": ORGANIZATION_ID, }, });const { data }: { data: Asset[] } = await response.json();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"]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": "Web App", "name": "Main Website", "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "description": "Primary customer-facing web application" }, { "asset_type": "Mobile App", "name": "iOS App", "id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy", "description": "Production iOS application" } ], "count": 2}Copy the id of the asset that matches your integration target — this is your assetId.
Responses
Section titled “Responses”Returns a list of all assets registered to your organization.
{ "data": [ { "asset_type": "Web App", "name": "Main Website", "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "description": "Primary customer-facing web application" }, { "asset_type": "Mobile App", "name": "iOS App", "id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy", "description": "Production iOS application" } ], "count": 2}| Field | Description |
|---|---|
id | Asset UUID — use this as assetId in the SDK and collection point queries. |
name | Human-readable name set in the dashboard. |
asset_type | One of Web App, Mobile App, or API. |
description | Optional description entered in the dashboard. |
count | Total number of assets returned. |
Missing or invalid X-API-Key:
{ "detail": "Invalid or inactive API key" }API key does not have the admin scope:
{ "detail": "API key does not have the required scope" }Domain not on the allowed list:
{ "detail": "Origin not allowed" }Result
Section titled “Result”ASSET_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx