# Overview

Entitlements management lets your team instantly update entitlements for your users, based on their organization, pricing plan, or user ID without redeploying your app.

## Problem

Without entitlements management:

* Sales and customer success can't easily enable access to features or increase usage limits for prospects and customers they're speaking with.
* The logic for entitlements, feature access, and usage limits, is scattered across the codebase with no single source of truth, making it hard to understand and prone to errors.
* Changes to entitlements require complex, coordinated code changes, app rebuilds, and redeploys.

## Solution

Define entitlements in Hypertune as flags instead of hardcoded values:

```graphql
type Root {
  entitlements: Entitlements!
}

type Entitlements {
  teamRolesEnabled: Boolean!
  maxTeamSize: Int!
  maxApiRequestsPerDay: Int!
  versionHistoryEnabled: Boolean!
}
```

Then reference them in your code:

{% code title="app/api/add-team-member/route.ts" %}

```typescript
import { waitUntil } from '@vercel/functions'
import { NextResponse } from 'next/server'
import addUserToTeam from '@/lib/addUserToTeam'
import getHypertune from '@/lib/getHypertune'
import getTeamSize from '@/lib/getTeamSize'

export const runtime = 'edge'

export async function POST(request: Request) {
  const hypertune = await getHypertune({ isRouteHandler: true })

  const { userId, teamId } = await request.json()

  const teamSize = getTeamSize()

  const maxTeamSize = hypertune.entitlements().maxTeamSize({
    args: {},
    fallback: 5,
  })

  waitUntil(hypertune.flushLogs())

  if (teamSize >= maxTeamSize) {
    return NextResponse.json(
      {
        error: 'Team size limit reached',
        teamSize,
        maxTeamSize,
        message: `Your team has reached the maximum size of ${maxTeamSize} members. Please upgrade your plan to add more members.`,
      },
      { status: 403 }
    )
  }

  const result = await addUserToTeam(userId, teamId)

  return NextResponse.json({
    success: true,
    currentTeamSize: teamSize + 1,
    maxTeamSize,
    result,
  })
}

```

{% endcode %}

This empowers product, sales, and customer success to instantly update entitlements from the Hypertune dashboard without any code changes or redeploys:

<figure><img src="https://2048905609-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWa3rQLiu4JZhBRkiyoKz%2Fuploads%2FAZklCtea8ZF7UWM4sQ4X%2FScreenshot%202025-11-13%20at%2016.26.14.png?alt=media&#x26;token=16b07389-6000-4e86-8c3f-28b13294ed29" alt=""><figcaption></figcaption></figure>

## Benefits

* Sales and customer success can instantly enable access to features or increase usage limits for prospects and customers they're speaking with.
* The configuration logic for entitlements, feature access, and usage limits, is extracted out of the codebase into a single source of truth that's visible to all stakeholders.
* Entitlements can be updated instantly at runtime without any code changes or redeploys.

## ROI

These benefits help teams:

* Close more prospects, boost customer satisfaction, and generate more revenue.
* Improve product reliability for users.
