The API aims to be simple to use and understand. A full range of methods are supported to get, create and update avatar images.
/:hash[/:backup][/:size]
Fetch an avatar, optionally at a specific size.
hash
: SHA1 of a unique identifier (i.e. email, id, etc)backup
: SHA1 to use if the given:hash
does not existsize
: one of original, large, medium, or small:- original: 1024x
- large: 512x
- medium: 256x
- small: 128x
When the provided :hash
does not exist, and a :backup
is provided, the backup is treated as the requested hash.
When the provided :size
is an integer, the closest larger size will be used. For example, if the size was 300
, the size will be converted to large
. If no :size
is provided, it defaults to medium
.
Location: (Image File URL)
302
: redirect to image file
The result of this call will never return a 404! If the requested size does not exist, return the best available size instead.
/:hash
Check if an avatar exists.
Response status:
404
: not found204
: success
/:hash
Image is processed into a square and sizes are immediately created and stored on S3.
avatar
: image file upload in the post bodytoken
: a JWT containing: exp, hash
Content-Type: multipart/form-data
201
: success
{
"data": {
"type": "jpg",
"best": "medium",
"sizes": {
"small": {
"href": "\/4e1243bd22c66e76c2ba9eddc1f91394e57f9f83\/small",
"path": "4\/e1\/4e1243bd22c66e76c2ba9eddc1f91394e57f9f83.small.jpg",
"url": "\/\/s3.amazonaws.com\/s3-bucket.example.com\/4\/e1\/4e1243bd22c66e76c2ba9eddc1f91394e57f9f83.small.jpg"
},
"medium": {
"href": "\/4e1243bd22c66e76c2ba9eddc1f91394e57f9f83\/medium",
"path": "4\/e1\/4e1243bd22c66e76c2ba9eddc1f91394e57f9f83.medium.jpg",
"url": "\/\/s3.amazonaws.com\/s3-bucket.example.com\/4\/e1\/4e1243bd22c66e76c2ba9eddc1f91394e57f9f83.medium.jpg"
}
}
},
"error": false
}
/:hash
Delete the given avatar and purge all existing sizes.
token
: a JWT containing: exp, hash
404
: not found504
: failed to delete some images204
: success