Your First API Call
Get started with Tork in three simple steps. By the end of this guide, you'll have made your first content evaluation request.
Create Your Account
Sign up for a free Tork account to get started.
Create your account at the Tork dashboard. The free tier includes:
- 5,000 API calls per month
- Access to all evaluation endpoints
- Basic analytics dashboard
- Email support
Get Your API Key
Generate an API key from your dashboard.
Once logged in, click API Keys in the dashboard sidebar and click "Generate New Key".
tork_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxKeep your API key secure. Never expose it in client-side code or public repositories.
Make Your First Call
Install the SDK and scan text for PII.
Two different packages — pick deliberately
Want a receipt in your dashboard? Install @torknetwork/sdk. Want the decision to never leave your machine? Install tork-governance.
tork-governance (the Python and JavaScript blocks below) decides on your machine. tork-governance makes the governance decision on your machine. PII detection, redaction and the returned verdict are computed on-device. With no API key it makes zero network calls: prompts, completions and detected PII values never leave the machine, and nothing appears in your dashboard.
@torknetwork/sdk and the cURL example send content to Tork, which makes the decision server-side and writes a receipt to your dashboard. Different package, different trust model. The API key in step 2 is for those — the on-device blocks below do not use it.
Supply an API key and the SDK additionally reports a metadata-only attestation of each decision — the action taken, PII type labels and counts, a risk classification, policy labels and a salted fingerprint. It never sends input text, output text or PII values. The decision itself is still made on-device and is never delayed or changed by reporting. Those attestations appear in your dashboard and are included in the daily on-chain anchor — each one recorded as a client attestation (capture_mode=edge, attested_by=client), a claim Tork recorded but did not execute and cannot independently verify. Requires tork-governance 0.24.0+ (PyPI) or 0.11.0+ (npm).
A decision reported by an on-device SDK is recorded as a client attestation (capture_mode=edge, attested_by=client): a claim Tork recorded but did not execute and cannot independently verify. A decision made by @torknetwork/sdk is recorded as capture_mode=cloud, attested_by=tork — Tork made that call itself. Both are equally immutable once anchored; they differ in what is immutable. A client attestation freezes your claim. A server-governed receipt freezes Tork's own decision.
Python — on-device (tork-governance)
JavaScript — on-device (tork-governance)
JavaScript — cloud, server-governed (@torknetwork/sdk)
This sends your content to Tork's API and writes a receipt to your dashboard. Replace YOUR_API_KEY with your actual API key from step 2:
receipt_id is what to look for in your dashboard — its presence is how you know the call actually reached Tork's servers. On the on-device path above, the local result.receipt.receipt_id looks identical but never leaves your machine, which is exactly what made that path indistinguishable from success when nothing was actually sent.
cURL — server-governed (Tork decides)
This sends your content to Tork, which makes the decision and writes a receipt to your dashboard as capture_mode=cloud attested_by=tork. Unlike the on-device blocks above, this is the path that populates your dashboard today. Replace YOUR_API_KEY with your actual API key:
Expected Response
Understanding the Response
| action | Governance decision: allow, redact, or deny |
| redacted | Text with PII replaced by placeholders |
| original | The original input text |
| pii_detected | Array of detected PII with types and positions |
| processing_time_ms | Time to process in milliseconds |
| request_id | Unique ID for this request (useful for debugging) |
Bonus: Test PII Detection
See how Tork detects sensitive PII
Try this example to see how Tork detects sensitive PII like SSN and credit cards:
Response (Unsafe Detected)
Notice how action: "deny" blocks high-risk PII and the pii_detected array shows what was found.
You're All Set!
You've successfully made your first API call. Explore the full documentation to discover all available endpoints and features.
Quick Reference
https://tork.network/api/v1Authorization: Bearer <key>application/json5,000 calls/month