API referencePlatform APIEndpoint reference
GUIDE & REFERENCE

/api/billing/subscriptions (dashboard)

Source-derived dashboard endpoint contract, authentication, request validation, responses, and errors.

This is the dashboard service route. Its origin and authentication are described in Platform API overview and Authentication. A path shared by another service is a different endpoint.

PropertyContract
MethodsGET
Path/api/billing/subscriptions
Path parametersNone
Query parameters read in routeorgId
Headers read in routeNo additional direct header reads; authentication helpers may read credentials

Authentication and access

Dashboard session cookie through @repo/auth/server. Some auth-summary routes can redirect to sign-in; inspect the status branches below.

Method behavior

The handler excerpt preserves field validation, response envelopes, cookie changes, and exception branches. Values returned by service helpers retain their named response type above; for passthrough routes, the upstream response is authoritative.

GET

export async function GET(request: NextRequest) {
  const session = await getSession();

  if (!session) {
    return NextResponse.json(
      { error: { code: 'UNAUTHENTICATED', message: 'Sign in at auth.l1fe.ai.' } },
      { status: 401 }
    );
  }

  const cookieStore = await cookies();
  const tenantId = readBillingTenantId(
    request,
    session,
    cookieStore.get(ACTIVE_TENANT_COOKIE)?.value
  );

  if (!tenantId) {
    return NextResponse.json({ subscriptions: [] });
  }

  try {
    const response = await fetchSubscriptions(tenantId, session.accessToken);
    return NextResponse.json(response, {
      headers: {
        'Cache-Control': 'private, no-cache, no-store, must-revalidate',
      },
    });
  } catch {
    return NextResponse.json(
      { subscriptions: [] },
      {
        headers: {
          'Cache-Control': 'private, no-cache, no-store, must-revalidate',
        },
      }
    );
  }
}

Source: minds-ui/apps/app/app/api/billing/subscriptions/route.ts:16.

Response and error branches

Literal HTTP statuses in the route: 401. Shared management error classes are defined in Errors and responses.

NextResponse.json(
      { error: { code: 'UNAUTHENTICATED', message: 'Sign in at auth.l1fe.ai.' } },
      { status: 401 }
    )

Source: minds-ui/apps/app/app/api/billing/subscriptions/route.ts:20.

NextResponse.json({ subscriptions: [] })

Source: minds-ui/apps/app/app/api/billing/subscriptions/route.ts:34.

NextResponse.json(response, {
      headers: {
        'Cache-Control': 'private, no-cache, no-store, must-revalidate',
      },
    })

Source: minds-ui/apps/app/app/api/billing/subscriptions/route.ts:39.

NextResponse.json(
      { subscriptions: [] },
      {
        headers: {
          'Cache-Control': 'private, no-cache, no-store, must-revalidate',
        },
      }
    )

Source: minds-ui/apps/app/app/api/billing/subscriptions/route.ts:45.

Service dependencies

  • minds-ui/apps/app/lib/organizations.ts

Evidence

Generated from the local source snapshot on 2026-09-12. This page documents implemented code and does not certify a deployed service, permissions configuration, or successful provider operation.

Source file: minds-ui/apps/app/app/api/billing/subscriptions/route.ts. SHA-256: f78c674f73c00cd446681d4be3e9a635506cd834a8cac9a74f5af161edc89837.

On this page