Guides
Getting started

Quickstart

Activate the sandbox, get the credentials, register the webhook and receive a charge's Pix in a few minutes.

This guide uses the API Pix: you activate the simulator, get a token, register your key's webhook, create a charge, pay it as if you were the customer and receive the webhook.

Prerequisites

  • A Mimicr organization and a write API key (mk_…), created in the organization settings, "Chaves de API" tab.
  • curl, or any HTTP client, and Node 18+ if you want the CLI.
  • A public HTTPS URL that answers 2xx to a POST, to receive webhooks.

1. Activate the Efí sandbox

In the console, open the organization at https://app.mimicr.dev, go to Efí and activate it. Or through the control API:

bash
curl --request POST \
  --url https://api.mimicr.dev/v1/efi/activate \
  --header 'Authorization: Bearer mk_...'

Each organization has one Efí sandbox: an account with Client_Id and Client_Secret, two Pix keys (a random one and an e-mail) and a R$ 1,000.00 balance. The same sandbox serves all six APIs. If it is already active, the call answers 409 efi_already_active.

2. Get the credentials and keys

bash
curl --url https://api.mimicr.dev/v1/efi \
  --header 'Authorization: Bearer mk_...'
json
{
  "active": true,
  "hosts": {
    "pix": "https://pix.efi.mimicr.dev",
    "cobrancas": "https://cobrancas.efi.mimicr.dev",
    "openfinance": "https://openfinance.efi.mimicr.dev/v1",
    "pagarcontas": "https://pagarcontas.efi.mimicr.dev/v1",
    "extratos": "https://extratos.efi.mimicr.dev/v1",
    "abrircontas": "https://abrircontas.efi.mimicr.dev/v1"
  },
  "credentials": { "client_id": "Client_Id_…", "client_secret": "Client_Secret_…" },
  "account": { "conta": "3915556", "agencia": "0001", "nome": "Exemplos Efi", "cnpj": "91881697000102" },
  "keys": [
    { "chave": "d01efe21-d811-41a0-9634-6bb4e7802852", "tipo": "evp" },
    { "chave": "financeiro@exemplos.efi.mimicr.dev", "tipo": "email" }
  ],
  "balance": { "total": 100000, "blocked_med": 0, "available": 100000 },
  "homolog": { "autoPayCob": true, "envioRules": true }
}

The balance values are in cents. With the CLI: npx mimicr login mk_... once, then npx mimicr status efi.

3. Get a token

bash
curl --request POST \
  --url https://pix.efi.mimicr.dev/oauth/token \
  --user '<client_id>:<client_secret>' \
  --header 'Content-Type: application/json' \
  --data '{ "grant_type": "client_credentials" }'
json
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.…",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "cob.write cob.read pix.write pix.read pix.send …"
}

Use access_token in the Authorization: Bearer <token> header of the next calls. There is no certificate: see Authentication.

4. Register the key's webhook

Pix received on a key are reported to that key's webhook.

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

Before saving, Mimicr sends a test POST to the URL, which must answer 2xx. Notifications arrive at https://sua-app.dev/webhooks/efi/pix. Details in Pix webhooks.

5. Create a charge

bash
curl --request POST \
  --url https://pix.efi.mimicr.dev/v2/cob \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "calendario": { "expiracao": 3600 },
    "devedor": { "cpf": "12345678909", "nome": "Francisco da Silva" },
    "valor": { "original": "150.00" },
    "chave": "<chave>",
    "solicitacaoPagador": "Pedido 1234"
  }'

The response is 201 with status: "ATIVA", the generated txid and the pixCopiaECola to build the QR code.

In homologation, charges from R$ 0.01 to R$ 10.00 are paid on their own within a few seconds. With "original": "5.00" you skip step 6. See Homologation rules.

6. Pay as the customer

R$ 150.00 stays ATIVA until someone pays. Play the payer:

bash
npx mimicr action efi pix.pay_cob txid=<txid> nome="Maria Souza" doc=52998224725

Or through the control API:

bash
curl --request POST \
  --url https://api.mimicr.dev/v1/efi/actions/pix.pay_cob \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "txid": "<txid>" }'

The charge becomes CONCLUIDA, the Pix shows up in Get a Pix and the balance goes up.

7. Wait for the webhook

bash
npx mimicr wait efi delivery kind=pix event=PIX_RECEBIDO

The command returns once the delivery exists (up to 25 s by default). Your server receives:

json
{
  "pix": [
    {
      "endToEndId": "E09089356202610212340oZXrYiuEIGF",
      "txid": "<txid>",
      "chave": "<chave>",
      "valor": "150.00",
      "horario": "2026-10-21T23:40:03.282Z"
    }
  ]
}

Next steps