Organizations (SDK)
Fetch organization metadata and public integration keys.
Wraps the Organization REST API.
Methods
inventra.organizations.get()
Returns the organization's public metadata — name, slug, and the integrations dictionary of public third-party keys safe to ship to the browser.
const org = await inventra.organizations.get();Returns Promise<Organization>
Type
interface Organization {
id: string;
name: string;
slug: string;
integrations: {
googleAnalyticsId?: string;
metaPixelId?: string;
gtmContainerId?: string;
// Additional public keys may be added over time.
};
}Example: 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}`}
strategy="afterInteractive"
/>
<Script id="ga-init" strategy="afterInteractive">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${gaId}');
`}
</Script>
</>
)}
</head>
<body>{children}</body>
</html>
);
}What's not in integrations
Secret keys (API secrets, OAuth refresh tokens, SMTP passwords) are stored in the organization's encrypted credentials object and are never returned by this endpoint. They're used by Inventra's backend only.