@flags-sdk/split

The @flags-sdk/split package provides

  • an adapter for loading feature flags from this provider (coming soon)
  • a getProviderData function for use with the Flags Explorer (available today)

Learn more about Adapters

getProviderData

A provider function to load flag metadata from Statsig for use with the Flags Explorer. Accepts an options object with the following keys.

Options keyTypeDescription
adminApiKeystringSplit admin API key
workspaceIdstringSplit workspace ID
organizationIdstringSplit organization ID
environmentIdstringSplit environment ID
app/.well-known/vercel/flags/route.ts
import { verifyAccess, type ApiData } from '@vercel/flags';
import { getProviderData } from '@flags-sdk/split';
import { NextResponse, type NextRequest } from 'next/server';
export async function GET(request: NextRequest) {
const access = await verifyAccess(request.headers.get('Authorization'));
if (!access) return NextResponse.json(null, { status: 401 });
const splitData = await getProviderData({
adminApiKey: process.env.SPLIT_ADMIN_API_KEY,
environmentId: process.env.SPLIT_ENVIRONMENT_ID,
organizationId: process.env.SPLIT_ORG_ID,
workspaceId: process.env.SPLIT_WORKSPACE_ID,
});
return NextResponse.json<ApiData>(splitData);
}

Learn more about the Flags Explorer