sa-id-validator
Validate South African ID numbers in Python 3.8+. Zero dependencies.
from sa_id_validator import validate_sa_id, is_valid_sa_id
r = validate_sa_id("8001015009087")
r.valid, r.date_of_birth, r.gender, r.citizenship
# (True, datetime.date(1980, 1, 1), "male", "citizen")
validate_sa_id("8001015009088").reason # "checksum"
is_valid_sa_id("800101 5009 087") # True (spaces and dashes are ignored)
What it checks
- 13 digits
- A real date of birth in the first six digits (leap years included, no future dates)
- Citizenship digit: 0 citizen, 1 permanent resident, 2 refugee
- The Luhn check digit
reason is format, date_of_birth, citizenship or checksum when a number fails.
What it does not check
A number can pass every check and still not belong to anyone. This library only reads the structure of the number. To confirm that an ID number and name match the Home Affairs record, use a verification service such as the CheckID ID Verification API.
Test numbers
CheckID's SA ID test cases list valid and invalid numbers for your own tests. The same rules are explained step by step in how the SA ID checksum works.
Licence
MIT
Metadata
Release files for sa-id-validator 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sa_id_validator-1.0.0.tar.gz | 4.0 kB | Without provenance | Details for sa_id_validator-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sa_id_validator-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for sa_id_validator-1.0.0-py3-none-any.whl |
Total release size: 8.0 kB
Release files / sa_id_validator-1.0.0.tar.gz
| Download URL | sa_id_validator-1.0.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8c40755fecb12d26302b3232e5eb1bf1a23687e8452af48dfa9ea1f0f9782c2
|
|
BLAKE2b-256 checksum How to use checksums |
7a4c6d14edd5bfdec8ba9336b973e45cc96cfc4b3ecb365ab93fa8ee3e0782b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Release files / sa_id_validator-1.0.0-py3-none-any.whl
| Download URL | sa_id_validator-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c83cae0544cd8cd0ac812181c705255280cc12a97ff1e5e4d00c2931bd2aa12
|
|
BLAKE2b-256 checksum How to use checksums |
2d22642bace472e45930be98a6fe11682a0299f8c4108c031d4de0fc3dbe42b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Security for sa-id-validator 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.