Upload My Profile Picture
Set your profile picture from an image file you send as the request body. ngris fits it to a square of at most 256 pixels and keeps its own copy. A picture you upload stays until you remove it or upload another: a sign-in never replaces it.
Send the file itself with its type: image/png, image/jpeg or image/webp, at most 1 MB and 2048 pixels on a side.
Request body
(the file) binary Req
The PNG, JPEG or WebP file, with
Content-Type set to its type.Response (200 OK)
avatar_version string
The version of your picture now;
"" when you have none.avatar_source string
google, github, oidc, upload, or "" when you have none.avatar_from_signin boolean
Whether a sign-in that brings a picture sets yours.
Errors
400 Bad Request
The body is empty, not a PNG, JPEG or WebP picture, larger than 2048 pixels on a side, or unreadable.
401 Unauthorized
Missing or invalid auth.
413 Content Too Large
The file is larger than 1 MB.
415 Unsupported Media Type
Content-Type is not image/png, image/jpeg or image/webp.429 Too Many Requests
You uploaded or changed your picture many times in a short time. Try again later.
503 Service Unavailable
Pictures can't be saved right now. Try again shortly.
Request
curl -X PUT "https://api.ngris.com/v1/user/avatar" \
-H "X-API-KEY: <your_api_key>" \
-H "Content-Type: image/png" \
--data-binary @me.png
Response
{
"avatar_version": "3f9a1c07d2b84e65",
"avatar_source": "upload",
"avatar_from_signin": true
}
Was this helpful?