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

# Listar Cartões Fidelidade

> Lista cartões fidelidade, opcionalmente filtrados por cliente

# Listar Cartões Fidelidade

Retorna os progressos de fidelidade da empresa. Pode ser filtrado por cliente específico.

## Comportamento atual

* a resposta é uma lista simples, sem envelope `total`
* cada item representa um `user_loyalty_progress`
* o campo `id` retornado aqui é o identificador que deve ser usado em `POST /loyalty-cards/{card_id}/stamp`

## Query Parameters

<ParamField query="client_id" type="string">
  Filtrar cartões de um cliente específico (UUID)
</ParamField>

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.indiqai.com/api/v1/public/loyalty-cards?client_id=550e8400-e29b-41d4-a716-446655440000" \
    -H "X-API-Key: indiqai_sua_chave_aqui"
  ```

  ```typescript JavaScript theme={null}
  const params = new URLSearchParams({
    client_id: '550e8400-e29b-41d4-a716-446655440000'
  });

  const response = await fetch(
    `https://api.indiqai.com/api/v1/public/loyalty-cards?${params}`,
    {
      headers: { 'X-API-Key': 'indiqai_sua_chave_aqui' }
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import httpx

  response = httpx.get(
      'https://api.indiqai.com/api/v1/public/loyalty-cards',
      params={'client_id': '550e8400-e29b-41d4-a716-446655440000'},
      headers={'X-API-Key': 'indiqai_sua_chave_aqui'}
  )

  data = response.json()
  ```
</CodeGroup>

## Response

<ResponseExample>
  ```json 200 OK theme={null}
  [
    {
      "id": "progress_001",
      "client_id": "550e8400-e29b-41d4-a716-446655440000",
      "stamps": 7,
      "max_stamps": 10,
      "completed": false,
      "created_at": "2025-12-01T10:00:00Z"
    }
  ]
  ```

  ```json 401 Unauthorized theme={null}
  {
    "detail": "API Key inválida ou revogada"
  }
  ```
</ResponseExample>

## Campos da Resposta

<ResponseField name="[].id" type="string">
  ID do progresso (`user_loyalty_progress.id`) usado também na rota de carimbo
</ResponseField>

<ResponseField name="[].client_id" type="string">
  ID do cliente dono do cartão
</ResponseField>

<ResponseField name="[].stamps" type="integer">
  Quantidade atual de carimbos no progresso
</ResponseField>

<ResponseField name="[].max_stamps" type="integer">
  Total de carimbos necessários para completar
</ResponseField>

<ResponseField name="[].completed" type="boolean">
  Se o cartão foi completado
</ResponseField>

<ResponseField name="[].created_at" type="string">
  Data de criação (ISO 8601)
</ResponseField>


## OpenAPI

````yaml GET /api/v1/public/loyalty-cards
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/loyalty-cards:
    get:
      tags:
        - API Pública
      summary: Listar cartões de fidelidade
      description: Lista cartões de fidelidade. Filtra por client_id se informado.
      operationId: list_loyalty_cards_api_v1_public_loyalty_cards_get
      parameters:
        - in: query
          name: client_id
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Client Id
        - 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:
                items:
                  $ref: '#/components/schemas/PublicLoyaltyCardResponse'
                title: Response List Loyalty Cards Api V1 Public Loyalty Cards Get
                type: array
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    PublicLoyaltyCardResponse:
      description: Dados de um cartão de fidelidade.
      properties:
        client_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Client Id
        completed:
          default: false
          title: Completed
          type: boolean
        created_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Created At
        id:
          title: Id
          type: string
        max_stamps:
          default: 0
          title: Max Stamps
          type: integer
        stamps:
          default: 0
          title: Stamps
          type: integer
      required:
        - id
      title: PublicLoyaltyCardResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      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

````