Random User Generator

Authentication

Our API requires authentication for all endpoints. You must include your API token in the request headers using the Authorization header.

How to authenticate?

Include your API token in the request header as follows:

Example: Using cURL

curl -H "Authorization: Bearer YOUR_API_TOKEN" -s https://api.plenix.net/v1/random-user-generator

Example: Using JavaScript (fetch API)

                                                
fetch("https://api.plenix.net/v1/random-user-generator", {
    headers: {
        "Authorization": "Bearer YOUR_API_TOKEN"
    }
})
.then(response => response.json())
.then(data => console.log(data));
                                                
                                            

Example: Using Postman

1. Open Postman and create a new request.
2. Set the request type to GET.
3. Enter the URL:

https://api.plenix.net/v1/random-user-generator

4. Go to the Headers tab and add:
Key: Authorization
Value: Bearer YOUR_API_TOKEN
5. Click Send to receive the response.

How to Use

Use AJAX or other HTTP libraries to request a random user. Below is an example using jQuery:


$.ajax({
    url: 'https://api.plenix.net/v1/random-user-generator',
    headers: {
        "Authorization": "Bearer YOUR_API_TOKEN"
    },
    dataType: 'json',
    success: function(data) {
        console.log(data);
    }
});
                                            

Results

The response will be in JSON format, containing a list of randomly generated users. Here is an example:


{
    "results": [
        {
            "gender": "female",
            "name": {
                "title": "Miss",
                "first": "Jennie",
                "last": "Nichols"
            },
            "location": {
                "city": "Billings",
                "state": "Michigan",
                "country": "United States"
            },
            "email": "[email protected]",
            "dob": {
                "date": "1992-03-08T15:13:16.688Z",
                "age": 30
            }
        }
    ]
}
                                            

API Errors

If there is an issue with the API, you'll receive a response containing an error message.


{
    "error": "Something went wrong"
}
                                            

Requesting Multiple Users

You can specify how many users to generate using the results parameter. It can take values from 1 to 5000:


curl -H "Authorization: Bearer YOUR_API_TOKEN" -s "https://api.plenix.net/v1/random-user-generator/multiple?results=5000"
                                            

Specifying a Gender

You can specify the gender of the generated users by using the gender parameter. It accepts male or female:


curl -H "Authorization: Bearer YOUR_API_TOKEN" -s "https://api.plenix.net/v1/random-user-generator/gender/female"
                                            

Seeds

Use the seed parameter to generate repeatable results. This ensures that you get the same users each time:


curl -H "Authorization: Bearer YOUR_API_TOKEN" -s "https://api.plenix.net/v1/random-user-generator/seed/foobar"
                                            

Formats

The API supports different response formats such as JSON, CSV, XML, etc. Specify the desired format using the format parameter:


curl -H "Authorization: Bearer YOUR_API_TOKEN" -s "https://api.plenix.net/v1/random-user-generator/format/csv"
                                            

Nationalities

You can filter users by nationality using the nat parameter. For example, requesting users from the United States:


curl -H "Authorization: Bearer YOUR_API_TOKEN" -s "https://api.plenix.net/v1/random-user-generator/nationality/us"
                                            

Pagination

To paginate through multiple pages of results, use the page and per_page parameters.


curl -H "Authorization: Bearer YOUR_API_TOKEN" -s "https://api.plenix.net/v1/random-user-generator/pagination?page=2&per_page=10"
                                            

Include/Exclude Fields

Control which fields are included or excluded in the response using the include and exclude parameters:


curl -H "Authorization: Bearer YOUR_API_TOKEN" -s "https://api.plenix.net/v1/random-user-generator/include-exclude?include=first,last,email&exclude=location"