API 文档
API Documentation
Complete guide to using the Random User Api API with examples, parameters, and best practices.
免费使用
高性能
实时响应
易于集成
Quick Start
Get started with the Random User Api API in seconds. Use AJAX to call our API and receive randomly generated user data.
$.ajax({
url: 'https://randomuserapi.com/api/user',
dataType: 'json',
success: function(data) {
console.log(data);
}
});
实时示例
API Examples
Common API call examples. Click the copy button to copy the endpoint path, click the test button to test the endpoint directly.
GET
Basic Usage
Generate a single random user from United States
https://randomuserapi.com/api/user?nat=US
GET
Multiple Users
Generate multiple users from United States (max 5000)
https://randomuserapi.com/api/user?nat=US&results=5
GET
Filter by Gender
Generate United States users of specific gender
https://randomuserapi.com/api/user?nat=US&gender=female&results=3
GET
Combined Filters
Combine multiple filters for United States users
https://randomuserapi.com/api/user?nat=US&gender=male&results=2
GET
CSV Format
Get United States users in CSV format
https://randomuserapi.com/api/user?nat=US&format=csv&results=3
GET
Seeded Results
Generate reproducible United States users with seed
https://randomuserapi.com/api/user?nat=US&seed=myseed123&results=2
GET
Pagination
Use pagination to efficiently browse large datasets
https://randomuserapi.com/api/user?page=3&results=10&seed=abc
GET
Custom Password
Generate passwords with specific character sets and length requirements
https://randomuserapi.com/api/user?password=upper,lower,1-16
GET
Multiple Countries
Request users from multiple countries in a single API call
https://randomuserapi.com/api/user?nat=us,dk,fr,gb
GET
Field Filtering
Include or exclude specific fields to optimize response size and get only the data you need.
https://randomuserapi.com/api/user?inc=name,email&nat=US
GET
Email Only
Get only email addresses from users of specific countries.
https://randomuserapi.com/api/user?inc=email&nat=US&results=3
GET
Contact Information
Get only phone numbers and email addresses for contact purposes.
https://randomuserapi.com/api/user?inc=name,email,phone&nat=US&results=2
GET
Address Only
Get only location/address information from users.
https://randomuserapi.com/api/user?inc=location&nat=US&results=2
GET
Exclude Fields
Exclude specific fields from the response to reduce payload size
https://randomuserapi.com/api/user?exc=login,registered,id&nat=US&results=2
GET
No Info Object
Remove the info object from response, returning only user data
https://randomuserapi.com/api/user?inc=name,email&noinfo&nat=US&results=2
Multiple Users
Generate multiple users in a single request. Specify the number of users you want to generate.
https://randomuserapi.com/api/user?results=5000
Gender Filter
Filter users by gender. Specify 'male' or 'female' to get users of a specific gender.
https://randomuserapi.com/api/user?gender=female
malefemale
Nationality Filter
Filter users by nationality. You can specify multiple nationalities separated by commas.
https://randomuserapi.com/api/user?nat=us,dk,fr,gb
Seed Value
Use a seed to generate the same set of users consistently. Perfect for testing and reproducible results.
https://randomuserapi.com/api/user?seed=foobar
Password Options
Customize password generation with character sets and length constraints.
https://randomuserapi.com/api/user?password=upper,lower,1-16
upperlowernumberspecial
Field Selection
Include or exclude specific fields from the response to optimize payload size.
https://randomuserapi.com/api/user?inc=name,location,email
https://randomuserapi.com/api/user?exc=login,registered