🚀 Username Generator API
API reference for developers using the Random Username Generator. Integrate unique username ideas into your app, onboarding flow, or tools.
Endpoint
POST /api/fetch_username.php
Note: This acts as a proxy to the main generation engine to avoid CORS and rate limits.
Available Categories
gamer
coder
music
anime
fitness
scifi
mind
finance
fantasy
startup
default
random
Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
name | string | User's real name (optional) | "" |
interest | string | Category/Interest (see above) | random |
style | string | Sub-style (e.g., cool, kawaii, brandable) | "" |
fav | string | Favorite word to include | "" |
min | integer | Minimum username length | 6 |
max | integer | Maximum username length | 16 |
number | 0 or 1 | Include numbers at the end | 1 |
underscore | 0 or 1 | Use underscore separators | 1 |
Example Usage (JavaScript)
fetch('/api/fetch_username.php', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
interest: 'coder',
style: 'tech',
fav: 'dragon',
min: '6',
max: '16',
number: '0',
underscore: '1'
})
})
.then(res => res.json())
.then(data => console.log(data.usernames))
.catch(console.error);
Example Usage (PHP)
<?php
$data = http_build_query([
'interest' => 'coder',
'style' => 'tech',
'fav' => 'dragon',
'min' => 6,
'max' => 20,
'number' => 0,
'underscore' => 1
]);
$opts = ['http' => [
'method' => 'POST',
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'content' => $data
]];
$context = stream_context_create($opts);
$response = file_get_contents('https://www.randomusername.com/api/fetch_username.php', false, $context);
$result = json_decode($response, true);
print_r($result['usernames']);
?>