MockHero

ref

Logic

Generate foreign key references to another table's output. THE KILLER FEATURE — creates proper relational integrity across tables. Every order references a real user ID, every comment references a real post. No orphan records.

Example Outputs

a1b2c3d4-e5f6-4890-abcd-ef1234567890142

Parameters

ParameterDescription
tableReferenced table name (required)
fieldReferenced field name (required)
distributionuniform or power_law

API Usage

Send a POST request to generate ref (foreign key) data:

curl -X POST https://mockhero.dev/api/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "tables": [
    {
      "name": "example",
      "count": 5,
      "fields": [
        {
          "name": "ref",
          "type": "ref",
          "params": {
            "table": "users",
            "field": "id"
          }
        }
      ]
    }
  ]
}'

Common Use Cases

  • Relational data seeding
  • Foreign key integrity
  • Multi-table schemas
  • Database seed scripts

Quick Info

Field Type
ref
Category
Logic
Parameters
3 parameters
Output Format
JSON, CSV, SQL

Try it now

Generate ref (foreign key) data instantly in the playground.

Related Types

Generate Ref (Foreign Key) + 155 more types via API

One API call. Multiple tables. Relational integrity. Free tier included.

Get Started Free