DOCUMENTATION
Code Examples
Python
import requests
API_KEY = "your_api_key_here"
API_URL = "https://your-domain.com/api/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 = 'https://your-domain.com/api/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 https://your-domain.com/api/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
Generate SQL INSERT Statements
# Generate SQL INSERT statements for seeding a database
curl -X POST https://your-domain.com/api/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.