Verify passports in your code
Check a passport offline with a reference verifier, ask OSPP about its current status, or check up to 200 at once when AI-made work arrives.
Three ways to check#
| Way | What it checks | Network | When to use it |
|---|---|---|---|
A reference verifier on the .ospp file | Every rule, V-01 to V-16, on the file you hold | none | Audits, archives, anything you must check without asking OSPP |
A reference verifier with --online | The rules, plus whether the file is the passport's latest state and its current status | one public request | Before you rely on a passport today |
| OSPP's public verification endpoint | The same rules and status, run by OSPP | one request | A web page or a service that only has the passport id |
A file can be valid and still out of date: a passport can be suspended or revoked after issuance, and outcomes are added to its history. Offline checks prove the record; the online check adds what has happened since.
Offline, with a reference verifier#
# TypeScript, one file, Node 20 or later
curl -O https://www.ospp.it.com/build/downloads/ospp-verify.mjs
node ospp-verify.mjs passport.ospp
node ospp-verify.mjs passport.ospp --json --online=https://www.ospp.it.com/api
# Python 3.12 or later
pip install https://www.ospp.it.com/build/downloads/ospp_protocol-0.1.1-py3-none-any.whl https://www.ospp.it.com/build/downloads/ospp_verifier-0.1.1-py3-none-any.whl
ospp-verify passport.ospp --json
Without --online neither verifier makes any network request. Offline, a sound passport gives VALID_WITH_UNDETERMINED, never VALID: rule V-10 (the current status) cannot be decided without asking OSPP. Treat INVALID as failure and read which rules are undetermined.
The Python verifier takes the same option, written --online https://www.ospp.it.com/api; it prints the freshness of the file and the passport's current status.
To know that a passport is official, pin OSPP's production issuer key id with --trusted-issuer=<key id> and check that rule V-04 is VALID and its detail starts with OFFICIAL: . Test the start of the text: a passport that is not official also gives VALID, with a detail that starts with NOT OFFICIAL. The verifier does not reject other passports by itself, and without a pinned issuer it never reports a passport as official. For several keys the Python verifier takes the option once per key; the TypeScript verifier takes one comma-separated value.
Inside a Python program, call the rules directly:
import json
from ospp_protocol.rules import verify_bundle, summarize
bundle = json.load(open("passport.ospp"))
result = summarize(verify_bundle(bundle, frozenset()))
print(result["verdict"]) # INVALID, or VALID_WITH_UNDETERMINED for a sound file
Online, by passport id#
curl -s -X POST https://www.ospp.it.com/api/v1/public/verify \
-H 'content-type: application/json' -d '{"passport_id": "cert_..."}'
The answer has the verdict, every rule with its result, the counts, the passport_status and the file's freshness. The same endpoint accepts {"bundle": ...} with a kept file. No account is needed, and any website may call it.
Many at once#
When a supplier delivers AI-made work with its passports, check them together:
curl -s -X POST https://www.ospp.it.com/api/v1/public/verify/batch \
-H 'content-type: application/json' -d '{"passports": ["cert_...", "https://www.ospp.it.com/p/cert_..."]}'
Up to 200 ids or links per request. Each gets its verdict, status, organisation, node and date. The Platform has the same check under Verify incoming.
