# 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="/files/tDfNgMynkJZ5iW6KK7Km" 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hypertune.com/entitlements/overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
