CPF and CNPJ API for Events: Attendee Validation and Invoice Issuance
At CPF.CNPJ, we simplify and streamline access to essential information about individuals and companies.
The Challenge: Attendee Validation and Invoice Issuance at eventos
Ticket sales and event management platforms in Brazil process millions of transactions monthly, from concerts and festivals to corporate conferences and sporting eventos. Law 12.741/2012 and municipal legislation require a valid CPF on the ticket sales invoice, making registration validation a legal requirement that is not only fiscal but operational. Tickets issued with an invalid CPF cause problems: NF-e rejected by the city hall (code 239), inability to enter the event (eventos with strict control require the invoice CPF to match the document), and chargebacks due to customer dissatisfaction.
Ticket sales fraud costs the Brazilian sector R$ 180-250 million annually: scalpers use cloned CPF to buy large batches, resell them illegally, and disappear. When the final buyer tries to use the ticket, the CPF does not match and entry is denied, generating a lawsuit against the platform and organizer. For corporate eventos (conferences, training), empresas require an NF-e with the correct CNPJ to deduct as an expense - an irregular CNPJ results in fiscal rejection and loss of high-value B2B sales (R$ 500-5,000 per corporate ticket).
Event operations require extreme speed: when an artist announces a surprise show or tickets for a championship final are released, the platform processes 50k-100k transactions in 10-30 minutes. Manual CPF validation is unfeasible at this scale. The system must validate CPF in real time during checkout (less than 2 seconds) without creating friction that leads to cart abandonment. In addition, after the event, the platform must issue thousands of NF-e in batch with the correct CPF/CNPJ to avoid massive fiscal rejections that generate operational reissuance costs.
How the CPF.CNPJ API Solves It
1. CPF Validation During Ticket Checkout
The API enables real-time CPF validation during ticket purchase. When the user adds tickets to the cart and fills in checkout data, the system captures the CPF and makes an asynchronous call to the API that returns in 0.4-2 seconds. The system checks: (1) the CPF exists and is Regular; (2) the declared name matches the official name (similarity >75%); (3) if the customer is buying multiple tickets, it validates that it is not a scalper purchase (CPF already used in many recent transactions). If validation fails, checkout displays an error to correct before processing payment.
This prior validation eliminates 89% of event entry problems and 94% of NF-e rejected for invalid CPF. For platforms processing 1-5 million tickets monthly, this represents savings of R$ 2-8 million annually in customer service costs, ticket reissuances, lawsuits, and chargebacks. Integration with ticketing platforms (Sympla, Eventbrite, in-house developments) is simple: a REST endpoint returns validation in JSON that feeds the checkout decision engine.
2. Automated Batch NF-e Issuance
After an event or periodically (daily/weekly), the platform needs to issue NF-e for thousands or hundreds of thousands of tickets sold. Legislation requires the correct CPF/CNPJ on the NF-e. Manual issuance is unfeasible at this scale. The API enables automation: the system generates a list of transactions pending NF-e, validates all CPFs/CNPJs in batch via API (bulk query optimizes costs), and uses the returned official data (correct full name) to generate the XML of the NF-e to be sent to the city hall.
Use of official Receita Federal data (full name without typos, Regular registration status confirmed) reduces the NF-e rejection rate from 15-22% to 1-3%. For a platform issuing 500k NF-e monthly, this represents 90,000 NF-e not rejected, saving R$ 900k-1.5M/month in rework costs (R$ 10-15 per NF-e reissued considering system, support, and time). Integration with issuing systems (NFE.io, Bling, in-house developments) automates the end-to-end flow.
3. B2B Sales for Corporate eventos
Corporate eventos (conferences, training, trade shows) have significant B2B sales: empresas buy batches of tickets for employees. For these sales, the company requires an NF-e with the correct CNPJ to deduct as an expense. The API validates the CNPJ during B2B checkout, returning complete data: official corporate name, registration status, full address. The system checks whether the CNPJ is Active and automatically pre-fills the correct fiscal data on the NF-e.
CNPJ validation also prevents B2B fraud: shell empresas try to buy batches with a cloned or terminated CNPJ to resell tickets. The system detects a Terminated or Unfit CNPJ and blocks the transaction, requiring advance payment or manual review. This reduces B2B chargebacks (high values: R$ 10k-200k per transaction) by 78%. For organizers of large corporate eventos (Web Summit, Campus Party, technical eventos), this protection is critical to financial viability.
Real Case: Meep and NF-e Issuance
Meep, an event ticket management and sales platform processing millions of transactions annually across hundreds of eventos (concerts, festivals, sports, corporate), faced a critical fiscal issuance problem: 18-24% of NF-e issued were rejected by the city hall for invalid CPF or incorrect name, generating massive operational costs. A team of 25 people was dedicated exclusively to reissuing rejected NF-e, at a cost of R$ 2.2M/year + dissatisfaction from customers waiting days for the correct invoice.
Implementing CPF validation via API during checkout + automatic NF-e issuance with official data reduced rejections from 20% to 2.4% in 6 months. Automated flow: (1) Checkout validates CPF in real time, blocking the purchase if irregular; (2) After the event, a batch job validates all CPFs of tickets sold in bulk; (3) The system generates NF-e using official data (correct full name) from the API; (4) NF-e are sent to the city hall via issuer; (5) Only 2.4% rejected (technical errors, not CPF) go to manual reissuance. The reissuance team was reduced from 25 to 4 people. Annual savings: R$ 1.8M in operational costs.
For high-profile eventos (international concerts, large festivals), Meep implemented preventive anti-scalper validation: the system detects when the same CPF tries to buy >10 tickets in 24h or when the purchase pattern indicates a bot (multiple CPFs, same IP, same payment method). Validation via API confirms whether the CPFs are real and regular. The system automatically blocks suspicious scalper purchases, releasing them only after manual review with proof. In 12 months, the system blocked 8,400 scalper purchase attempts, protecting R$ 12M in tickets that would have been resold illegally.
Meep partner organizers reported: (1) 67% reduction in complaints of entry denied due to invalid CPF; (2) 89% reduction in lawsuits over fraudulent tickets; (3) 32-point improvement in buyer NPS. ROI for Meep: an investment of R$ 420k in API integration generated savings of R$ 1.8M/year operational + the incalculable value of protected reputation.
Expected Metrics and ROI
- 89% reduction in entry problemsPreviously validated CPF avoids entry denial at the event
- 94% reduction in rejected NF-eCorrect official data eliminates fiscal rejection due to invalid CPF
- R$ 1.8M annual operational savingsReissuance team reduced from 25 to 4 people
- 8,400 scalper frauds blockedSuspicious pattern detection + CPF validation prevents illegal resale
- R$ 12M in protected ticketsScalper blocking protects organizer revenue
- 67% reduction in entry complaintsPrior validation improves the buyer experience
- 32pp NPS improvementLess friction + guaranteed entry increase satisfaction
- 4,300% ROIPlatform with 1M tickets/year: R$ 420k investment vs R$ 18M/year savings
