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

# Métricas de Indicação

> Métricas agregadas do programa de indicação

# Métricas de Indicação

Retorna métricas agregadas de indicação da empresa.
Permite filtrar por `campaign_id`, período (`days`) e granularidade (`group_by`).


## OpenAPI

````yaml GET /api/v1/public/referrals/metrics
openapi: 3.1.0
info:
  contact:
    email: support@indiqai.com
    name: IndiqAI Support
    url: https://indiqai.com/
  description: Especificação OpenAPI da API Pública IndiqAI.
  license:
    name: Proprietary
    url: https://indiqai.com/license
  title: IndiqAI API Pública
  version: 1.5.0
servers:
  - description: Produção
    url: https://api.indiqai.com
security: []
paths:
  /api/v1/public/referrals/metrics:
    get:
      tags:
        - API Pública
      summary: Métricas de indicação
      description: Métricas de performance do programa de indicação.
      operationId: get_referral_metrics_api_v1_public_referrals_metrics_get
      parameters:
        - description: ID da campanha (null agrega todas)
          in: query
          name: campaign_id
          required: false
          schema:
            anyOf:
              - format: uuid
                type: string
              - type: 'null'
            description: ID da campanha (null agrega todas)
            title: Campaign Id
        - in: query
          name: days
          required: false
          schema:
            default: 30
            maximum: 365
            minimum: 1
            title: Days
            type: integer
        - description: '"day", "week" ou "month"'
          in: query
          name: group_by
          required: false
          schema:
            default: day
            description: '"day", "week" ou "month"'
            title: Group By
            type: string
        - description: Chave de API
          in: header
          name: X-API-Key
          required: true
          schema:
            description: Chave de API
            title: X-Api-Key
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferralMetricsResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    ReferralMetricsResponse:
      description: Métricas de performance do programa de indicação.
      properties:
        avg_days_to_convert:
          anyOf:
            - type: number
            - type: 'null'
          title: Avg Days To Convert
        campaign_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Campaign Id
        campaign_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Campaign Name
        clients_never_referred:
          default: 0
          title: Clients Never Referred
          type: integer
        clients_referred_but_inactive:
          default: 0
          title: Clients Referred But Inactive
          type: integer
        conversion_rate:
          default: 0
          title: Conversion Rate
          type: number
        converted_referrals:
          default: 0
          title: Converted Referrals
          type: integer
        expired_referrals:
          default: 0
          title: Expired Referrals
          type: integer
        pending_referrals:
          default: 0
          title: Pending Referrals
          type: integer
        period_days:
          default: 30
          title: Period Days
          type: integer
        referrals_by_period:
          items:
            $ref: '#/components/schemas/ReferralByPeriod'
          title: Referrals By Period
          type: array
        top_referrers:
          items:
            $ref: '#/components/schemas/ReferralMetricsTopReferrer'
          title: Top Referrers
          type: array
        total_referrals:
          default: 0
          title: Total Referrals
          type: integer
      title: ReferralMetricsResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ReferralByPeriod:
      description: Indicações agrupadas por período.
      properties:
        converted:
          default: 0
          title: Converted
          type: integer
        generated:
          default: 0
          title: Generated
          type: integer
        period:
          title: Period
          type: string
      required:
        - period
      title: ReferralByPeriod
      type: object
    ReferralMetricsTopReferrer:
      properties:
        client_id:
          title: Client Id
          type: string
        conversion_rate:
          default: 0
          title: Conversion Rate
          type: number
        conversions:
          default: 0
          title: Conversions
          type: integer
        name:
          title: Name
          type: string
        referrals:
          default: 0
          title: Referrals
          type: integer
      required:
        - client_id
        - name
      title: ReferralMetricsTopReferrer
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object

````