Guides
Account opening

Account opening webhooks and errors

The account opened and refused events, the URL test on registration, retries and the API errors.

Webhooks

Account events go to every URL registered with Register a webhook. At Efí the POST uses mTLS (your server validates Efí's certificate); in Mimicr it goes straight.

json
{ "contaSimplificada": { "identificador": "1c0a1b4a-0ff9-4596-aab7-57b12d864f14" }, "evento": "conta_aberta" }
eventoWhen
conta_abertaThe client approved and the account opened; credentials and certificate now answer
conta_recusada_pelo_cliente_finalThe client refused; a new request for them can be made

On registration, the URL receives a test POST, {"evento": "teste_webhook"}, and must answer 2xx to be saved. To edit a URL, send webhookUrl and its identificadorWebhook. List webhooks accepts inicio, fim, paginacao.paginaAtual and paginacao.itensPorPagina.

Retries

Without a 2xx, Efí retries up to 10 times, at these minutes after the failure: 5, 10, 20, 40, 80, 160, 320, 640, 1280 and 52560. In Mimicr each attempt waits up to 10 seconds. Deliveries are in the control API with api=abrircontas, kind=ac_conta, ref equal to the account identifier and event equal to the event:

bash
npx mimicr wait efi delivery api=abrircontas event=conta_aberta ref=1c0a1b4a-0ff9-4596-aab7-57b12d864f14

With controlled chaos on for the abrircontas area, the request can be refused by the client right at creation (conta_recusada_pelo_cliente_final).

Errors

Format {nome, mensagem}:

json
{ "nome": "webhook_nao_cadastrado", "mensagem": "Sua conta não possui webhook cadastrado na API de Cadastro." }
HTTPnomeWhen
400nomeCompleto_invalido, nome_completo_invalidoNo name, or no last name
400cpf_invalidoInvalid CPF
400data_nascimento_invalida, menoridadeDate not in DD/MM/AAAA, or client under 18
400nome_mae_invalido, celular_invalido, email_invalido, cep_invalidoInvalid contact or address data
400cnpj_invalido, razao_social_invalidaCompany account with an invalid CNPJ or no legal name
400cupom_invalidoCoupon outside 1 to 20 characters
403escopo_invalidoScope outside the allowed list in escoposIntegrados
409solicitacao_duplicadaThere is already an open request for the CPF
409email_cadastrado, celular_cadastradoAlready used by an opened account
412webhook_nao_cadastradoNo webhook registered
404conta_nao_encontradaUnknown account identifier
412conta_nao_aprovada_ou_recusada, conta_em_processamentoCredentials or certificate before the account opens
403quantidade_limite_de_certificadosMore than 5 certificates (Mimicr limit)
400url_webhook, protocolo_da_url, url_cadastrada, chave_invalidaWebhook registration without a URL, without HTTPS, repeated, or unknown identifier
400url_falhou_com_erro, url_inacessivel, limite_de_tempo_atingido_para_urlThe URL failed the test POST
400identificador_webhookUnknown webhook
400data_invalidafim before inicio in the list
404rota_nao_encontradaUnknown route
500erro_aplicacaoInternal error

Mimicr doesn't simulate the Protege+ errors (405) or Efí's CPF restrictions (cpf_restrito, cpf_inativo). Authentication uses 401 invalid_client, 401 invalid_token and 403 insufficient_scope, like the other APIs.