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

# Check User Access

> Checks if a user has access to specific features and returns usage information including quotas, limits, and current usage.

> Usage endpoints are served from [https://api-meter.metrifox.com](https://api-meter.metrifox.com). Other API calls stay on [https://api.metrifox.com](https://api.metrifox.com).

You can provide either `feature_key` or `event_name` when checking access.

Successful responses now include a `data` object with access details (balance, requested\_quantity, entitlement status, prepaid flag, wallet\_balance, etc.).


## OpenAPI

````yaml GET /usage/access
openapi: 3.0.1
info:
  title: Metrifox API Documentation
  version: v1
  description: >-
    Welcome to Metrifox Platform's API documentation. This comprehensive API
    suite enables seamless integration with our platform, providing secure and
    efficient access to our services.
servers:
  - url: https://{defaultHost}
    variables:
      defaultHost:
        default: api.metrifox.com
security:
  - api_key: []
paths:
  /usage/access:
    servers:
      - url: https://api-meter.metrifox.com
    get:
      tags:
        - Usage
      summary: Check user access to features
      description: >-
        Checks if a user has access to specific features and returns usage
        information including quotas, limits, and current usage.
      parameters:
        - name: feature_key
          in: query
          required: true
          description: >-
            Feature key to check access for. Either feature_key or event_name is
            required.
          schema:
            type: string
          example: feature_interview_booking
        - name: customer_key
          in: query
          required: true
          description: >-
            The unique customer identifier in your application to check access
            for
          schema:
            type: string
          example: cust-6d11ca90
        - name: quantity
          in: query
          required: false
          description: Quantity to check access for. Defaults to 1 if not provided.
          schema:
            type: number
            default: 1
          example: 1
      responses:
        '200':
          description: Access check completed
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      customer_key:
                        type: string
                        description: The customer key that was checked
                      feature_key:
                        type: string
                        description: The feature or event key that was checked
                      requested_quantity:
                        type: number
                        description: Quantity requested for this access check
                      can_access:
                        type: boolean
                        description: Whether the user has access to the feature
                      unlimited:
                        type: boolean
                        description: Whether the customer has unlimited access
                      balance:
                        type: number
                        description: Current balance available
                      used_quantity:
                        type: number
                        description: Quantity already used by the customer
                      entitlement_active:
                        type: boolean
                        description: Whether the entitlement is currently active
                      prepaid:
                        type: boolean
                        description: Whether the entitlement is prepaid
                      wallet_balance:
                        type: number
                        description: Remaining wallet balance (if prepaid)
                      message:
                        type: string
                        description: Status message
              examples:
                access_granted:
                  summary: Access Granted Example
                  value:
                    data:
                      customer_key: cust-mit7k5v8obzs
                      feature_key: feature_seats
                      requested_quantity: 1
                      can_access: true
                      unlimited: false
                      balance: 4
                      used_quantity: 0
                      entitlement_active: true
                      prepaid: false
                      wallet_balance: 0
                      message: Feature found
        '400':
          description: Bad request - Missing required parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Validation failed
                errors:
                  feature_key:
                    - is required
                  customer_key:
                    - is required
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Unauthorized
        '404':
          description: Feature or customer not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Feature not found
      x-codeSamples:
        - lang: python
          label: Python SDK
          source: |
            from metrifox_sdk import MetrifoxClient

            client = MetrifoxClient(api_key="your_api_key")

            # Check feature access
            access = client.usages.check_access({
                "feature_key": "feature_interview_booking",
                "customer_key": "cust-6d11ca90",
                "quantity": 5
            })

            print(access['data']['can_access'])  # True/False
        - lang: javascript
          label: Javascript SDK
          source: |
            import { init } from "metrifox-js";

            const metrifoxClient = init({
              apiKey: process.env.METRIFOX_API_KEY
            });

            const access = await metrifoxClient.usages.checkAccess({
              featureKey: "feature_interview_booking",
              customerKey: "cust-6d11ca90",
            });
        - lang: ruby
          label: Ruby SDK
          source: |
            require 'metrifox-sdk'

            # Initialize with configuration
            METRIFOX_SDK = MetrifoxSDK.init({ api_key: "your-api-key" })

            # Check feature access
            response = METRIFOX_SDK.usages.check_access({
              feature_key: "feature_interview_booking",
              customer_key: "cust-6d11ca90",
              quantity: 10
            })

            puts response["can_access"] # true/false
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Error message
        errors:
          type: object
          additionalProperties: true
          description: Detailed error information
  securitySchemes:
    api_key:
      type: apiKey
      name: x-api-key
      in: header

````