🎓 CoursesMarkets & internationalAdvanced⏱ 60 min

Pix in depth: integration and operations. 7 chapters and a final quiz.

Pix from the engine room, for teams that collect at volume. Resolve a Pix key without draining your DICT token bucket, defend your keys against an ownership claim, choose between a static QR code, cob and cobv, wire up the fixed schedule of Pix Automático, handle a refund (devolução) and answer an infraction report, anchor reconciliation on the EndToEndId, keep collecting through night-time limits, and put the DICT's fraud statistics to work.

Chapter 1. The DICT is a quota, not a phone book.

The DICT (Diretório de Identificadores de Contas Transacionais) maps a Pix key to account details. Integrations that break in production almost never break on that mapping. They break on rationing. The Banco Central do Brasil meters lookups per user and per participant, and refuses service when the counter hits zero. A team that ignores this mechanism until go-live finds out through a spike in HTTP 429 errors.

What the DICT will store, and how much

  • Five Pix keys per transactional account for a holder registered under a CPF (the individual taxpayer ID), 20 for a holder registered under a CNPJ (the business registration number). The limit applies to the account, however many joint holders it has (Manual Operacional do DICT, version 8.4, Banco Central do Brasil).
  • One key, one account. The same identifier can never point to two transactional accounts at once.
  • The DICT generates the random key (chave aleatória); the user does not choose it. It is a UUID in RFC 4122 format, and it cannot be customized.
  • Storage formats: CPF as 11 digits, CNPJ as 14 alphanumeric characters, both without periods or hyphens; phone numbers in E.164 format; email addresses of up to 77 characters.
  • The name shown to the payer comes from the Receita Federal, Brazil's federal tax authority. For a legal entity, the Name field carries the registered legal name (razão social) and the TradeName field the trade name (nome fantasia), but only if it appears in the CNPJ registration. For an individual microentrepreneur (microempreendedor individual), TradeName must be left empty.

Every lookup carries the PI-PayerId header. It holds the CPF or CNPJ of the user who will pay, as bare digits, and it must stay the same across all of that user's lookups at a given participant. The DICT uses it to track two counters: lookups that led to no payment order, and lookups on unregistered keys. The second costs 20 times as much as the first.

BucketMaximum sizeDeductionCreditRefill over time
Individual end user100 tokens per bucket; one bucket for phone and email, another for CPF, CNPJ, and random key1 token per valid lookup, 20 tokens per invalid lookup+1 token when the lookup is followed by a payment order received by the SPI, the BCB's instant settlement system2 tokens per minute, in each bucket
Legal-entity end user1,000 tokens per bucket, same split1 token per valid lookup, 20 tokens per invalid lookup+2 tokens per lookup followed by an order received by the SPI20 tokens per minute, in each bucket
ParticipantFrom 50,000 down to 50 tokens, depending on the category the BCB assigns1 token per valid lookup, 3 tokens per invalid lookup+1 token per lookup followed by an order received by the SPIDepends on the category
The token bucket applied to the getEntry operation (Manual Operacional do DICT v8.4, Banco Central do Brasil)
CategoryBucket sizeRefill per minute
A50 00025 000
B40 00020 000
C30 00015 000
D16 0008 000
E5 0002 500
F500250
G25025
H502
The eight participant categories: the BCB assigns them, and it can downgrade a participant it suspects of a scraping attack
⚠️
A missing key costs 20 times as much as a found one
The example comes straight from the manual. An individual user whose bucket holds 5 tokens looks up an unregistered key. The DICT responds NOT FOUND with HTTP 404 and deducts 20 tokens, leaving a balance of −15. At two tokens per minute, that user cannot run another lookup for eight minutes. An empty bucket returns RATE LIMITING with HTTP 429, and a free-text key field with no client-side format validation produces exactly that outcome at scale.
🔑
The standard fix: checkKeys and the existence cache
The manual provides the tool that avoids the penalty. The `checkKeys` operation takes a set of candidate keys and returns the ones registered in the DICT; it is for the participant's internal use only. It feeds a Pix key existence cache, which the participant uses to manage its buckets and to prepare bulk payments. Entries derived from payment-initiation lookups and from portability or claim processes are kept for 30 days. The cache may store only three things: the SHA-256 hash of the key and the two update dates. Not the key in plain text, not the holder's data, not the account data.
🎯 Quick question
A form lets customers type in a Pix key with no format validation. Many entries match no registered key. What is the direct effect at the DICT?