Documentation

MockHero is a developer API that generates realistic, relationally-consistent test data in a single call. Describe what you need with a schema, a plain-English prompt, or a pre-built template and get back production-quality JSON, CSV, or SQL.

Quick Start

Get generating in under a minute. You only need an API key and a single HTTP request.

1

Get an API key

Sign up at mockhero.dev/sign-up and copy your key from the dashboard. All keys start with mh_.

2

Make your first call

Pick one of three input modes below and POST to /api/v1/generate.

3

Use the data

Pipe the JSON response into your database seeder, test suite, or frontend prototype.

Three Input Modes

MockHero accepts three ways to describe the data you need. Each one hits the same POST /api/v1/generate endpoint.

Schema Mode
Full control over every table and field type.

Define your tables, fields, and field types explicitly. Best for precise, reproducible data that exactly matches your database schema.

Most flexible
Prompt Mode
Describe your data in plain English.

Write a natural-language description and MockHero infers the schema for you. Perfect for prototyping or when you want data fast.

Fastest start
Template Mode
Pre-built schemas for common use cases.

Choose from ecommerce, blog, saas, or social templates. Ships with sensible defaults and a scale parameter.

Zero config

Schema Mode

Pass a tables array with explicit field definitions.

curl -X POST https://api.mockhero.dev/api/v1/generate \
  -H "Authorization: Bearer mh_7a1c3b24f8d4e6a9b2c1d3e5f7a8b9c0" \
  -H "Content-Type: application/json" \
  -d '{
  "tables": [
    {
      "name": "users",
      "count": 5,
      "fields": [
        { "name": "id",    "type": "uuid" },
        { "name": "name",  "type": "full_name" },
        { "name": "email", "type": "email" },
        { "name": "plan",  "type": "enum", "params": { "values": ["free","pro","scale"] } }
      ]
    }
  ],
  "format": "json"
}'

Prompt Mode

Pass a prompt string describing the data you need.

curl -X POST https://api.mockhero.dev/api/v1/generate \
  -H "Authorization: Bearer mh_7a1c3b24f8d4e6a9b2c1d3e5f7a8b9c0" \
  -H "Content-Type: application/json" \
  -d '{
  "prompt": "An e-commerce database with 10 customers, 20 orders, and 40 order items with realistic product names and prices",
  "format": "json"
}'

Template Mode

Pass a template name and optional scale multiplier.

curl -X POST https://api.mockhero.dev/api/v1/generate \
  -H "Authorization: Bearer mh_7a1c3b24f8d4e6a9b2c1d3e5f7a8b9c0" \
  -H "Content-Type: application/json" \
  -d '{
  "template": "ecommerce",
  "scale": 2,
  "format": "json"
}'

Example Response

Every successful response wraps the generated data in a consistent envelope.

{
  "data": {
    "users": [
      {
        "id": "e7a1c3b2-4f8d-4e6a-9b2c-1d3e5f7a8b9c",
        "name": "Amara Okafor",
        "email": "amara.okafor@example.com",
        "plan": "pro"
      },
      {
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "name": "Liam Chen",
        "email": "liam.chen@example.com",
        "plan": "free"
      }
    ]
  },
  "meta": {
    "tables": 1,
    "total_records": 5,
    "format": "json",
    "seed": 8827361,
    "generation_time_ms": 142
  }
}

Next Steps