A comprehensive FastAPI-based REST API for generating various types of random data. Perfect for testing, development, and data seeding purposes.
- Person Data: Names, emails, addresses, phone numbers, SSNs
- Company Data: Company names, industries, contact information
- Credit Card Data: Card numbers, expiry dates, CVVs
- Product Data: Product names, categories, prices, descriptions
- Technical Data: IP addresses, user agents, MAC addresses, UUIDs
- Custom Data: Flexible endpoint for generating any supported data type
- Bulk Generation: Generate multiple records at once
- Multi-locale Support: Generate data in different locales
- Clone the repository:
git clone <repository-url>
cd random-data-generator-api- Install dependencies:
pip install -r requirements.txt- Run the application:
python main.pyOr using uvicorn directly:
uvicorn main:app --host 0.0.0.0 --port 8000 --reloadThis API is ready for deployment to Elest.io! Follow these steps:
- Run the deployment script (optional):
chmod +x deploy.sh
./deploy.sh- Push to Git repository:
git add .
git commit -m "Ready for Elest.io deployment"
git push origin main- Deploy on Elest.io:
- Go to elest.io
- Create new app → Deploy from Git
- Connect your repository
- Configure with the provided
elestio.yml - Deploy!
For detailed deployment instructions, see deploy.md.
- Docker: Use the provided
Dockerfile - Railway: Connect your Git repository
- Render: Use the Dockerfile for deployment
- Heroku: Add a
Procfilewith:web: uvicorn main:app --host 0.0.0.0 --port $PORT
http://localhost:8000
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
- GET
/- API information and available endpoints
- GET
/api/person- Generate single person data - GET
/api/person/bulk?count=10- Generate multiple person records
- GET
/api/company- Generate single company data - GET
/api/company/bulk?count=10- Generate multiple company records
- GET
/api/credit-card- Generate credit card information
- GET
/api/product- Generate product information
- GET
/api/technical- Generate technical data (IP, user agent, etc.)
- GET
/api/custom?data_type=email&count=5- Generate custom data types
- GET
/api/health- API health status
curl http://localhost:8000/api/personcurl "http://localhost:8000/api/person/bulk?count=5"curl http://localhost:8000/api/companycurl http://localhost:8000/api/credit-card# Generate 10 email addresses
curl "http://localhost:8000/api/custom?data_type=email&count=10"
# Generate 5 random names
curl "http://localhost:8000/api/custom?data_type=name&count=5"
# Generate 3 random addresses
curl "http://localhost:8000/api/custom?data_type=address&count=3"# Generate person data with German locale
curl "http://localhost:8000/api/person?locale=de_DE"
# Generate company data with French locale
curl "http://localhost:8000/api/company?locale=fr_FR"name- Full namesemail- Email addressesphone- Phone numbersaddress- Full addressestext- Random text paragraphssentence- Random sentencesword- Random wordsurl- URLsdate- Datestime- Timesdatetime- Date and timecolor- Color namesjob- Job titlescompany- Company namescity- City namescountry- Country namescurrency- Currency codesfile_path- File pathsfile_name- File namesfile_extension- File extensions
en_US- English (United States)en_GB- English (United Kingdom)de_DE- Germanfr_FR- Frenches_ES- Spanish
{
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone": "(555) 123-4567",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"zipcode": "10001",
"country": "United States",
"date_of_birth": "1985-03-15",
"ssn": "123-45-6789",
"username": "johndoe123"
}{
"name": "TechCorp Solutions",
"industry": "Technology",
"website": "https://techcorp-solutions.com",
"email": "info@techcorp-solutions.com",
"phone": "(555) 987-6543",
"address": "456 Business Ave",
"city": "San Francisco",
"state": "CA",
"zipcode": "94102",
"country": "United States",
"founded_year": 2010,
"employee_count": 250
}The API returns appropriate HTTP status codes and error messages:
200- Success400- Bad Request (invalid parameters)500- Internal Server Error
random-data-generator-api/
├── main.py # Main FastAPI application
├── start.py # Startup script
├── test_api.py # Test script
├── requirements.txt # Python dependencies
├── Dockerfile # Docker configuration
├── .dockerignore # Docker ignore rules
├── elestio.yml # Elest.io configuration
├── deploy.sh # Deployment script
├── deploy.md # Deployment guide
├── README.md # This file
├── QUICK_START.md # Quick start guide
└── .gitignore # Git ignore rules
To add new data types to the custom endpoint, modify the generate_custom_data function in main.py and add new conditions for your data type.
You can test the API using:
- The built-in Swagger UI at
/docs - curl commands
- Any HTTP client like Postman or Insomnia
- Run
python test_api.pyfor automated testing
This project is open source and available under the MIT License.
Contributions are welcome! Please feel free to submit a Pull Request.