User
Upload user avatar
Uploads a new avatar image. If an avatar already exists, it will be replaced. Max size: 5MB. Allowed types: JPEG, PNG, GIF, WebP.
POST
/
v1
/
user
/
profile
/
avatar
Upload user avatar
curl --request POST \
--url https://api.hyperprop.com/platform/v1/user/profile/avatarimport requests
url = "https://api.hyperprop.com/platform/v1/user/profile/avatar"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.hyperprop.com/platform/v1/user/profile/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.hyperprop.com/platform/v1/user/profile/avatar",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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.hyperprop.com/platform/v1/user/profile/avatar"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hyperprop.com/platform/v1/user/profile/avatar")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperprop.com/platform/v1/user/profile/avatar")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Avatar uploaded successfully",
"data": {
"avatarUrl": "https://storage.hyperprop.com/avatars/550e8400_1704067200000.png"
}
}{
"statusCode": 400,
"error": "Bad Request",
"message": "Failed to upload avatar",
"code": "UPLOAD_FAILED"
}{
"success": false,
"statusCode": 401,
"error": "Unauthorized",
"message": "Authentication required",
"code": "UNAUTHORIZED"
}{
"success": false,
"statusCode": 404,
"error": "Not Found",
"message": "Profile not found",
"code": "PROFILE_NOT_FOUND"
}{
"success": false,
"statusCode": 500,
"error": "Internal Server Error",
"message": "An unexpected error occurred",
"code": "INTERNAL_ERROR"
}Related topics
Delete user avatarUpload organization logoUpload community imageGet own user profileCreate community post⌘I
Upload user avatar
curl --request POST \
--url https://api.hyperprop.com/platform/v1/user/profile/avatarimport requests
url = "https://api.hyperprop.com/platform/v1/user/profile/avatar"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.hyperprop.com/platform/v1/user/profile/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.hyperprop.com/platform/v1/user/profile/avatar",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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.hyperprop.com/platform/v1/user/profile/avatar"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hyperprop.com/platform/v1/user/profile/avatar")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperprop.com/platform/v1/user/profile/avatar")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Avatar uploaded successfully",
"data": {
"avatarUrl": "https://storage.hyperprop.com/avatars/550e8400_1704067200000.png"
}
}{
"statusCode": 400,
"error": "Bad Request",
"message": "Failed to upload avatar",
"code": "UPLOAD_FAILED"
}{
"success": false,
"statusCode": 401,
"error": "Unauthorized",
"message": "Authentication required",
"code": "UNAUTHORIZED"
}{
"success": false,
"statusCode": 404,
"error": "Not Found",
"message": "Profile not found",
"code": "PROFILE_NOT_FOUND"
}{
"success": false,
"statusCode": 500,
"error": "Internal Server Error",
"message": "An unexpected error occurred",
"code": "INTERNAL_ERROR"
}