Skip to main content
Glama

get_sales_history

Retrieve sales history with filters for date range, product, buyer, or status. Default returns approved and completed transactions.

Instructions

Sales History

Retorna o histórico de vendas. Sem os filtros transaction ou transaction_status, apenas vendas com status APPROVED e COMPLETE são retornadas.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
max_resultsNoNúmero máximo de resultados por página
page_tokenNoToken de paginação para a próxima página
product_idNoID do produto
start_dateNoData inicial (timestamp em milissegundos desde epoch)
end_dateNoData final (timestamp em milissegundos desde epoch)
sales_sourceNoOrigem da venda
transactionNoCódigo da transação
selectNoSeleção de campos customizados na resposta
buyer_nameNoNome do comprador
buyer_emailNoE-mail do comprador
offer_codeNoCódigo da oferta
commission_asNoPapel de comissão do usuário autenticado. Values: PRODUCER, COPRODUCER, AFFILIATE
transaction_statusNoStatus da transação. Values: APPROVED, BLOCKED, CANCELLED, CHARGEBACK, COMPLETE, EXPIRED, NO_FUNDS, OVERDUE, PARTIALLY_REFUNDED, PRE_ORDER, PRINTED_BILLET, PROCESSING_TRANSACTION, PROTESTED, REFUNDED, STARTED, UNDER_ANALISYS, WAITING_PAYMENT
payment_typeNoTipo de pagamento. Values: BILLET, CASH_PAYMENT, CREDIT_CARD, DIRECT_BANK_TRANSFER, DIRECT_DEBIT, FINANCED_BILLET, FINANCED_INSTALLMENT, GOOGLE_PAY, HOTCARD, HYBRID, MANUAL_TRANSFER, PAYPAL, PAYPAL_INTERNACIONAL, PICPAY, PIX, SAMSUNG_PAY, WALLET

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual handler function for 'get_sales_history' tool. Calls the Hotmart API endpoint '/payments/api/v1/sales/history' with optional query parameters and returns the JSON result.
    async def get_sales_history(
        max_results: Optional[int] = None,
        page_token: Optional[str] = None,
        product_id: Optional[int] = None,
        start_date: Optional[int] = None,
        end_date: Optional[int] = None,
        sales_source: Optional[str] = None,
        transaction: Optional[str] = None,
        select: Optional[str] = None,
        buyer_name: Optional[str] = None,
        buyer_email: Optional[str] = None,
        offer_code: Optional[str] = None,
        commission_as: Optional[str] = None,
        transaction_status: Optional[str] = None,
        payment_type: Optional[str] = None,
    ) -> str:
        """Sales History
        
        Retorna o histórico de vendas. Sem os filtros transaction ou transaction_status, apenas vendas com status APPROVED e COMPLETE são retornadas.
        
        Args:
            max_results: Número máximo de resultados por página
            page_token: Token de paginação para a próxima página
            product_id: ID do produto
            start_date: Data inicial (timestamp em milissegundos desde epoch)
            end_date: Data final (timestamp em milissegundos desde epoch)
            sales_source: Origem da venda
            transaction: Código da transação
            select: Seleção de campos customizados na resposta
            buyer_name: Nome do comprador
            buyer_email: E-mail do comprador
            offer_code: Código da oferta
            commission_as: Papel de comissão do usuário autenticado. Values: PRODUCER, COPRODUCER, AFFILIATE
            transaction_status: Status da transação. Values: APPROVED, BLOCKED, CANCELLED, CHARGEBACK, COMPLETE, EXPIRED, NO_FUNDS, OVERDUE, PARTIALLY_REFUNDED, PRE_ORDER, PRINTED_BILLET, PROCESSING_TRANSACTION, PROTESTED, REFUNDED, STARTED, UNDER_ANALISYS, WAITING_PAYMENT
            payment_type: Tipo de pagamento. Values: BILLET, CASH_PAYMENT, CREDIT_CARD, DIRECT_BANK_TRANSFER, DIRECT_DEBIT, FINANCED_BILLET, FINANCED_INSTALLMENT, GOOGLE_PAY, HOTCARD, HYBRID, MANUAL_TRANSFER, PAYPAL, PAYPAL_INTERNACIONAL, PICPAY, PIX, SAMSUNG_PAY, WALLET"""
        endpoint = "/payments/api/v1/sales/history"
        params = {}
        if max_results is not None:
            params["max_results"] = max_results
        if page_token is not None:
            params["page_token"] = page_token
        if product_id is not None:
            params["product_id"] = product_id
        if start_date is not None:
            params["start_date"] = start_date
        if end_date is not None:
            params["end_date"] = end_date
        if sales_source is not None:
            params["sales_source"] = sales_source
        if transaction is not None:
            params["transaction"] = transaction
        if select is not None:
            params["select"] = select
        if buyer_name is not None:
            params["buyer_name"] = buyer_name
        if buyer_email is not None:
            params["buyer_email"] = buyer_email
        if offer_code is not None:
            params["offer_code"] = offer_code
        if commission_as is not None:
            params["commission_as"] = commission_as
        if transaction_status is not None:
            params["transaction_status"] = transaction_status
        if payment_type is not None:
            params["payment_type"] = payment_type
        result = await get_client().get(endpoint, params=params)
        return json.dumps(result, indent=2)
  • Input parameters (schema) for get_sales_history: all optional, including max_results, page_token, product_id, date range, filters like buyer_name/email, sales_source, transaction, etc.
    async def get_sales_history(
        max_results: Optional[int] = None,
        page_token: Optional[str] = None,
        product_id: Optional[int] = None,
        start_date: Optional[int] = None,
        end_date: Optional[int] = None,
        sales_source: Optional[str] = None,
        transaction: Optional[str] = None,
        select: Optional[str] = None,
        buyer_name: Optional[str] = None,
        buyer_email: Optional[str] = None,
        offer_code: Optional[str] = None,
        commission_as: Optional[str] = None,
        transaction_status: Optional[str] = None,
        payment_type: Optional[str] = None,
  • Auto-discovery registration: server.py iterates all modules in hotmart_mcp.tools, finds each async function (including get_sales_history), and registers it via mcp.tool()(obj).
    def _discover_and_register_tools() -> int:
        """Import all modules under hotmart_mcp.tools and register async functions."""
        registered = 0
    
        for module_info in pkgutil.iter_modules(tools_pkg.__path__, prefix=f"{tools_pkg.__name__}."):
            if module_info.name.endswith("__init__"):
                continue
    
            module = importlib.import_module(module_info.name)
    
            for name, obj in inspect.getmembers(module, iscoroutinefunction):
                if name.startswith("_"):
                    continue
                mcp.tool()(obj)
                registered += 1
    
        return registered
  • Shared helper get_client() used by get_sales_history to obtain the HotmartClient singleton for making API calls.
    """Shared lazy singleton for the Hotmart API client."""
    
    from __future__ import annotations
    
    from hotmart_mcp.client import HotmartClient
    
    _client: HotmartClient | None = None
    
    
    def get_client() -> HotmartClient:
        global _client
        if _client is None:
            _client = HotmartClient()
        return _client
  • Documentation string describing the tool behavior and listing all possible enum values for transaction_status and payment_type.
    """Sales History
    
    Retorna o histórico de vendas. Sem os filtros transaction ou transaction_status, apenas vendas com status APPROVED e COMPLETE são retornadas.
    
    Args:
        max_results: Número máximo de resultados por página
        page_token: Token de paginação para a próxima página
        product_id: ID do produto
        start_date: Data inicial (timestamp em milissegundos desde epoch)
        end_date: Data final (timestamp em milissegundos desde epoch)
        sales_source: Origem da venda
        transaction: Código da transação
        select: Seleção de campos customizados na resposta
        buyer_name: Nome do comprador
        buyer_email: E-mail do comprador
        offer_code: Código da oferta
        commission_as: Papel de comissão do usuário autenticado. Values: PRODUCER, COPRODUCER, AFFILIATE
        transaction_status: Status da transação. Values: APPROVED, BLOCKED, CANCELLED, CHARGEBACK, COMPLETE, EXPIRED, NO_FUNDS, OVERDUE, PARTIALLY_REFUNDED, PRE_ORDER, PRINTED_BILLET, PROCESSING_TRANSACTION, PROTESTED, REFUNDED, STARTED, UNDER_ANALISYS, WAITING_PAYMENT
        payment_type: Tipo de pagamento. Values: BILLET, CASH_PAYMENT, CREDIT_CARD, DIRECT_BANK_TRANSFER, DIRECT_DEBIT, FINANCED_BILLET, FINANCED_INSTALLMENT, GOOGLE_PAY, HOTCARD, HYBRID, MANUAL_TRANSFER, PAYPAL, PAYPAL_INTERNACIONAL, PICPAY, PIX, SAMSUNG_PAY, WALLET"""
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses a key behavioral trait (default filtering to APPROVED/COMPLETE statuses), but omits other aspects like pagination behavior, rate limits, or response structure that an agent would need.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very concise (two short sentences) with no redundant information. It front-loads the purpose and immediately adds a critical behavioral note. However, it could benefit from a slightly more structured format.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (14 parameters, no annotations, but output schema exists), the description provides only the essential default filter context. It does not cover pagination, error handling, or typical usage patterns, which would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds minimal extra meaning for only two parameters (transaction and transaction_status) regarding default filtering, but does not enhance understanding of the other 12 parameters beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool returns sales history ('Retorna o histórico de vendas') and adds important behavior about default status filtering. However, it does not explicitly differentiate from sibling tools like get_sales_summary or get_sales_commissions, slightly limiting its distinctiveness.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for retrieving sales history and notes the default status filter, but it lacks explicit guidance on when to use this tool versus alternatives, and does not provide exclusion criteria or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/thaleslaray/hotmart-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server