Free tool
Valid CNJ number generator
Pick the tribunal, year, and origin unit and generate a CNJ number with correct check digits. Ideal for seeding test environments or validating court API integrations.
What is a CNJ generator for?
Testing court API integrations (Vigilant included) requires valid CNJ numbers. Using real numbers is not ideal: you contaminate caches with production data, you violate third-party privacy, and you cannot control the variety of test cases.
This generator produces synthetic numbers with the correct structure: the 7 sequential digits and the 4 origin-unit digits are random, but the check digits are computed by the official mod-97 algorithm (CNJ Resolution 65/2008). Any strict validator — including the decoder at [/en/tools/cnj-decoder](/en/tools/cnj-decoder) — accepts the numbers generated here as valid.
Single-tribunal segments (STF, CNJ, STJ, STM) use the fixed tribunal code `00` because they are national courts with no regional split. For the other segments (Federal, Labor, Electoral, State, and State Military), the generator lists the real tribunals.
Frequently asked questions
What is a CNJ number and how is it structured?
The CNJ (Unique Case Number) is the Brazilian national standard established by CNJ Resolution 65/2008. Format: NNNNNNN-DD.AAAA.J.TR.OOOO — 7 sequential digits, 2 check digits (mod-97), 4-digit year, 1-digit justice segment, 2-digit tribunal, 4-digit origin unit. Total: 20 structured digits.
Do the numbers generated here exist as real cases?
No. The 7 sequential digits and 4 origin digits are random — extremely unlikely to collide with a real case. However the check digits are computed with the official mod-97 algorithm, so any validator (including court APIs) accepts the numbers as structurally valid. Ideal for test environments without polluting production data.
How do I use this generator to test court API integrations?
Generate a number → copy → use it directly in an API request payload (e.g. Vigilant, JUDIT, DataJud). The typical response is "case not found" because the number is synthetic — this validates that your integration correctly parses 404 responses and that auth, rate limiting and retry work, with zero risk of leaking real data.
Is mod-97 the official CNJ check-digit algorithm?
Yes. CNJ Resolution 65/2008 (consolidated by 12/2009) specifies that the 2 check digits are computed by the ISO 7064 mod-97 algorithm. Formula: concatenate NNNNNNN + AAAA + J + TR + OOOO, multiply by 100, take mod 97, subtract from 98. Every strict validator (including our decoder) implements exactly this.
Can I generate numbers in bulk for load testing?
This UI generates one at a time. For bulk (100+), use the logic directly: open DevTools, copy the `generateCnj` function from page source and call it in a loop. Better: use Vigilant API in sandbox mode — it accepts any valid CNJ and responds without charging credits, ideal for load testing.
Related tools
Need to test the Vigilant API?
Vigilant has a free sandbox for every new account. Generate a test number here and use it straight on Vigilant to see the response payload.
Try Vigilant