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

# Consultar Cupom

> Consultar detalhes e status de um cupom

# Consultar Cupom

Retorna o estado atual de um cupom da empresa autenticada.

## Comportamento atual

* a resposta retorna `uid`, `status`, `product_name`, `valor`, `expires_at` e `created_at`
* o backend serializa o status atual como `ativo` ou `usado`
* quando o cupom está vinculado a produto, `product_name` é enriquecido nesta rota

## Exemplo de resposta

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "uid": "A1B2C3D4",
    "status": "ativo",
    "product_name": "Pizza Margherita",
    "valor": 200,
    "expires_at": "2026-04-20T08:15:00Z",
    "created_at": "2026-03-20T08:15:00Z"
  }
  ```

  ```json 404 Not Found theme={null}
  {
    "detail": "Cupom não encontrado"
  }
  ```
</ResponseExample>

## Status comuns

* `200` cupom encontrado
* `401` API Key inválida ou revogada
* `403` plano sem `api_access`
* `404` cupom inexistente ou fora da empresa autenticada
* `422` header ou path inválidos
* `429` limite global da API pública excedido


## OpenAPI

````yaml GET /api/v1/public/coupons/{uid}
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/coupons/{uid}:
    get:
      tags:
        - API Pública
      summary: Buscar cupom
      description: Busca dados de um cupom por UID.
      operationId: get_coupon_api_v1_public_coupons__uid__get
      parameters:
        - in: path
          name: uid
          required: true
          schema:
            title: Uid
            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/PublicCouponResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    PublicCouponResponse:
      description: Dados de um cupom.
      properties:
        created_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Created At
        expires_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Expires At
        product_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Product Name
        status:
          title: Status
          type: string
        uid:
          title: Uid
          type: string
        valor:
          anyOf:
            - type: number
            - type: 'null'
          title: Valor
      required:
        - uid
        - status
      title: PublicCouponResponse
      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

````