DDLData
Documentation

DDL to Data API Guide

Everything you need to generate realistic test data from your SQL schemas

Getting Started

DDL to Data lets you generate realistic test data from SQL CREATE TABLE statements in three simple steps:

1

Get API Key

Sign up for free to get your API key

2

Create Schema

POST your CREATE TABLE DDL

3

Generate Data

GET realistic JSON data

Authentication

All API requests require authentication via the X-API-Key header.

curl -H "X-API-Key: your_api_key_here" \
  https://ddltodata.com/schemas

Keep Your Key Secret

Your API key grants access to your account. Never expose it in client-side code or public repositories.

API Endpoints

GET/schemas

Retrieve a list of all your registered schema names.

Response

{
  "tables": ["users", "orders", "products"]
}

Example

curl -H "X-API-Key: YOUR_KEY" \
  https://ddltodata.com/schemas
POST/schemas

Register a new schema by providing a name and your CREATE TABLE DDL statement.

Parameters

namestringrequired- Unique table name
ddlstringrequired- SQL CREATE TABLE statement

Request Body

{
  "name": "users",
  "ddl": "CREATE TABLE users (
    id SERIAL PRIMARY KEY,
    first_name VARCHAR(50),
    last_name VARCHAR(50),
    email VARCHAR(100) UNIQUE,
    created_at TIMESTAMP
  );"
}

Response

{
  "message": "Schema 'users' created successfully"
}

Example

curl -X POST https://ddltodata.com/schemas \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"users","ddl":"CREATE TABLE users (id INT, name VARCHAR(50), email VARCHAR(100));"}'
GET/generate/{table_name}

Generate synthetic JSON data for the specified table. The data will have realistic values based on column names.

Parameters

table_namestringrequired- Name of the schema to generate data for
rowsinteger- Number of rows to generate (default: 10, max: 10000)

Response

[
  {
    "id": 1,
    "first_name": "Sarah",
    "last_name": "Johnson",
    "email": "sarah.johnson@gmail.com",
    "created_at": "2024-03-15T09:23:41"
  },
  {
    "id": 2,
    "first_name": "Michael",
    "last_name": "Chen",
    "email": "m.chen@outlook.com",
    "created_at": "2024-03-14T14:56:12"
  }
]

Example

curl -H "X-API-Key: YOUR_KEY" \
  "https://ddltodata.com/generate/users?rows=100"
DELETE/schemas/{table_name}

Delete an existing schema and remove it from your account.

Parameters

table_namestringrequired- Name of the schema to delete

Response

{
  "message": "Schema 'users' deleted successfully"
}

Example

curl -X DELETE https://ddltodata.com/schemas/users \
  -H "X-API-Key: YOUR_KEY"
GET/me

Get information about your account, including plan details and usage statistics.

Response

{
  "email": "you@example.com",
  "plan": "free",
  "calls_month": 45,
  "rows_month": 2500,
  "quota_calls_month": 100,
  "quota_rows_month": 5000
}

Example

curl -H "X-API-Key: YOUR_KEY" \
  https://ddltodata.com/me

Smart Data Types

DDL to Data automatically detects column types based on names and generates appropriate realistic values:

Column PatternGenerated DataExample
id, *_idSequential integers1, 2, 3...
emailValid email addressesjohn.doe@gmail.com
first_name, namePerson namesSarah, Michael
last_name, surnameFamily namesJohnson, Chen
phone, mobilePhone numbers+1-555-123-4567
address, streetStreet addresses123 Main St
cityCity namesNew York, London
countryCountry namesUnited States
zip, postalPostal codes10001, SW1A 1AA
price, amount, costDecimal numbers149.99
url, websiteURLshttps://example.com
*_at, date, timestampISO timestamps2024-03-15T09:23:41
description, bio, textLorem ipsum textLorem ipsum dolor...
is_*, has_*Boolean valuestrue, false
uuidUUID v4550e8400-e29b-41d4-...

Foreign Keys & Relationships

DDL to Data supports foreign key relationships, allowing you to generate consistent data across related tables.

Use the POST /relationships endpoint to define how tables relate:

curl -X POST https://ddltodata.com/relationships \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "parent_table": "users",
    "parent_column": "id",
    "child_table": "orders",
    "child_column": "user_id"
  }'

Rate Limits & Plans

PlanAPI Calls/MonthRows/MonthPrice
Free1005,000$0
Starter50050,000$19/mo
ProUnlimited250,000$79/mo
EnterpriseCustomCustomContact us

Error Handling

The API returns standard HTTP status codes with JSON error details:

400
Bad Request - Invalid DDL syntax or missing required fields
401
Unauthorized - Missing or invalid API key
403
Forbidden - Rate limit exceeded or email not verified
404
Not Found - Schema or endpoint not found
429
Too Many Requests - Rate limit exceeded
500
Server Error - Internal server error

Error Response Format

{
  "detail": "Schema 'users' not found"
}

Code Examples

import requests

API_KEY = "your_api_key"
BASE_URL = "https://ddltodata.com"
headers = {"X-API-Key": API_KEY}

# Create a schema
schema = {
    "name": "customers",
    "ddl": """CREATE TABLE customers (
        id SERIAL PRIMARY KEY,
        name VARCHAR(100),
        email VARCHAR(255),
        phone VARCHAR(20),
        created_at TIMESTAMP
    );"""
}
response = requests.post(f"{BASE_URL}/schemas", json=schema, headers=headers)
print(response.json())

# Generate data
response = requests.get(f"{BASE_URL}/generate/customers?rows=5", headers=headers)
customers = response.json()
print(f"Generated {len(customers)} customers:")
for customer in customers:
    print(customer)

Need Help?

Can't find what you're looking for? We're here to help.

DDL to Data - Generate Realistic Fake Data from SQL Schemas | Test Data API