# Zero Proof Labs API keys

Authenticate every request to Zero Proof Labs hosted endpoints (the
simulation engine and hosted models) with an API key.

## Get a key

Sign in at https://www.zeroproofai.com/platform and create named keys
there (up to 5 active per account, e.g. one per machine or environment).
Keys look like `zp_` followed by 48 hex characters. Deleting a key on
that page deactivates it immediately.

## Use it

Send the key as the `X-Api-Key` header on every request:

```bash
curl https://zeroproofai--zeroproof-studio-api-serve.modal.run/api/... \
  -H "X-Api-Key: zp_..."
```

```python
import requests

resp = requests.post(
    "https://zeroproofai--zeroproof-studio-api-serve.modal.run/api/...",
    headers={"X-Api-Key": "zp_..."},
    json={...},
)
```

Store the key in an environment variable (`ZEROPROOF_API_KEY`); never
commit it. If a key leaks, delete it on the platform page and create a
new one.

## Daily allowance

Your account has one free daily allowance shared across all of its
keys, so creating more keys never adds quota:

| Limit | Amount |
| --- | --- |
| Input tokens | 500,000 per day |
| Output tokens | 1,000,000 per day |

Counters reset at midnight UTC. Current usage is shown on the platform
page next to your key.

## Responses

| Status | Meaning | What to do |
| --- | --- | --- |
| 401 | Missing, malformed, or deleted key | Check the `X-Api-Key` header; manage keys at /platform |
| 429 | Daily allowance exhausted | Wait for the midnight UTC reset, or contact jacob@zeroproofai.com for a higher limit |

## Datasets

Your key also stores datasets (JSONL rollouts) on Zero Proof Labs, 5 GB
per account, so the optimization framework can iterate on them:

```bash
BASE=https://wch04mgo2k.execute-api.us-east-1.amazonaws.com
KEY="X-Api-Key: $ZEROPROOF_API_KEY"

# 1. register: returns datasetId and a presigned uploadUrl (15 min)
curl -X POST $BASE/datasets -H "$KEY" -d '{"name":"github-explore-v1"}'
# 2. upload the file to uploadUrl
curl -X PUT "<uploadUrl>" -H "Content-Type: application/jsonl" --data-binary @rollout.jsonl
# 3. finalize (records size, marks ready)
curl -X POST $BASE/datasets/<datasetId>/finalize -H "$KEY"

curl $BASE/datasets -H "$KEY"                        # list + storage used
curl $BASE/datasets/<datasetId>/download -H "$KEY"   # presigned downloadUrl
curl -X DELETE $BASE/datasets/<datasetId> -H "$KEY"  # permanent
```

Pass `"parentDatasetId": "ds_..."` when registering an iteration of an
existing dataset, so lineage shows on the platform.

## Contact

jacob@zeroproofai.com
