Skip to content

Get your API credentials

  1. Generate API keys

    Sign in to https://platform-dev.truconsent.io and go to Settings → API Settings.

    Two key scopes are needed:

    ScopeUsed for
    Admin-scope keyFetching your assetId from the Management API (setup only)
    Consent-scope keyRuntime calls made by the cookie banner SDK
    1. Click Generate API Key, select Admin scope — save as VITE_TRU_CONSENT_ADMIN_API_KEY.
    2. Generate a second key, select Consent scope — save as VITE_TRU_CONSENT_API_KEY.
  2. Copy your organisation ID

    On the same API Settings page, copy the Organization ID value.

    Save it as VITE_TRU_CONSENT_ORGANIZATION_ID.

  3. Add allowed domains

    Under Allowed Domains, add every origin where the banner will run — for example localhost:5173 for development and yoursite.com for production.

    Requests from unlisted domains are rejected with 403 Forbidden.

  4. Fetch your asset ID

    An asset represents your registered website in truConsent. Fetch all assets using your admin-scope key and org ID:

    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"

    Sample response:

    {
    "data": [
    {
    "asset_type": "Web App",
    "name": "Main Marketing Website",
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "description": "Primary customer-facing website"
    }
    ],
    "count": 1
    }

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

    Save it as VITE_TRU_CONSENT_ASSET_ID.

Your .env should now have all five values:

Terminal window
# truConsent cookie banner
VITE_TRU_CONSENT_API_URL=https://trukit-dev.truconsent.io
VITE_TRU_CONSENT_MANAGEMENT_API_URL=https://truapi-dev.truconsent.io
VITE_TRU_CONSENT_ORGANIZATION_ID=your-org-id
VITE_TRU_CONSENT_ADMIN_API_KEY=your-admin-scope-key
VITE_TRU_CONSENT_API_KEY=your-consent-scope-key
VITE_TRU_CONSENT_ASSET_ID=your-asset-id