> ## 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.

# Comportamento do Cliente

> Retorna métricas de comportamento de um cliente da empresa

# Comportamento do Cliente

Retorna uma visão consolidada do comportamento de um cliente no período solicitado.

## Principais campos

* saldo de pontos
* pontos ganhos e resgatados no período
* cupons usados no período
* resumo de cartões de fidelidade
* última atividade

## Status comuns

* `200` cliente encontrado e retorno consolidado
* `401` API Key inválida ou revogada
* `403` plano sem `api_access`
* `404` cliente não encontrado na empresa da key


## OpenAPI

````yaml GET /api/v1/public/clients/{client_id}/behavior
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/clients/{client_id}/behavior:
    get:
      tags:
        - API Pública
      summary: Comportamento do cliente
      description: >-
        Retorna comportamento agregado do cliente na empresa: pontos, cupons,
        indicações, cartões.
      operationId: get_client_behavior_api_v1_public_clients__client_id__behavior_get
      parameters:
        - in: path
          name: client_id
          required: true
          schema:
            title: Client Id
            type: string
        - in: query
          name: days
          required: false
          schema:
            default: 90
            maximum: 365
            minimum: 1
            title: Days
            type: integer
        - 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/ClientBehaviorResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    ClientBehaviorResponse:
      description: Comportamento agregado de um cliente na empresa.
      properties:
        client_id:
          title: Client Id
          type: string
        coupons_used_period:
          default: 0
          title: Coupons Used Period
          type: integer
        days_since_last_activity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Days Since Last Activity
        last_purchase_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Last Purchase At
        last_redemption_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Last Redemption At
        last_referral_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Last Referral At
        loyalty_cards:
          items:
            $ref: '#/components/schemas/ClientLoyaltyCardSummary'
          title: Loyalty Cards
          type: array
        points_balance:
          default: 0
          title: Points Balance
          type: integer
        points_earned_period:
          default: 0
          title: Points Earned Period
          type: integer
        points_redeemed_period:
          default: 0
          title: Points Redeemed Period
          type: integer
        referrals_converted_period:
          default: 0
          title: Referrals Converted Period
          type: integer
        referrals_generated_period:
          default: 0
          title: Referrals Generated Period
          type: integer
      required:
        - client_id
      title: ClientBehaviorResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ClientLoyaltyCardSummary:
      description: Resumo de progresso de um programa de cartão de fidelidade.
      properties:
        card_id:
          title: Card Id
          type: string
        completed:
          default: false
          title: Completed
          type: boolean
        max_stamps:
          default: 0
          title: Max Stamps
          type: integer
        stamps:
          default: 0
          title: Stamps
          type: integer
      required:
        - card_id
      title: ClientLoyaltyCardSummary
      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

````