> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crovver.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Check Feature Access

> Check if a tenant has access to a specific feature or has an active subscription for a product.

Returns whether the tenant's active plan includes the requested feature.
For multi-product orgs, pass `productSlug` to scope the check to a specific product's subscription.
If the feature is backed by a credit pool, also returns the available credit balance.

## Request Body

<ParamField body="requestingEntityId" type="string" required>
  The external tenant ID from your application
</ParamField>

<ParamField body="featureKey" type="string">
  The feature key to check (must match a key in `plan.features`). Optional when `productSlug` is provided — omitting it performs a **subscription-existence check** (returns `true` if the tenant has any active/trial subscription for that product).
</ParamField>

<ParamField body="productSlug" type="string">
  Scope the check to a specific product (e.g. `product-a`). Required for multi-product orgs. At least one of `featureKey` or `productSlug` must be provided.
</ParamField>

<ParamField body="amount" type="integer">
  For credit-backed features: number of credits needed. Defaults to `0` (balance check only).
</ParamField>

## Authentication

Requires a **public key** (`x-public-key: pk_live_...`) or **secret key** (`Authorization: Bearer sk_live_...`).

## Response

<ResponseField name="data.canAccess" type="boolean">
  Whether the tenant can access the feature or has an active subscription for the product
</ResponseField>

<ResponseField name="data.featureKey" type="string">
  Echoed feature key (absent when only `productSlug` was provided)
</ResponseField>

<ResponseField name="data.productSlug" type="string">
  Echoed product slug (when provided)
</ResponseField>

<ResponseField name="data.requestingEntityId" type="string">
  The tenant ID that was checked
</ResponseField>

<ResponseField name="data.credits" type="object">
  Only present when the feature maps to a credit pool.

  <Expandable>
    <ResponseField name="available" type="integer">Credits remaining in the pool</ResponseField>
    <ResponseField name="sufficient" type="boolean">Whether available credits meet the requested `amount`</ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash Feature check (single-product) theme={null}
  curl -X POST "https://app.crovver.com/api/public/can-access" \
    -H "x-public-key: pk_live_..." \
    -H "Content-Type: application/json" \
    -d '{
      "requestingEntityId": "workspace_123",
      "featureKey": "advanced_analytics"
    }'
  ```

  ```bash Feature check scoped to a product theme={null}
  curl -X POST "https://app.crovver.com/api/public/can-access" \
    -H "x-public-key: pk_live_..." \
    -H "Content-Type: application/json" \
    -d '{
      "requestingEntityId": "workspace_123",
      "featureKey": "advanced_analytics",
      "productSlug": "product-a"
    }'
  ```

  ```bash Subscription-existence check (no featureKey) theme={null}
  curl -X POST "https://app.crovver.com/api/public/can-access" \
    -H "x-public-key: pk_live_..." \
    -H "Content-Type: application/json" \
    -d '{
      "requestingEntityId": "workspace_123",
      "productSlug": "product-a"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 Has Access theme={null}
  {
    "success": true,
    "data": {
      "canAccess": true,
      "featureKey": "advanced_analytics",
      "requestingEntityId": "workspace_123"
    }
  }
  ```

  ```json 200 Scoped to product theme={null}
  {
    "success": true,
    "data": {
      "canAccess": true,
      "featureKey": "advanced_analytics",
      "productSlug": "product-a",
      "requestingEntityId": "workspace_123"
    }
  }
  ```

  ```json 200 Subscription-existence check theme={null}
  {
    "success": true,
    "data": {
      "canAccess": true,
      "productSlug": "product-a",
      "requestingEntityId": "workspace_123"
    }
  }
  ```

  ```json 200 No Access theme={null}
  {
    "success": true,
    "data": {
      "canAccess": false,
      "featureKey": "advanced_analytics",
      "requestingEntityId": "workspace_123"
    }
  }
  ```
</ResponseExample>
