Need to generate realistic random names for testing or mockups? This guide covers everything about random name generation via API, including different name types, localization options, and implementation examples in multiple programming languages.
Why Generate Random Names?
Random name generation is essential for creating realistic test data, populating UI mockups, and developing applications without using real personal information. Generated names look authentic while protecting privacy.
Example output: Emily Johnson, Michael Chen, Sarah Williams
Name Types Available
Different types of names you can generate:
First Names
Generate male, female, or gender-neutral first names.
Last Names
Generate surnames from various cultural backgrounds.
Full Names
Combine first and last names for complete identities.
Using the Random Name API
TinyFn provides a flexible endpoint to generate random names:
GET https://api.tinyfn.io/v1/generate/name?count=5
Headers: X-API-Key: your-api-key
{
"names": [
{"first": "Emily", "last": "Johnson", "full": "Emily Johnson"},
{"first": "Michael", "last": "Chen", "full": "Michael Chen"},
{"first": "Sarah", "last": "Williams", "full": "Sarah Williams"},
{"first": "David", "last": "Kim", "full": "David Kim"},
{"first": "Jessica", "last": "Brown", "full": "Jessica Brown"}
],
"count": 5
}
Parameters
| Parameter | Type | Description |
|---|---|---|
count |
integer | Number of names to generate (default: 1, max: 100) |
gender |
string | Gender: male, female, any (default: any) |
type |
string | Type: first, last, full (default: full) |
Code Examples
JavaScript / Node.js
const response = await fetch(
'https://api.tinyfn.io/v1/generate/name?count=5',
{ headers: { 'X-API-Key': 'your-api-key' } }
);
const { names } = await response.json();
names.forEach(n => console.log(n.full));
Python
import requests
response = requests.get(
'https://api.tinyfn.io/v1/generate/name',
params={'count': 5},
headers={'X-API-Key': 'your-api-key'}
)
names = response.json()['names']
for name in names:
print(name['full'])
cURL
curl "https://api.tinyfn.io/v1/generate/name?count=5" \
-H "X-API-Key: your-api-key"
Common Use Cases
- Test Data: Populate databases with realistic test users
- UI Mockups: Fill user interfaces with sample names
- Demo Applications: Create demo accounts and sample data
- Game Development: Generate NPC names
- Writing Tools: Generate character names for stories
Best Practices
- Use diverse names: Include names from various backgrounds
- Mark as test data: Clearly label generated names as fake
- Consider context: Generate appropriate names for your use case
- Don't use for fraud: Never use generated names for deceptive purposes
Use via MCP
Your AI agent can call this tool directly via Model Context Protocol — no HTTP code needed. Add TinyFn to Claude Desktop, Cursor, or any MCP client:
{
"mcpServers": {
"tinyfn-generate": {
"url": "https://api.tinyfn.io/mcp/generate/",
"headers": {
"X-API-Key": "your-api-key"
}
}
}
}
See all generator tools available via MCP in our Generator MCP Tools for AI Agents guide.
Try the Random Name Generator API
Get your free API key and start generating names in seconds.
Get Free API Key