curl --request GET \
--url https://api.example.com/v1/faces/{face_id}/avatarimport requests
url = "https://api.example.com/v1/faces/{face_id}/avatar"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v1/faces/{face_id}/avatar', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/faces/{face_id}/avatar",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/faces/{face_id}/avatar"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/faces/{face_id}/avatar")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/faces/{face_id}/avatar")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Get Face Avatar
Fetch the face’s avatar as an image: the bytes themselves, not base64.
curl --request GET \
--url https://api.example.com/v1/faces/{face_id}/avatarimport requests
url = "https://api.example.com/v1/faces/{face_id}/avatar"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v1/faces/{face_id}/avatar', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/faces/{face_id}/avatar",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/faces/{face_id}/avatar"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/faces/{face_id}/avatar")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/faces/{face_id}/avatar")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Query Parameters
The account that owns the face, when it is not you. The same thing as the <owner>:<alias> handle in the path: /v1/faces/head:socrates and /v1/faces/socrates?owner=head are one request. Sending both and disagreeing is a 422. Without either, a bare alias means YOUR face of that name if you have one, and an alias is unique per owner, so me and any popular name collide across accounts.
uploaded serves the owner's uploaded picture when there is one and falls back to the generated avatar when there is not. organic (default) always serves the generated one. The response says which you got, in X-Avatar-Source: organic, uploaded, or default when the face has no picture at all and the placeholder was served.
^(organic|uploaded)$Response
Successful Response