Getting Started
Configuration
Configure Tork for your environment with API keys, regional PII profiles, and advanced options.
API Key Setup
Keep your API key in the environment and read it in your own code when constructing the client — an API key is only needed to reach the Tork cloud:
Never commit API keys to version control. Add .env to your .gitignore file.
Client Configuration
An API key configures the cloud client — @torknetwork/sdk (npm install @torknetwork/sdk), whose entry class is TorkClient. The on-device tork-governance family is a different package with a different entry class (Tork) and needs no key to make a decision:
There is no Python cloud SDK. From Python, send the key as a Bearer token:
To govern locally instead, install the on-device package and construct Tork. Its decision is synchronous and needs no network:
Regional PII Profiles
The optional region parameter activates jurisdiction-specific PII detection patterns on top of the always-on default set — for example Aadhaar numbers for in, Emirates IDs for ae, or NHS numbers for gb. It is an array, so several profiles can be combined. It does not change where your request is processed or where any record is stored; for hosting locations see the Data Residency page.
When region is omitted, Tork infers profiles from the caller's IP and from signals in the content. An explicit value always wins. The response reports which profiles ran in detected_regions and how they were chosen in region_detection.
| Code | Jurisdiction | Example patterns activated |
|---|---|---|
| au | Australia | ACN, +61 phone formats |
| us | United States | ITIN, US passport |
| gb | United Kingdom | NHS number, National Insurance number, sort code |
| eu | European Union | German Tax ID (Steuer-IdNr) |
| ae | United Arab Emirates | Emirates ID, UAE phone formats |
| in | India | Aadhaar, PAN, IFSC |
| za | South Africa | SA ID number, SA phone formats |
Also available: sa, ng, jp, cn, kr, ca, br. Codes are case-insensitive; an unknown code activates nothing. The full pattern list per profile is on the PII Detection page.
Environment Variables Reference
Neither SDK reads these automatically — pass options to the client (or the Bearer header) yourself. These names are the convention used throughout our examples and by the CLI.
| Variable | Description | Default |
|---|---|---|
| TORK_API_KEY | Cloud API key, sent as a Bearer token. Not needed for on-device governance. | Required for cloud |
Next Step: Learn about PII Detection to start protecting sensitive data.