This API returns image URLs of fake human faces generated by the website thispersondoesnotexist.
Each image has been pre-analysed by an AI algorithm called pypy-agender to identify gender and age (obviously non-exact).
As such, the user of the API can specify gender, minimum and maximum age for the image to be returned.
Data can be returned via JSON format, a direct redirect to the image or a simple response with the image URL.
JSON data for a face
Endpoint
https://fakeface.rest/face/json
Optional query parameters
-
gender
: accepts “male” or “female”; defaults to both if not provided -
minimum_age
: integer -
maximum_age
: integer
Response
{
age: 45,
date_added: "Sun, 02 Aug 2020 22:08:56 GMT",
filename: "female_45_b3e57178eb323fee36df8e8b4690c11ef82f3baa.jpg",
gender: "female",
image_url: "https://content.fakeface.rest/female_45_b3e57178eb323fee36df8e8b4690c11ef82f3baa.jpg",
last_served: "Sun, 02 Aug 2020 22:08:56 GMT",
source: "thispersondoesnotexist"
}
Example queries:
https://fakeface.rest/face/json
https://fakeface.rest/face/json?gender=male
https://fakeface.rest/face/json?gender=female&minimum_age=35
https://fakeface.rest/face/json?maximum_age=50&gender=female
Redirect to a face
Endpoint
https://fakeface.rest/face/view
Query parameters
(same as above for JSON)
Response
Browser redirects right to image
Example queries:
https://fakeface.rest/face/view
https://fakeface.rest/face/view?gender=male
Inserting into HTML
The above address can be used in the src for an img in HTML to dynamically generate a new face on each load:
If you want to insert multiple different faces and prevent the browser caching then you can append any number or random string to the end of the endpoint as follows:
https://fakeface.rest/face/view/1?gender=male
https://fakeface.rest/face/view/anythingcangohere_theapidoesntdoanythingwithit?gender=male
Redirect to a thumbnail of a face
Endpoint
https://fakeface.rest/thumb/view
Query parameters
(same as above for JSON)
Response
Browser redirects right to thumbnail (350x350 maximum) image.
Example queries:
https://fakeface.rest/thumb/view
https://fakeface.rest/thumb/view?gender=male
Inserting into html:
Licence
All of these images are generated by https://thispersondoesnotexist.com and are provided for usage only as allowed by that project’s creators.
Credits
All the hard work was done by the makers of https://thispersondoesnotexist.com and pypy-agender