API pública v1

Integre seu operador ao BETGOV

Endpoints de identidade, elegibilidade, limites, eventos e autoexclusão. Ambiente demonstrativo — integração externa não configurada.

Autenticação

Header Authorization: Bearer. Chaves bgv_test_ (sandbox) e bgv_live_ (produção), geradas no Portal do Operador.

Headers

Idempotency-Key em escritas e X-Correlation-Id para rastreabilidade ponta a ponta.

SDKs

SDKs oficiais não publicados. Use os exemplos HTTP abaixo.

Endpoints

OpenAPI JSON
  • post/v1/identity/verifyVerificar identidade e obter subject_token
  • post/v1/eligibility/checkSolicitar decisão de elegibilidade
  • post/v1/limits/checkVerificar limites prudenciais (sem consumo)
  • post/v1/eventsRegistrar evento no ledger imutável
  • post/v1/self-exclusion/checkConsultar autoexclusão/pausa ativa
  • get/v1/decisions/{id}Consultar decisão emitida
  • get/v1/integrations/statusStatus honesto das integrações

Fonte: especificação OpenAPI 3.1 servida em /v1/openapi.json

JavaScript

const r = await fetch('https://betgov.com.br/v1/eligibility/check', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer bgv_test_...',
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(),
  },
  body: JSON.stringify({ subject_token: 'sbj_...' }),
})
console.log(await r.json())

Python

import requests, uuid
r = requests.post('https://betgov.com.br/v1/eligibility/check',
  headers={'Authorization': 'Bearer bgv_test_...', 'Idempotency-Key': str(uuid.uuid4())},
  json={'subject_token': 'sbj_...'})
print(r.json())

Java

HttpRequest req = HttpRequest.newBuilder(URI.create("https://betgov.com.br/v1/eligibility/check"))
  .header("Authorization", "Bearer bgv_test_...")
  .header("Content-Type", "application/json")
  .header("Idempotency-Key", UUID.randomUUID().toString())
  .POST(HttpRequest.BodyPublishers.ofString("{\"subject_token\":\"sbj_...\"}"))
  .build();

C#

var c = new HttpClient();
c.DefaultRequestHeaders.Add("Authorization", "Bearer bgv_test_...");
c.DefaultRequestHeaders.Add("Idempotency-Key", Guid.NewGuid().ToString());
var r = await c.PostAsJsonAsync("https://betgov.com.br/v1/eligibility/check", new { subject_token = "sbj_..." });

PHP

$ch = curl_init('https://betgov.com.br/v1/eligibility/check');
curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ['Authorization: Bearer bgv_test_...', 'Content-Type: application/json'],
  CURLOPT_POSTFIELDS => json_encode(['subject_token' => 'sbj_...'])]);
echo curl_exec($ch);