Get API key and org ID
You need two credentials before making any API calls: an API key and your organization ID. Both are available in the platform dashboard — no code required.
Step 1 — Open API Settings
Section titled “Step 1 — Open API Settings”- Sign in to https://platform-dev.truconsent.io.
- Go to Settings → API Settings.
Step 2 — Generate an API key
Section titled “Step 2 — Generate an API key”Two key scopes are required for the npm integration:
| Scope | Used for |
|---|---|
| Admin-scope key | Fetching assetId and bannerId from the Management API |
| Consent-scope key | Runtime API calls made by TruConsentModal |
- Click Generate API Key.
- Select Admin scope — copy the key and save it as
VITE_TRU_CONSENT_ADMIN_API_KEY. - Generate a second key, select Consent scope — save it as
VITE_TRU_CONSENT_API_KEY.
Step 3 — Copy your org ID
Section titled “Step 3 — Copy your org ID”Your organization ID is displayed on the same API Settings page under Organization ID.
Copy it and save as VITE_TRU_CONSENT_ORGANIZATION_ID.
Step 4 — Add allowed domains
Section titled “Step 4 — Add allowed domains”Under Allowed Domains, add every domain where TruConsentModal will run (e.g. localhost:5173, app.yourdomain.com).
Requests from unlisted domains are rejected with 403 Forbidden.
Result
Section titled “Result”Your .env should now have these three values filled in:
VITE_TRU_CONSENT_ORGANIZATION_ID=your-organization-idVITE_TRU_CONSENT_ADMIN_API_KEY=your-admin-scope-keyVITE_TRU_CONSENT_API_KEY=your-consent-scope-key