Organization

Fetch organization metadata and public integration keys.

Returns your organization's metadata: name, slug, and the public integration keys (Google Analytics ID, Meta Pixel ID, GTM Container ID) that your website needs to render analytics and tracking tags.

Get organization

GET /api/organizations/{orgId}/organization

Response

{
  "id": "org_xxx",
  "name": "Acme Inc.",
  "slug": "acme",
  "integrations": {
    "googleAnalyticsId": "G-XXXXXXX",
    "metaPixelId": "1234567890",
    "gtmContainerId": "GTM-XXXXXX"
  }
}

Example (TypeScript)

const org = await inventra.organizations.get();
console.log(org.name);
console.log(org.integrations.googleAnalyticsId);

Integrations vs credentials

Inventra stores third-party configuration in two categories:

  • Integrations — public-safe values, returned by this endpoint. Examples: GA Measurement ID, Meta Pixel ID, GTM Container ID. Safe to ship to the browser.
  • Credentials — secret values (API secrets, OAuth tokens, SMTP passwords). Never exposed via any API. Used only by Inventra's backend.

The dashboard stores both, encrypted, but only the integrations dictionary is cherry-picked into API responses.

Use case: rendering analytics tags

import Script from 'next/script';

export default async function Layout({ children }) {
  const org = await inventra.organizations.get();
  const gaId = org.integrations.googleAnalyticsId;

  return (
    <html>
      <head>
        {gaId && (
          <Script
            src={`https://www.googletagmanager.com/gtag/js?id=${gaId}`}
          />
        )}
      </head>
      <body>{children}</body>
    </html>
  );
}