# TypeScript and Market Monolith

Availability: Instructions published.
Connection status: Connection not available.

Last reviewed: 2026-08-28.

Use a server-side TypeScript application to inspect the authentication contract. There is no published Market Monolith TypeScript SDK or connected integration in this release.

## Environment and secret handling

The example uses Node.js's built-in [fetch API](https://nodejs.org/api/globals.html#fetch), not a Market Monolith package. Run only after the authentication release is confirmed. Supply the key through your trusted secret manager; never use a frontend-exposed environment variable.

```typescript
const key = process.env.MARKET_MONOLITH_API_KEY;
if (!key) throw new Error("A server-side API key is required");

const response = await fetch("https://api.marketmonolith.com/v1/me", {
  headers: { "X-Market-Monolith-Key": key, Accept: "application/json" },
  redirect: "error",
  signal: AbortSignal.timeout(10_000),
});

if (!response.ok) {
  throw new Error("Authentication check returned HTTP " + response.status);
}
const identity = await response.json();
console.log({
  accountRef: identity.accountRef,
  applicationRef: identity.applicationRef,
  businessAccess: identity.businessAccess,
  billable: identity.billable,
});
```

## What this example proves

An accepted response proves that the presented key authenticates as the returned account and application. It does not grant workspace access, start research, activate billing or connect an agent.

The example refuses redirects and stops after a bounded wait. It does not retry or log the key. Match the identity to your console before building further behavior.

## Compatibility and support

This is a language example, not a versioned SDK with generated types or retry guarantees. Validate it against your supported Node.js runtime and deployment policy. Business resources remain [planned](/docs/capability-availability).
