Guides
API Pix

Pix Automático

Create recurrences, ask for the payer's authorization in journeys 1 to 4 and charge each cycle with recurring charges.

Pix Automático is Pix's direct debit. You create a recurrence (/v2/rec), the payer authorizes it in their banking app, and each cycle you create a recurring charge (/v2/cobr) that settles on its own on the date. Events arrive in two account webhooks: /rec and /cobr.

Efí does not document how to simulate the payer in homologation. In Mimicr, you are the payer: the pixauto.* actions of the control API (and the console buttons) authorize, reject and cancel recurrences and decide charges.

1. Register the webhooks

bash
curl --request PUT \
  --url https://pix.efi.mimicr.dev/v2/webhookrec \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{ "webhookUrl": "https://sua-app.dev/webhooks/efi" }'

Do the same on /v2/webhookcobr. These are account-wide webhooks (no key in the path), they answer 200 and notifications arrive at webhookUrl + /rec and webhookUrl + /cobr.

2. Create the recurrence

bash
curl --request POST \
  --url https://pix.efi.mimicr.dev/v2/rec \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "vinculo": {
      "contrato": "63100862",
      "devedor": { "cpf": "12345678909", "nome": "Fulano de Tal" },
      "objeto": "Serviço de Streaming"
    },
    "calendario": { "dataInicial": "2026-10-28", "periodicidade": "MENSAL" },
    "valor": { "valorRec": "35.00" },
    "politicaRetentativa": "PERMITE_3R_7D"
  }'
json
{
  "idRec": "RR0908935620261021vy9znbckwfq",
  "status": "CRIADA",
  "valor": { "valorRec": "35.00" },
  "politicaRetentativa": "PERMITE_3R_7D",
  "ativacao": { "tipoJornada": "AGUARDANDO_DEFINICAO" },
  "atualizacao": [{ "data": "2026-10-21T23:40:47.039Z", "status": "CRIADA" }]
}

Use valor.valorRec (fixed amount) or valor.valorMinimoRecebedor (variable amount, the payer sets the ceiling), never both. periodicidade is SEMANAL, MENSAL, TRIMESTRAL, SEMESTRAL or ANUAL. dataInicial cannot be in the past. Errors are problem+json (RecOperacaoInvalida).

3. Ask for the authorization

The journey depends on the payer's path:

JourneyHowIn Mimicr, the payer authorizes with
JORNADA_1Recurrence without loc; you send POST /v2/solicrec to the payer's accountpixauto.answer_solic idSolicRec=<id> accept=true
JORNADA_2POST /v2/locrec, recurrence with loc; the payer scans the QR from GET /v2/rec/:idRec (dadosQR.pixCopiaECola)pixauto.approve_rec idRec=<id> jornada=JORNADA_2
JORNADA_3Like 2, plus a cob in ativacao.dadosJornada.txid; the composite QR from GET /v2/rec/:idRec?txid=<txid> pays the cob and authorizespixauto.approve_rec idRec=<id> jornada=JORNADA_3 (pays the cob)
JORNADA_4Like 2, with a cobv; the composite QR comes from GET /v2/rec/:idRec?txid=<cobv txid>pixauto.approve_rec idRec=<id> jornada=JORNADA_4 cobvTxid=<txid>

In journey 1, the request moves on its own through CRIADA, ENVIADA and RECEBIDA within seconds:

bash
curl --request POST \
  --url https://pix.efi.mimicr.dev/v2/solicrec \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "idRec": "RR0908935620261021vy9znbckwfq",
    "calendario": { "dataExpiracaoSolicitacao": "2026-10-22T23:40:47.307Z" },
    "destinatario": { "agencia": "0001", "conta": "123456", "cpf": "12345678909", "ispbParticipante": "60746948" }
  }'
bash
npx mimicr action efi pixauto.answer_solic idSolicRec=SC0908935620261021ol22pd86q1j accept=true

The recurrence becomes APROVADA with ativacao.tipoJornada: "JORNADA_1" and the /rec webhook receives:

json
{
  "recs": [
    {
      "idRec": "RR0908935620261021vy9znbckwfq",
      "status": "APROVADA",
      "ativacao": { "tipoJornada": "JORNADA_1" },
      "atualizacao": [
        { "data": "2026-10-21T23:40:47.039Z", "status": "CRIADA" },
        { "data": "2026-10-21T23:41:02.120Z", "status": "APROVADA" }
      ]
    }
  ]
}

With accept=false, the request and the recurrence become REJEITADA. There is no request webhook: follow /rec or GET /v2/solicrec/:idSolicRec.

4. Charge each cycle

With the recurrence APROVADA, create the cycle's charge at least 2 days ahead:

bash
curl --request PUT \
  --url https://pix.efi.mimicr.dev/v2/cobr/3136957d93134f2184b369e8f1c0729d \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "idRec": "RR0908935620261021bpo4rn59u8l",
    "infoAdicional": "Mensalidade",
    "calendario": { "dataDeVencimento": "2026-10-28" },
    "valor": { "original": "35.00" },
    "ajusteDiaUtil": true,
    "recebedor": { "agencia": "0001", "conta": "123456", "tipoConta": "PAGAMENTO" }
  }'
  1. The charge starts CRIADA and within seconds becomes ATIVA, with an AGND attempt AGENDADA for the due date.
  2. On the settlement date, on the sandbox clock, the attempt is paid: the charge becomes CONCLUIDA, the Pix goes into the balance and the /cobr webhook receives {"cobsr": [...]} with the pix array.
  3. To skip the wait, advance the clock: npx mimicr clock efi +7d.

For another outcome, decide before the date: npx mimicr action efi pixauto.decide_cobr txid=<txid> result=falhar (the attempt fails; if no retry is possible, the charge becomes EXPIRADA) or result=rejeitar (the payer's PSP rejects it, REJEITADA). With politicaRetentativa PERMITE_3R_7D, after a failure you schedule another attempt with POST /v2/cobr/:txid/retentativa/:data, up to 3 times within 7 days.

Recurring charge rules:

  • The recurrence must be APROVADA.
  • valor.original equal to valorRec (or at least valorMinimoRecebedor), and a due date up to the recurrence's dataFinal.
  • One live charge per recurrence cycle.
  • ajusteDiaUtil: true moves a Saturday or Sunday settlement to Monday. Mimicr does not simulate holidays.
  • PATCH /v2/cobr/:txid with {"status": "CANCELADA"} only before the date of the first attempt.

Closing

  • You cancel with PATCH /v2/rec/:idRec and {"status": "CANCELADA"}.
  • The payer cancels with pixauto.cancel_rec idRec=<id> by=pagador, or rejects a CRIADA recurrence with pixauto.reject_rec.
  • Once dataFinal passes, the recurrence becomes EXPIRADA.

Cancelling or rejecting the recurrence cancels the open requests and charges, and every change arrives through the /rec and /cobr webhooks.

Reference: Create a recurrence, Create a confirmation request, Create a recurring charge with txid and Request a retry.