OfficeEvals

Docs / API

API

Scripts can read test sets and models freely. They can also download files and upload results, and for that they need an API key. The Python example needs no extra packages.

Sign in with a key

Create keys in your account after a bot check, up to 5. The key shows only once. We store just a checksum of it. Each key either only reads and downloads, or can also upload results. Downloading files works only for versions you agreed to once in the browser.

Authorization: Bearer oe_…

Endpoints

MethodPathKeyWhat it does
GET/api/v1/setsnoAll test sets, 500 per page. Filters: job, q (2 to 100 characters), sort=new|likes|downloads, page (from 1); next holds the link to the next page or null
GET/api/v1/sets/<id>noOne test set: versions, files with size, SHA-256 and checks, ZIP, canary string, download links
GET/api/v1/modelsnoAll models with results, 500 per page. Filters: q, page (from 1); next as above
GET/sets/<id>/files/<name>?v=<version>yesOne file or the ZIP of a version. Your account must have agreed to this version once in the browser
POST/api/v1/results?version=<version id>&rights=trueyes, upload rightUpload a result (Every Eval Ever 0.3.0 JSON as body). Add anonymised=true if the checks warn
GET/jobs/<job>/data.csv, /jobs/<job>/data.jsonnoLeaderboard of a job as data (CC BY 4.0)
GET/results/<id>/result.jsonnoThe result file of one result

Answers are JSON. Errors come as {"error": "…"} with an HTTP status: 400 bad filter, 401 key missing or wrong, 403 not allowed or no consent yet (with agree_url), 404 not found, 422 the result did not pass the checks, 429 too many requests, 503 uploads are closed. A result upload also lists every problem in errors and every note in warnings; on success it answers 201 with url and warnings.

Limits

Requests per connection120 per minute (API, search, downloads)
Requests per account120 per minute with a key
Result uploads5 per minute, 20 uploads per day in total (browser and API together)
Keys per account5; each can read only, or read and upload results

Python example

# OfficeEvals API: read a test set, download its ZIP, check it, upload a result.
# Python 3.9+, no extra packages. Create a key at https://officeevals.com/account#keys and set OFFICEEVALS_KEY.
import hashlib, io, json, os, urllib.error, urllib.request, zipfile

BASE = "https://officeevals.com"
KEY = os.environ["OFFICEEVALS_KEY"]

def call(url, data=None):
    req = urllib.request.Request(url, data=data, headers={"Authorization": f"Bearer {KEY}"})
    if data is not None:
        req.add_header("Content-Type", "application/json")
    try:
        with urllib.request.urlopen(req) as r:
            return r.read()
    except urllib.error.HTTPError as e:
        raise SystemExit(f"{e.code}: {e.read().decode()}")

# 1. The test set and its newest version
s = json.loads(call(f"{BASE}/api/v1/sets/oe-invoices"))
v = s["versions"][0]
print(s["title"], v["version"], v["tasks"], "tasks")

# 2. The ZIP of this version (agree to its terms once in the browser first)
z = zipfile.ZipFile(io.BytesIO(call(v["zip"]["url"])))
root = f"{s['id']}-{v['version']}/"

# 3. Every file must match SHA256SUMS
lines = z.read(root + "SHA256SUMS").decode().splitlines()
for line in lines:
    digest, name = line.split("  ", 1)
    assert hashlib.sha256(z.read(root + name)).hexdigest() == digest, name
print("all", len(lines), "files match")

# 4. Upload your result (needs a key that may upload results)
with open("result.json", "rb") as f:
    r = json.loads(call(f"{BASE}/api/v1/results?version={v['id']}&rights=true", f.read()))
print(r["url"], r["warnings"])

Keep the key secret, never in shared notebooks or repos. If it leaks, delete it and make a new one. Limits are 120 calls and 5 result uploads a minute, and 20 uploads a day, browser included.