# Execution receipts

Every background job gets an execution receipt: what ran and how, recorded by the platform. Once the job has ended, WBX can sign it, so anyone can check it was not edited afterwards.

## What is in a receipt

`GET /v1/jobs/{id}/receipt` (Python `job.receipt()`, MCP `get_job_summary` with `detail=receipt`):

- **Inputs** – the full command and its SHA-256, working directory, time limit, compute class, result file patterns, required files, input files from other jobs (path, source job, size, SHA-256), the WebAssembly module's SHA-256 for `wasi` jobs, and the names of env variables. Env values and their hashes are never in the receipt.
- **Template build** (`template_build`) – which build of the template the sandbox started from: source image and its digest, when it was built on that server, `spec_sha256` (the template definition – the same on every server) and `rootfs_sha256` (the template disk of that build; each server builds templates itself, so this can differ between servers). Jobs from before 0.15.59 and `wasi` jobs have `null`.
- **Run** – runtime and isolation, server, network policy, timing, exit code, CPU time and peak memory measured inside the VM (`null` when they cannot be measured; for `wasi` jobs the runtime is `wasi` with `wasm-process` isolation, and run time, exit code and peak module memory are measured by the WASI runtime on the server, not in a VM).
- **Outputs** – result files with size and SHA-256, the size and SHA-256 of the log, recognised test results, and the cost of the sandbox run time at your plan's rates.

> **What a receipt is not.** The receipt is an operational record of the platform, not a proof that the computation could not have been altered.

## Signed receipts

Once a job has ended, `GET /v1/jobs/{id}/receipt?signed=1` returns the receipt signed by WBX with Ed25519: `{"signed_receipt": {"format", "alg", "key_id", "payload", "signature"}}`. `payload` holds the exact signed bytes (base64 of a JSON object with `execution_receipt`, `key_id` and `signed_at`), so nothing has to be re-serialised to check it. A job that has not ended yet returns `409`.

Anyone with the public key from `GET /v1/receipt-keys` (no API key needed) can check the receipt was not edited after WBX issued it – useful when it is shared with another team or an auditor. Keep the key you trust instead of fetching it each time from the same server. A signature proves who issued the receipt and that it is unchanged; it does not prove the computation itself could not have been altered.

## Verify a signed receipt

**Python**

```
# pip install "wbxsandbox[verify]"
import json
from wbxsandbox import get_job, receipt_keys, verify_receipt

key = receipt_keys()[0]["public_key"]         # base64 Ed25519 – keep the key you trust
content = verify_receipt(get_job("job_…").signed_receipt(), key)
print(content["execution_receipt"]["artifacts"])

# a file downloaded from the portal works the same way
verify_receipt(json.load(open("receipt.json")), key)   # ValueError if it was changed
```

**OpenSSL**

```
curl -s https://sandbox.wbx.cz/v1/receipt-keys | jq -r '.keys[0].public_key_pem' > wbx.pem
curl -s -H "X-API-Key: $WBXSANDBOX_API_KEY" "https://sandbox.wbx.cz/v1/jobs/JOB_ID/receipt?signed=1" > signed.json
jq -r .signed_receipt.payload signed.json | base64 -d > payload.bin
jq -r .signed_receipt.signature signed.json | base64 -d > sig.bin
openssl pkeyutl -verify -pubin -inkey wbx.pem -rawin -in payload.bin -sigfile sig.bin   # OpenSSL 3
jq .execution_receipt payload.bin                                                        # read only after it verified
```

The **Download signed receipt** button on a finished job in the portal saves exactly this response, so the same commands work on the downloaded file.

Source: https://sandbox.wbx.cz/docs/jobs/receipts
