{"id":"pg_aelzgkatnrnu","property_id":"prp_pklgwresh6hp","domain_id":"dom_zrkwapcbulfb","root_domain":"vercel.com","locale":"en","url":"https://vercel.com/docs/flags/flags-sdk-reference","url_hash":"66ebf6af63dcfaa47b448bd536420cf4adebfba7be060c82e83298606704b24e","path":"/docs/flags/flags-sdk-reference","depth":1,"canonical_url":"https://vercel.com/docs/flags/flags-sdk-reference","canonical_page_id":null,"page_type":"docs","page_type_guess":"docs","state":"indexed","skip_reason":"budget","priority":"1.4","discovered_via":"sitemap","first_seen_at":"2026-08-27T09:05:09.822Z","last_seen_at":"2026-09-26T09:10:02.787Z","http_status":200,"content_hash":"13f736159e949f57a356fcf39f4d8413157c5f2cc82139b02981390a3fbda4f1","title":"Flags SDK Reference","description":"API reference for the Flags SDK for Next.js and SvelteKit.","author":"Vercel","published_at":null,"modified_at":"2026-07-15T15:07:37.000Z","word_count":235,"reading_time_sec":64,"lang_detected":"en","images":[],"links_out":null,"markdown_source":"readability","refresh_interval":"monthly","last_fetched_at":"2026-09-26T09:09:49.223Z","next_refresh_at":"2026-10-26T09:09:49.223Z","runs_count":1,"changes_count":0,"last_changed_at":null,"fail_count":0,"last_error":null,"created_at":"2026-08-27T09:05:09.822Z","updated_at":"2026-08-27T09:05:09.822Z","inlinks":28,"inlinks_body":3,"outlinks":161,"outlinks_external":12,"anchor_terms":["Flags SDK","Flags SDKA framework-native library for Next.js and SvelteKit that works with any provider. Define flags in code with fu"],"template_score":"0.93333333333333333333","cash":"0.0104652296406298625","cash_total":"0.62112123292483346806","pagerank":"0.0442565818434754","is_orphan":false,"link_confirmed":true,"discovered_wave":0,"embedded_hash":null,"embedded_at":null,"domain_name":"Vercel Inc.","brand_color":null,"domain_rank":579,"spam_score":14,"markdown":"The Flags SDK is a free, open-source library that gives you the tools you need to use feature flags in Next.js and SvelteKit applications. It works with any flag provider, custom setups, or no provider at all.\n\nThis page provides an overview of key concepts and APIs. For complete API documentation, visit [flags-sdk.dev](https://flags-sdk.dev/), the official source of truth for the Flags SDK.\n\n-   Framework-native: Built specifically for Next.js (App Router, Pages Router, Middleware) and SvelteKit\n-   Provider-agnostic: Works with any [flag provider](https://flags-sdk.dev/docs/adapters/supported-providers) or [custom adapters](https://flags-sdk.dev/docs/adapters/custom-adapters)\n-   Type-safe: Full TypeScript support with type inference\n-   Optimized for performance: Uses precompute pattern for static generation\n-   Integrated: Works seamlessly with Flags Explorer and Vercel observability features\n\nFlags are defined using the `flag()` function. Each flag has a key and a `decide` function that returns the flag's value:\n\nThe `decide` function determines a flag's value. It can be sync or async, and can access request context:\n\nFlags can have multiple options for A/B testing and experimentation:\n\nThe precompute pattern generates multiple versions of static pages with different flag values:\n\nLearn more about [precompute on flags-sdk.dev](https://flags-sdk.dev/docs/core-concepts/precompute).\n\nCall your flag functions to read their values:\n\nReport flag values for observability (automatic with SDK):\n\nHandle flag overrides from Flags Explorer (automatic with SDK integrations):\n\nCreate a Flags API endpoint for Flags Explorer:\n\nThe Flags SDK works with many providers out of the box:\n\nFor the full API documentation, including all functions, types, and advanced patterns, visit:","storage":{"htmlKey":"stealpage/html/vercel.com/pg_aelzgkatnrnu/run_pg8z08kjey1b.html.gz","markdownKey":"stealpage/md/vercel.com/pg_aelzgkatnrnu/run_pg8z08kjey1b.md.gz"},"facets":null,"assets":[{"kind":"image","src_url":"https://vercel-docs.vercel.sh/vc-ap-0cca3e/_next/static/immutable/media/vercel-light.3_gxxexgi1nmy.svg","r2_key":null,"alt":"Vercel","caption":null,"width":16,"height":14,"is_hero":false,"zone":"footer"},{"kind":"image","src_url":"https://vercel-docs.vercel.sh/vc-ap-0cca3e/_next/static/immutable/media/vercel-dark.1f3cgy23m5_jy.svg","r2_key":null,"alt":"Vercel","caption":null,"width":16,"height":14,"is_hero":false,"zone":"footer"}],"shots":[{"viewport":"mobile","width":390,"height":844,"r2_key":"stealpage/shots/vercel.com/pg_aelzgkatnrnu/run_pg8z08kjey1b-mobile.png","phash":"42c0d8c884c8d8cc","visual_delta":null,"captured_at":"2026-09-26T09:09:53.884Z"},{"viewport":"desktop","width":1440,"height":900,"r2_key":"stealpage/shots/vercel.com/pg_aelzgkatnrnu/run_pg8z08kjey1b-desktop.png","phash":"07646048424248c4","visual_delta":null,"captured_at":"2026-09-26T09:09:53.708Z"}],"history":[{"id":"run_pg8z08kjey1b","started_at":"2026-09-26T09:09:49.217Z","http_status":200,"fetcher":"direct","changed":false,"diff":null,"word_count":235}],"citedBy":[{"id":"pg_shocgxz1klct","url":"https://vercel.com/templates","title":"Templates - Vercel","anchors":["Flags SDK"],"zone":"main"},{"id":"pg_5b9mg7dvpil0","url":"https://vercel.com/docs/flags","title":"Flags","anchors":["Flags SDK","Flags SDKA framework-native library for Next.js and SvelteKit that works with any provider. Define flags in code with fu"],"zone":"main"}]}