Environments
| Environment | What it is | From your code | Labels |
|---|---|---|---|
| Public demo | A shared sandbox at demo.compute.tlay.io, reset nightly. What to expect | Not directly: the whole site, API included, sits behind an email sign-in. Use its pages, export a bundle, and verify that offline. | Synthetic data, Simulated security, Simulated payment |
| Local stack | The full system on your own machine with Docker: every service, a simulated attestation and a seeded tenant | Yes, with the seeded buyer’s API key. The repository is available on request. | Synthetic data, Simulated security, Simulated payment |
| Pilot deployment | None is running now. A pilot partner would get its own deployment, with hardware-attested workloads on Google Cloud Confidential Space | Yes, once set up, with keys from your buyer account; the API address comes with the pilot | Attested compute; payment stays simulated |
There is no public package to install yet. The TLAY client (device upload, owner signing) and the repository are available on request: write to us. The example on this page needs only the Python standard library, and the offline verifier only the cryptography package.
API keys
- A buyer creates keys under Results & API keys. A key is shown once; the server keeps only its hash. Validity is 1 to 365 days, and a revoked key stops working at once.
- Scopes:
results:readreads tasks, results, receipts, verification and bundles;jobs:runstarts a task the buyer has already purchased. - Send it as
Authorization: Bearer tlay_ak_…. A key acts as its buyer and reaches only the endpoints below; everything else (admin, owner, auditor, purchases, key management) refuses it. - Keep keys in a secret store or an environment variable, never in source code, a browser or a log.
| Call | Scope | Returns |
|---|---|---|
GET /v1/buyer/results | results:read | Your purchased tasks with release id, status, ε, δ, public N and labels |
GET /v1/buyer/results/{release_id}/bundle | results:read | The result bundle: result or sealed document, receipt, verification report, inclusion proof, trust anchors |
GET /v1/buyer/results.csv | results:read | The same list as CSV |
GET /v1/receipts/{receipt_id}, GET /v1/verification/{release_id} | results:read | A receipt, and the server’s verification of it |
POST /v1/jobs with {"policy_id": …} | jobs:run | 202 with a job id and release id; a scope already released returns that release and spends no budget |
GET /v1/jobs/{job_id} | either | Status: reserved, running, then committed, settled, or failed |
Errors, retries and idempotency
- Errors are JSON:
{"code", "message", "request_id"}, sometimes withreason_codes, for exampleFORBIDDENwithAPI_KEY_SCOPE_MISSING. Program against the codes; messages may change. Common codes - Every write needs an
Idempotency-Keyheader. Repeating a write with the same key and body returns the first answer instead of acting twice, so retry a lost answer with the same key. The same key with a different body is refused (IDEMPOTENCY_KEY_REUSED). 429 RATE_LIMITEDcomes withRetry-After; wait that long.- A failed job is final: its budget stays spent and it is never run again. Do not loop on
POST /v1/jobshoping for a different result; each cohort and day has one release. 409 RESULT_NOT_COMMITTEDmeans there is no bundle yet; poll the job instead.
The minimal example
buyer_quickstart.py lists your results, runs a purchased task and waits for it, and downloads a bundle. Our test suite runs it against the local stack on every change, including a refused call with a read-only key.
export TLAY_API_URL=https://<your deployment>/api
export TLAY_API_KEY=tlay_ak_… # results:read, plus jobs:run to start tasks
python3 buyer_quickstart.py list
python3 buyer_quickstart.py run pol_… # needs jobs:run
python3 buyer_quickstart.py bundle rel_… # writes tlay-result-rel_….json
python3 tlay_verify.py tlay-result-rel_….json --anchors pinned.json --strict
The heart of it is one authenticated call:
req = urllib.request.Request(
os.environ["TLAY_API_URL"] + "/v1/buyer/results/" + release_id + "/bundle",
headers={"Authorization": "Bearer " + os.environ["TLAY_API_KEY"]})
bundle = json.load(urllib.request.urlopen(req))
Then verify the bundle against keys you pinned from a source other than the API that gave you the bundle; anchors that come from the same server only show that the bundle agrees with itself. --strict passes only a complete result with hardware attestation, so a local-stack or demo bundle fails it on purpose; leave it out there, and read the verdict and security mode from --json.
Notifications instead of polling
Where a deployment enables webhooks, you can register one in the web app under Notifications (not with an API key). The URL must be public HTTPS; each delivery is signed with the deployment’s published Ed25519 key, and with a shared HMAC secret if you keep one; failed deliveries are retried. Details
Devices and owners
Devices upload through the TLAY client: the ESP32 firmware or the Python reference client, which encrypt each record to the policy and sign it with the device key. Owners sign consent with owner_sign on their own device. Both come with a pilot; see the owner quick start for the flow.