CPF extractor
Find, validate and extract CPF and CNPJ numbers from a text.
The CPF extractor finds CPF and CNPJ numbers, the Brazilian individual and company taxpayer IDs, inside an already processed text. It validates each one and returns the ones that pass.
Unlike a pattern search, it applies the check-digit algorithms and resolves detection conflicts.
Validation, not just detection
A regular expression finds any sequence shaped like a CPF, including made-up numbers and fragments of other identifiers that happen to match.
This node applies the check-digit calculation and discards whatever doesn't add up. The result is a list of identifiers that are actually valid numbers.
Validating the check digit confirms that the number is well formed, not that it belongs to someone or that it is correct in the context of the document.
Typical use
The common chain has three nodes: File extractor converts the document to text, this node retrieves the identifiers, and an HTTP request node looks each one up in an internal system.
The output is a list, accessible by index when the flow expects a single value, such as {{ extrator_cpf.cpfs[0] }}.
Personal data
CPF and CNPJ are personal data, and what this node extracts flows through the rest of the flow and is recorded in the run.
Check who has access to that workspace's run logs before building a flow that handles documents with this kind of information.
Next steps
- Convert the document first in File extractor.
- Query a system with the result in Integration.