{
  "revision": "2026-10-25.2",
  "api_base": "https://api.luniumpay.com",
  "openapi": "https://docs.luniumpay.com/openapi.json",
  "manual": "https://docs.luniumpay.com/manual",
  "start_url": "https://luniumpay.com/integrar",
  "flows": {
    "custody": {
      "title": "Receber PIX em custódia",
      "description": "Receba em saldo BRL e escolha moeda, rede e endereço somente no saque. Não exige carteira fixa.",
      "sandbox_supported": true,
      "operations": [
        "GET /keys/me",
        "GET /cashin/limits?payer_tax=CPF_DO_PAGADOR",
        "POST /cashin/charge com destino=saldo",
        "GET /cashin/{cashin_id}/status",
        "GET /saldo?customer_ref=CLIENTE",
        "GET /cashin/catalog",
        "POST /saldo/sacar-cripto"
      ],
      "create_example": {
        "amount_cents": 5000,
        "payer_tax_number": "CPF_REAL_DO_PAGADOR",
        "destino": "saldo",
        "customer_ref": "cliente-42",
        "external_id": "deposito-cliente42-001"
      },
      "completion": "Crédito confirmado: status=paid E settlement_status=sent. Confira disponivel_cents no escopo correto."
    },
    "cashin": {
      "title": "PIX com entrega direta em cripto",
      "description": "Cada cobrança pode indicar sua moeda, rede e carteira. Consulte as rotas e os mínimos vigentes antes de cobrar.",
      "sandbox_supported": true,
      "operations": [
        "GET /cashin/catalog",
        "POST /cashin/preview",
        "GET /cashin/limits?payer_tax=CPF_DO_PAGADOR",
        "POST /cashin/charge com destino=cripto",
        "GET /cashin/{cashin_id}/status"
      ],
      "create_example": {
        "amount_cents": 5000,
        "payer_tax_number": "CPF_REAL_DO_PAGADOR",
        "destino": "cripto",
        "asset": "USDT",
        "chain": "polygon",
        "payout_address": "CARTEIRA_INFORMADA_PELO_CLIENTE",
        "external_id": "compra-cripto-001"
      },
      "completion": "PIX pago: status=paid. Envio registrado: settlement_status=sent. Confirmação on-chain registrada: settlement_proof=confirmed e settlement_confirmed_at. broadcast significa envio sem confirmação registrada; ausência de confirmação não prova falha. simulated é apenas teste."
    },
    "cashout": {
      "title": "Pagar PIX com cripto e receber comprovante",
      "description": "Informe uma chave PIX e o valor em BRL, ou a quantidade de cripto. Para pagar uma cobrança existente, envie o PIX copia e cola completo: atualmente USDT/USDC em rotas compatíveis. A pessoa envia a cripto após revisar e aceitar a cotação.",
      "sandbox_supported": true,
      "operations": [
        "GET /catalog",
        "POST /cash-outs",
        "POST /cash-outs/{cashout_id}/accept",
        "GET /cash-outs/{cashout_id}"
      ],
      "create_example": {
        "asset": "USDT",
        "network": "polygon",
        "amount": "10",
        "pix_key": "sandbox@example.invalid",
        "pix_key_type": "email",
        "external_id": "sandbox-cashout-001"
      },
      "completion": "state=COMPLETED confirma o PIX pago. Entregue pix_e2e e os links retornados receipt_url, receipt_pdf_url e verify_url. Links podem surgir depois: acompanhar a mesma ordem ou cashout.receipt_ready, sem novo pagamento."
    },
    "payout": {
      "title": "Pagar PIX com saldo de custódia",
      "description": "Use somente saldo BRL recebido por PIX, da casa ou subconta. Máximo R$ 6.000,00 por PIX, sujeito a limites menores da conta e às taxas atuais da API. CPF/CNPJ válido do recebedor é obrigatório e pode ser derivado de uma chave CPF/CNPJ válida. Carteira USDT é separada e depende de habilitação; seus limites vêm da cotação, não deste teto.",
      "sandbox_supported": true,
      "operations": [
        "GET /keys/me",
        "GET /saldo?customer_ref=CLIENTE",
        "POST /payouts",
        "GET /payouts/{payout_id}"
      ],
      "create_example": {
        "amount_cents": 5000,
        "pix_key": "CHAVE_PIX_DO_DESTINATARIO",
        "pix_key_type": "email",
        "customer_ref": "cliente-42",
        "external_id": "saque-pix-cliente42-001",
        "tax_number": "CPF_OU_CNPJ_VALIDO_DO_RECEBEDOR",
        "funding_source": "pix_brl"
      },
      "completion": "Payout confirmado: status=sent. Em timeout, conserve external_id e consulte a ordem original. Em 409 external_id_divergente ou external_id_nao_verificavel, use payout_id/recovery_endpoint; não gere outro ID para contornar. Em 503 idempotencia_indisponivel, aguarde e consulte o mesmo ID."
    },
    "usdt_wallet": {
      "title": "Carteira USDT/USDC: saldo em cripto e PIX pago com ele",
      "description": "Deposite USDT ou USDC em várias redes e pague PIX com esse saldo, por chave PIX ou Copia e Cola. Liberada para todas as chaves de produção.",
      "sandbox_supported": true,
      "operations": [
        "GET /carteira-usdt",
        "POST /carteira-usdt/deposits",
        "GET /carteira-usdt/deposits",
        "POST /carteira-usdt/quote",
        "POST /carteira-usdt/payments",
        "GET /carteira-usdt/payments/{payment_id}",
        "GET /carteira-usdt/statement"
      ],
      "create_example": {
        "amount": "100",
        "network": "tron"
      },
      "completion": "Depósito creditado: status=available em GET /carteira-usdt/deposits (ou webhook wallet.deposit_credited). PIX pago: status=concluido e final=true, com pix_e2e e receipt_url (ou webhook wallet.payment_completed)."
    }
  },
  "sandbox": {
    "simulates": [
      "PIX charge with non-payable QR and explicit simulated payment",
      "custody BRL credit and held balances",
      "crypto delivery and custody withdrawal for supported snapshot routes",
      "PIX payout from custody",
      "subaccount transfers",
      "cashout quote, accept and state progression",
      "signed webhook outbox, retries and delivery history"
    ],
    "does_not_simulate": [
      "real bank or partner exchange execution",
      "current market prices, route availability or production risk ladder",
      "real blockchain confirmations"
    ],
    "safety": "All funds are fictitious. Confirm PIX through POST /sandbox/cashin/{cashin_id}/pay only. Never pay the QR in a bank or deposit crypto. Production requires real providers, permissions and available funds.",
    "guide": "https://docs.luniumpay.com/sandbox",
    "capabilities": "GET /sandbox",
    "key_creation": {
      "request": "POST /keys/sandbox",
      "body_example": {
        "email": "you@company.com",
        "name": "my-integration"
      },
      "required": [
        "email"
      ],
      "email": "The e-mail of the person who will test. LuniumPay support sends it one message about a minute later: what LuniumPay is, the 3-step integration, manual and PDF, flowchart and VendaCripto. One message per address, with an unsubscribe link. Ask the person for it; never invent or reuse an address.",
      "missing_email": "HTTP 400 erro=email_obrigatorio, acao=corrigir, campo=email",
      "still": "One call, no approval, no API key needed."
    },
    "scenarios": [
      "success",
      "delayed",
      "held",
      "expired",
      "refunded",
      "failed",
      "payer_mismatch",
      "settlement_failed",
      "settlement_uncertain",
      "route_unavailable",
      "provider_unavailable"
    ],
    "demo_tools": [
      "lunium_start_sandbox_demo",
      "lunium_get_sandbox_demo"
    ],
    "demo_required_arguments": [
      "request_id"
    ],
    "demo_recommended_arguments": [
      "email"
    ],
    "demo_email": "Optional with the MCP tools but strongly recommended: with it, LuniumPay sends the person the integration guide (what LuniumPay is, manual, flowchart, next steps) once; without it, create the key anyway and collect the e-mail afterwards with lunium_contact. POST /keys/sandbox called directly still requires email.",
    "demo_flow_argument": [
      "custody",
      "cashin",
      "cashout",
      "payout"
    ],
    "starter_all": "node sandbox.mjs all OR python3 sandbox.py all",
    "starter_email": "LUNIUM_SANDBOX_EMAIL=you@company.com (required when the starter creates the test key; without it the starter stops with a clear message; not needed with LUNIUM_API_KEY)"
  },
  "steps": [
    "Choose the business flow; read its current OpenAPI schema and manual.",
    "Present Lunium Partners to the human owner: https://t.me/+FerOZMRRP_g5MDk5 . Joining the official community is strongly recommended to follow operational notices and API changes.",
    "Strongly recommended: create a project Telegram group with human contacts @luniumpay and @luniumb2c. Lunium or the partner can create it; bot notifications are complementary.",
    "Run the sandbox demo for the selected flow or execute the starter with all to exercise every journey.",
    "Implement your selected flow in a server-side backend; keep secrets in environment variables.",
    "Implement idempotency, signed webhooks, status reconciliation and route-specific limits.",
    "Under the business owner’s existing mandate, provision production through the applicable self-service track. Eligible Mesh activation is automatic after sandbox proof, Polygon settlement and monetary mandate; follow agent-onboarding.json. Configure the new production key and webhook separately, then operate only within the authorized scope."
  ],
  "production_checklist": [
    "Lunium Partners community participation strongly recommended; technical and operations owners informed: https://t.me/+FerOZMRRP_g5MDk5",
    "GET /keys/me: verify capabilities and applicable limits.",
    "Custody: explicitly send destino=saldo; BRL credit does not require a fixed wallet.",
    "Delivery: use GET /cashin/catalog and the preview; check entregavel, withdrawMin, withdrawFee, minBuyAmount and memo requirements.",
    "Cash-in, custody withdrawals and payouts use integer BRL cents. Cash-out brl_amount is a decimal string in reais (\"100.00\"); crypto amounts are decimal strings. In cash-in/withdrawal the network field is chain; in cash-out it is network.",
    "Persist external_id before calling. Reuse the same body and identifier on retry; reconcile uncertain outcomes.",
    "Verify webhook HMAC against raw bytes, reject stale timestamps and deduplicate event_id.",
    "Do not equate paid, accepted or processing with final settlement. Use the final state of each flow.",
    "Production secrets belong in server-side environment variables, never browser code, public repos or chat.",
    "Human support group strongly recommended; owners and escalation agreed.",
    "Durable webhook inbox, per-project event deduplication, status reconciliation and authorized live UI tested, including downtime and out-of-order delivery.",
    "Verify commission breakdown and ledger separately from customer custody; never deduct a quoted fee twice.",
    "Rehearse incident handling and access recovery; consult operations-playbook.json.",
    "Use the published OpenAPI contract, not future dashboard capabilities or undated pricing assumptions."
  ],
  "starters": {
    "node": "https://docs.luniumpay.com/starter/sandbox.mjs",
    "python": "https://docs.luniumpay.com/starter/sandbox.py",
    "curl": "https://docs.luniumpay.com/starter/curl.md",
    "skills": "https://github.com/LuniumPay/lunium-agent-skills"
  },
  "kit": "https://docs.luniumpay.com/starter/lunium-starter.zip",
  "chatgpt": {
    "mcp_url": "https://api.luniumpay.com/mcp/onboarding",
    "authentication": "none for the public onboarding endpoint",
    "tools": "Integration plan, public catalog, sandbox demo and opt-in contact. No production account operations.",
    "setup": "In an eligible ChatGPT account/workspace, enable Developer Mode and add the HTTPS MCP URL in the app/plugin connection settings. Availability depends on account and workspace policy.",
    "without_connector": "Paste the integration brief and documentation URL into ChatGPT or your coding agent. Run the generated code in your own backend.",
    "production": "The onboarding connection does not authorize access to production accounts. The full MCP supports host-configured X-API-Key; account linking through ChatGPT OAuth is not implemented.",
    "official_setup": "https://developers.openai.com/plugins/deploy/connect-chatgpt",
    "official_auth": "https://developers.openai.com/plugins/build/auth"
  },
  "human_support": {
    "strongly_recommended": true,
    "api_requirement": false,
    "group_created_by": [
      "Lunium",
      "partner team"
    ],
    "human_contacts": [
      "https://t.me/luniumpay",
      "https://t.me/luniumb2c"
    ],
    "notification_bot": "https://t.me/LuniumNotifyBot",
    "guide": "https://docs.luniumpay.com/manual#telegram"
  },
  "live_tracking": {
    "guide": "https://docs.luniumpay.com/manual#monitor-ao-vivo",
    "private_monitor": "monitor_url returned by GET /keys/me or POST /keys; /monitor in linked Telegram group",
    "monitor_poll_ms": 3000,
    "balance_poll_ms": 15000,
    "feed": "GET /cashin/events",
    "feed_kind": "Recent project snapshot; no replay cursor, not a complete transition log or ledger",
    "partner_ui": "Authenticated partner backend -> durable webhook inbox -> status reconciliation -> SSE/WebSocket/polling implemented by partner",
    "public_lunium_sse_websocket": false,
    "recovery": [
      "GET /webhooks/deliveries",
      "POST /webhooks/deliveries/{event_id}/retry"
    ],
    "security": "Keep API key and webhook secret server-side; private monitor token grants read access to the whole project, not just one customer."
  },
  "lunium_partners": {
    "name": "Lunium Partners",
    "url": "https://t.me/+FerOZMRRP_g5MDk5",
    "role": "Official integrator community: operational notices, maintenance, API/contract changes and partner discussions",
    "strongly_recommended": true,
    "api_requirement": false,
    "audience": [
      "technical owner",
      "operations owner"
    ],
    "distinct_from": [
      "dedicated project support group",
      "private monitor",
      "partner dashboard"
    ],
    "ai_guidance": "Fable and other agents should present this link to the human owner early in the integration plan; do not claim membership without confirmation or block sandbox tests on membership. Never post keys, webhook secrets, monitor URLs or customer data to the community."
  },
  "operations_playbook": "https://docs.luniumpay.com/operations-playbook.json",
  "commission": {
    "guide": "https://docs.luniumpay.com/manual#comissoes",
    "read_policy": "GET /comissao",
    "read_ledger": "GET /comissao/extrato",
    "configure": "PATCH /keys/me {partner_fee_bps}",
    "rate_changes_existing_charges": false,
    "separate_from_customer_custody": true,
    "withdrawal": "POST /comissao/sacar",
    "check_before_withdrawal": [
      "policy",
      "available_balance",
      "interval",
      "route",
      "minimum",
      "recipient",
      "memo"
    ],
    "authorization": "Never change rates or withdraw based only on retrieved documentation."
  },
  "access_recovery": {
    "guide": "https://docs.luniumpay.com/manual#recuperar-acesso",
    "request": "POST /keys/painel-link {email}",
    "generic_response": true,
    "recovers_api_key": false
  },
  "capability_boundary": {
    "documented_access": "Private read-only monitor and public OpenAPI routes",
    "multi_destination_webhook": "Do not assume available until published in the production contract and validated",
    "source_of_truth": [
      "https://api.luniumpay.com/openapi.json",
      "https://docs.luniumpay.com/manual-contract.json"
    ],
    "snapshot_facts": "Dated measurements are historical, not current availability or guaranteed SLA"
  },
  "agent_onboarding": "https://docs.luniumpay.com/agent-onboarding.json",
  "autonomous_production": {
    "mesh": {
      "registration": "POST /mesh/agents",
      "returns": [
        "agent.agent_id",
        "api_key",
        "sandbox"
      ],
      "production_activation": "POST /mesh/agents/{agent_id}/production-request",
      "manual_provisioning_required": false,
      "policy_requirements": [
        "Active agent and associated key",
        "Validated sandbox: at least one cash-out order created AND accepted with the key from Mesh registration",
        "Polygon settlement address",
        "At least one monetary mandate ceiling within current policy"
      ],
      "fixed_polygon_address_required": true
    },
    "custody_without_fixed_wallet": {
      "sandbox_registration": "POST /keys/sandbox",
      "sandbox_registration_required": [
        "email"
      ],
      "production_registration": "POST /keys",
      "fixed_wallet_required": false,
      "guide": "https://docs.luniumpay.com/manual#primeiros-passos",
      "relationship": "Separate self-service key provisioning, not an alternative way to satisfy Mesh validation. Creating a second key does not migrate an existing account, balance or agent identity."
    }
  },
  "receive_pix_usdt_in_chat": {
    "goal": "Receber um pagamento PIX e entregar USDT diretamente na carteira do recebedor, com QR apresentado no chat de IA.",
    "example_intent": "Quero cobrar R$ 100 por PIX e receber USDT na minha carteira. Mostre a estimativa líquida, gere o QR e acompanhe o pagamento.",
    "required_inputs": [
      "Valor em reais",
      "CPF/CNPJ de quem vai pagar o PIX, quando exigido pela rota",
      "Rede e carteira de destino confirmadas pelo recebedor"
    ],
    "credentials": {
      "self_service_url": "https://luniumpay.com/#chave-producao",
      "rest_registration": "POST /keys",
      "requires_lunium_sales_contact": false,
      "full_mcp_url": "https://api.luniumpay.com/mcp",
      "full_mcp_authentication": "X-API-Key configurada pelo host compatível, fora do chat",
      "public_mcp_limitation": "/mcp/onboarding permite descoberta e simulação; conexão de conta de produção via OAuth ainda não está implementada."
    },
    "sequence": [
      "Consultar GET /keys/me e GET /cashin/catalog; selecionar USDT em rota entregavel=true compatível com a carteira informada.",
      "Consultar POST /cashin/preview para valor líquido estimado, taxas e mínimo vigente. Não prometer câmbio travado.",
      "Persistir external_id por intenção e criar POST /cashin/charge com destino=cripto, asset=usdt, chain e payout_address do recebedor.",
      "Mostrar a imagem QR retornada e qr_copypaste completo, valor BRL e expires_at. Nunca recriar o conteúdo do PIX com IA.",
      "O pagador paga o PIX no aplicativo bancário. Em sandbox, simular pelo endpoint de teste; nunca pagar QR simulado.",
      "Consultar o mesmo cashin_id: separar PIX recebido, envio cripto e confirmação registrada. Apresentar quantidade, rede, carteira e settlement_tx_url quando houver."
    ],
    "recovery": [
      "Timeout: consultar a cobrança original pelo external_id antes de repetir; reutilizar a mesma intenção.",
      "PIX pago ou retido: explicar o estado e o prazo retornado, sem pedir outro pagamento.",
      "Falha, devolução ou estado incerto: apresentar o estado e a próxima ação da API; nunca anunciar entrega sem evidência."
    ],
    "measurement": [
      "Chave criada",
      "Cobrança criada",
      "QR persistido (não prova exibição no chat)",
      "PIX pago",
      "Envio cripto registrado",
      "Confirmação on-chain registrada quando coberta"
    ]
  },
  "pay_pix_with_crypto_in_chat": {
    "goal": "Descobrir pela IA como pagar PIX com cripto, obter cotação e instrucoes de deposito e acompanhar até o comprovante.",
    "example_intent": "Quero pagar R$ 100 para esta chave PIX usando minha cripto. Mostre a cotação, a rede e o endereço de deposito; depois acompanhe e entregue o comprovante.",
    "entry_modes": {
      "pix_key": "pix_key e exatamente um de brl_amount (alvo em BRL, decimal em string) ou amount (cripto decimal em string). Confira e aprove o brl_amount efetivo retornado; arredondamentos podem diferir do alvo. CPF/telefone ambíguos exigem pix_key_type.",
      "br_code": "PIX copia e cola completo de uma cobrança; não enviar pix_key, amount ou brl_amount junto. Atualmente USDT/USDC nas redes aceitas; não substituir cobrança recusada por transferencia a chave extraida."
    },
    "scope": "Oferecer moedas e redes do catálogo vigente e sujeitas a cotação. Nem todo token/rede ou tipo de cobrança PIX e aceito. Nao prometer tempo total fixo.",
    "mcp_tools": [
      "lunium_list_settlement_options",
      "lunium_quote_crypto_sale",
      "lunium_confirm_crypto_sale",
      "lunium_get_crypto_sale"
    ],
    "sequence": [
      "Identificar chave PIX e valor em reais, ou receber br_code completo; selecionar moeda e rede que a carteira de origem suporta.",
      "Consultar catálogo, criar cotação com external_id persistente e mostrar BRL, cripto, destino, custos e vencimento retornados. Se houver copia_e_cola_buffer_usd, explicar o custo já incluido.",
      "Confirmar os termos dentro da autorização do usuário e aceitar a ordem. Somente a resposta de accept fornece deposit_address e deposit_tag quando necessaria.",
      "A pessoa envia a quantidade exata de cripto pela rede indicada, incluindo memo/tag se retornado, antes do vencimento. Nao mandar PIX para iniciar este fluxo nem reutilizar endereços de outras ordens.",
      "Acompanhar o mesmo cashout_id: deposito detectado, confirmações, conversao/liquidacao e PIX pago.",
      "Em COMPLETED, mostrar BRL pago e pix_e2e; entregar receipt_url, receipt_pdf_url e verify_url quando retornados. Se o comprovante estiver sendo preparado, continuar a mesma consulta."
    ],
    "recovery": [
      "Timeout na criacao: recuperar por external_id, nunca criar automaticamente uma nova intenção.",
      "Timeout no accept: consultar a mesma ordem; não orientar segundo deposito.",
      "MANUAL_REVIEW e PAYING_OUT não confirmam PIX nem devolução; continuar acompanhamento.",
      "AWAITING_REFUND_ADDRESS requer endereço confirmado do cliente na rede informada; deposit_from e apenas informativo. Acompanhar REFUNDED e refund_tx_hash sem prometer ativo/valor original.",
      "EXPIRED sem deposito exige nova cotação apenas se a pessoa ainda quiser pagar. Havendo deposito tardio ou divergente, conciliar a ordem original."
    ],
    "credentials": "MCP completo /mcp exige credencial configurada no host. /mcp/onboarding apenas descobre e simula; vincular conta de produção via OAuth continua pendente.",
    "sandbox": "Testar com fundos fictícios. Nunca enviar cripto a endereços de sandbox."
  },
  "agent_skills": {
    "install": "npx skills add LuniumPay/lunium-agent-skills",
    "repo": "https://github.com/LuniumPay/lunium-agent-skills",
    "page": "https://docs.luniumpay.com/skill",
    "version": "2.2.0",
    "api_version": "1.45.2",
    "skills": [
      "luniumpay",
      "luniumpay-pix-charge",
      "luniumpay-custody",
      "luniumpay-webhooks",
      "luniumpay-crypto-sale",
      "luniumpay-usdt-wallet",
      "luniumpay-verify-payment"
    ],
    "note": "Skills are short by design; the live OpenAPI, llms.txt and this file remain the source of truth. Sandbox scripts refuse production keys and move no real funds. go-live.mjs creates the production key, registers the webhook, stores secrets on the host (never printed) and reads POST /webhooks/test; it moves no money either.",
    "claude_code_marketplace": {
      "add": "/plugin marketplace add LuniumPay/lunium-agent-skills",
      "install": "/plugin install luniumpay@lunium-agent-skills"
    },
    "scaffold": "node luniumpay/scripts/init.mjs --email you@company.com",
    "developer_portal": "https://github.com/LuniumPay/luniumpay",
    "go_live": "node luniumpay/scripts/go-live.mjs --name \"Business\" --email you@company.com --webhook https://your-domain/api/webhooks/lunium --vercel --deploy",
    "production_guide": "https://github.com/LuniumPay/lunium-agent-skills/blob/main/luniumpay/references/producao.md",
    "smoke_scripts": [
      "luniumpay-pix-charge/scripts/smoke.mjs",
      "luniumpay-custody/scripts/smoke-custody.mjs",
      "luniumpay-crypto-sale/scripts/smoke-cashout.mjs",
      "luniumpay-webhooks/scripts/verify-webhook.test.mjs"
    ]
  }
}
