API

Before using the API make sure you get the UI Faces key which is required.

Get UI Faces key
URL
https://uifaces.co/api
Authentication parameterUsage exampleDescription
X-API-KEYX-API-KEY: [YOUR-UIFACES-KEY]’Add your API key via the HTTP headers
Query string parameterUsage exampleDescription
limit?limit=10Number of avatars (30 max per call, default is 10)
gender[]?gender[]=male
?gender[]=female
Filter by gender: male or female
from_age?from_age=18Set minimum age
to_age?to_age=40Set maximum age
hairColor[]?hairColor[]=black
?hairColor[]=brown
?hairColor[]=blond
?hairColor[]=red
Filter by hair color
emotion[]?emotion[]=happiness
?emotion[]=neutral
Filter by emotion
provider[]?provider[]=9
?provider[]=7
?provider[]=5
?provider[]=1
?provider[]=11
?provider[]=13
?provider[]=8
Premium Get avatars by provider ID
popular?popularPremium Order avatars by popularity
offset?offset=10Premium Skip number of avatars from the result
license?license=CC0Premium Coming soon
random?randomDeprecated (results are random by default)

Fetch() API Example

fetch('https://uifaces.co/api', {
	method: 'GET',
	headers: {
	  'X-API-KEY': [YOUR-UIFACES-KEY],
	  'Accept': 'application/json',
	  'Cache-Control': 'no-cache'
	}
})

cURL Example

curl 
	--header Cache-Control: no-cache 
	--header Accept: application/json 
	--header X-API-KEY: [YOUR-UIFACES-KEY] 
	https://uifaces.co/api

Error Response Example

{ "error" : "Maximum allowed number of results exceeded." }