Code examples
Python
import requests
API_KEY = "your_api_key_here"
API_URL = "http://localhost:8000/generate"
def generate_user_data(count=100):
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
payload = {
"rows": count,
"format": "json",
"fields": [
{"name": "id", "type": "integer", "constraints": {"min": 1, "max": 10000}},
{"name": "name", "type": "name"},
{"name": "email", "type": "email"},
{"name": "company", "type": "company"},
{"name": "signup_date", "type": "date", "constraints": {
"start": "2024-01-01",
"end": "2024-12-31"
}},
{"name": "is_active", "type": "boolean"}
]
}
response = requests.post(API_URL, headers=headers, json=payload)
response.raise_for_status()
return response.json()["data"]
# Generate 100 users
users = generate_user_data(100)
print(users)
JavaScript / Node.js
const API_KEY = 'your_api_key_here';
const API_URL = 'http://localhost:8000/generate';
async function generateProductData(count = 50) {
const response = await fetch(API_URL, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
rows: count,
format: 'json',
fields: [
{ name: 'product_id', type: 'uuid' },
{ name: 'name', type: 'string', constraints: { min_length: 5, max_length: 50 } },
{ name: 'price', type: 'float', constraints: { min: 9.99, max: 999.99, precision: 2 } },
{ name: 'in_stock', type: 'boolean' },
{ name: 'created_at', type: 'datetime' }
]
})
});
const result = await response.json();
return JSON.parse(result.data);
}
// Generate 50 products
generateProductData(50).then(products => {
console.log(products);
});
cURL
# Generate customer data as CSV
curl -X POST http://localhost:8000/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"rows": 200,
"format": "csv",
"fields": [
{"name": "customer_id", "type": "integer", "constraints": {"min": 1000, "max": 9999}},
{"name": "full_name", "type": "name"},
{"name": "email", "type": "email"},
{"name": "phone", "type": "phone"},
{"name": "address", "type": "address"},
{"name": "city", "type": "city"},
{"name": "country", "type": "country"}
]
}' | jq -r '.data' > customers.csv
Call Center Metrics
curl -X POST http://localhost:8000/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"rows": 100,
"format": "json",
"fields": [
{"name": "agent_id", "type": "agent_id", "constraints": {"prefix": "AGT", "num_agents": 50}},
{"name": "call_duration", "type": "call_duration", "constraints": {"min": 30, "max": 1800, "mean": 300}},
{"name": "wait_time", "type": "wait_time", "constraints": {"min": 0, "max": 600, "mean": 45}},
{"name": "csat_score", "type": "csat_score", "constraints": {"scale": 5}},
{"name": "sentiment", "type": "sentiment"},
{"name": "call_outcome", "type": "call_outcome"}
]
}'
Generate SQL INSERT Statements
# Generate SQL INSERT statements for seeding a database
curl -X POST http://localhost:8000/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"rows": 50,
"format": "sql",
"table_name": "employees",
"fields": [
{"name": "id", "type": "integer", "constraints": {"min": 1, "max": 1000}},
{"name": "name", "type": "name"},
{"name": "email", "type": "email"},
{"name": "department", "type": "company"},
{"name": "hire_date", "type": "date", "constraints": {"start": "2020-01-01", "end": "2024-12-31"}},
{"name": "is_manager", "type": "boolean"}
]
}' | jq -r '.data' > seed_employees.sql
# Output example:
# INSERT INTO employees (id, name, email, department, hire_date, is_manager)
# VALUES (423, 'John Smith', 'john.smith@example.com', 'Acme Corp', '2023-05-15', TRUE);
Common use cases
Testing & QA
Generate diverse test data to ensure your application handles various scenarios correctly.
Database seeding
Populate development databases with realistic data for local testing.
Demos & prototypes
Create convincing demo data for presentations and client showcases.
Privacy compliance
Replace sensitive production data with synthetic alternatives for safe analysis.
Contact center QA
Generate CSAT scores, wait times, and agent metrics for dashboard and analytics testing.
Demographic surveys
Create realistic age, income, and education distributions for segmentation and survey prototypes.