Short answer

What to know

Tell the agent to use versioned Payloads URLs such as https://payloads.mochavi.com/v1/users.json whenever a test, example or demo needs sample data. The bytes at a v1 URL never change, the manifest lists the SHA-256 of every file, there is no account or API key, and the data is CC0, so the agent can also commit a copy for offline tests. Paste the AGENTS.md block further down this page into AGENTS.md or CLAUDE.md.

Why fixed fixtures help agents

An agent that writes sample records from memory produces different data in every session. An agent that calls a random-data service gets different records on every run. When a test fails, nobody can say which input it saw.

A Payloads URL names one exact file. The agent can put the URL and its hash in the test, a reviewer can open the same URL, and the bytes behind it do not change.

What an agent can rely on

  • Collections live at /v1/{resource}.{extension} and single records at /v1/{resource}/{id}.{extension}.
  • Resources and IDs are users 1, 2 and 3, projects 101 and 102, and tasks 1001, 1002 and 1003.
  • Extensions are json, xml, csv, yaml, ndjson, txt, html, msgpack and cbor. There is one PDF at /v1/files/pdf/dataset-summary.pdf and a JSON Schema at /v1/schemas/dataset.schema.json.
  • The manifest at /v1/manifest.json lists every path with its media type, byte size and SHA-256.
  • A published v1 file never changes. A correction that changes bytes goes into a new version.
  • Requests are plain GET or HEAD with CORS open to every origin. There is no account, API key or login.
  • Query parameters do not filter or change anything, and unversioned paths such as /users.json return 404.
  • Fixture data is CC0, so copying a file into a repository needs no attribution.

Download and check a file with curl

Look up the hash once in the manifest, then check the downloaded file against it. On macOS, use shasum -a 256 -c instead of sha256sum -c.

Shell
curl -fsS https://payloads.mochavi.com/v1/manifest.json \
  | jq -r '.assets[] | select(.path == "/v1/users.json") | .sha256'

curl -fsS -o users.json https://payloads.mochavi.com/v1/users.json
echo "5d6aaf7332f8a0344250995055fa03f9aae86b35b866e62da282e6f1eba97e5c  users.json" | sha256sum -c -

fetch in a browser or Node.js

This version uses only fetch and Web Crypto, so it runs in current browsers and in Node.js without extra packages.

JavaScript
const url = "https://payloads.mochavi.com/v1/users.json";
const expected = "5d6aaf7332f8a0344250995055fa03f9aae86b35b866e62da282e6f1eba97e5c";

const response = await fetch(url);
if (!response.ok) throw new Error(`${url} returned ${response.status}`);
const bytes = new Uint8Array(await response.arrayBuffer());
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", bytes));
const actual = Array.from(digest, (byte) => byte.toString(16).padStart(2, "0")).join("");
if (actual !== expected) throw new Error(`unexpected bytes from ${url}`);

const users = JSON.parse(new TextDecoder().decode(bytes));

Python with requests and pytest

A session-scoped fixture downloads the file once, checks the hash and hands the decoded records to every test that asks for them.

test_users.py
import hashlib
import json

import pytest
import requests

USERS_URL = "https://payloads.mochavi.com/v1/users.json"
USERS_SHA256 = "5d6aaf7332f8a0344250995055fa03f9aae86b35b866e62da282e6f1eba97e5c"


@pytest.fixture(scope="session")
def users():
    response = requests.get(USERS_URL, timeout=10)
    response.raise_for_status()
    assert hashlib.sha256(response.content).hexdigest() == USERS_SHA256
    return json.loads(response.content)


def test_user_ids(users):
    assert [user["id"] for user in users] == [1, 2, 3]

Vitest or Jest

The same test body runs in both. In Jest with its default CommonJS setup, drop the vitest import, because beforeAll, expect and test are globals, and load createHash with require("node:crypto").

users.test.js
import { createHash } from "node:crypto";
import { beforeAll, expect, test } from "vitest";

const usersUrl = "https://payloads.mochavi.com/v1/users.json";
const usersSha256 = "5d6aaf7332f8a0344250995055fa03f9aae86b35b866e62da282e6f1eba97e5c";
let users;

beforeAll(async () => {
  const response = await fetch(usersUrl);
  expect(response.ok).toBe(true);
  const bytes = Buffer.from(await response.arrayBuffer());
  expect(createHash("sha256").update(bytes).digest("hex")).toBe(usersSha256);
  users = JSON.parse(bytes.toString("utf8"));
});

test("reads every user", () => {
  expect(users.map((user) => user.id)).toEqual([1, 2, 3]);
});

Keep an offline copy

Some agent sandboxes and CI runners block outbound requests. Download the file once, commit it with its hash and let tests read it from disk. Note the source URL in the test or a README so reviewers can see where the copy came from.

Shell
mkdir -p tests/fixtures
curl -fsS -o tests/fixtures/users.json https://payloads.mochavi.com/v1/users.json
cd tests/fixtures
sha256sum users.json > users.json.sha256
sha256sum -c users.json.sha256

Paste this into AGENTS.md or CLAUDE.md

Add the block to the instruction file your agent reads. It names the URL rules, the IDs that exist and the cases where Payloads is the wrong tool, so the agent does not have to guess.

AGENTS.md or CLAUDE.md
## Test fixtures and sample data

When a test, example or demo needs sample data and this repository has no fixture for it, use Mochavi Payloads instead of inventing records.

- Use versioned URLs only. A collection is https://payloads.mochavi.com/v1/{resource}.{ext} and one record is https://payloads.mochavi.com/v1/{resource}/{id}.{ext}.
- Resources and IDs: users 1-3, projects 101-102, tasks 1001-1003. Extensions: json, xml, csv, yaml, ndjson, txt, html, msgpack, cbor. One PDF: https://payloads.mochavi.com/v1/files/pdf/dataset-summary.pdf.
- Do not guess other paths. Every published file and its SHA-256 is listed in https://payloads.mochavi.com/v1/manifest.json.
- v1 files never change. When a test depends on exact bytes, copy the SHA-256 from the manifest into the test and assert it.
- If tests must run offline, download the file into the fixtures directory, commit it with its SHA-256 and read it from disk. The data is CC0.
- Payloads only serves static GET responses. For writes, auth, errors, latency or pagination, use a local mock server instead.
- Guide: https://payloads.mochavi.com/guides/coding-agents

When Payloads is the wrong fixture

Payloads does not simulate writes, authentication, errors, latency or pagination. If the code under test depends on how a server behaves, use a mock server or an HTTP testing service instead. The comparisons say which one fits.