Upload a user's profile picture
Sets the profile picture of the user in the path, replacing any previous one.
A customer API key needs the user-profile-pictures scope and can manage every user of its
PBX. A user token can only target its own id (the same as
POST /me/profile-picture).
Send the file as multipart/form-data in the image field.
The picture is normalized once on upload: its EXIF orientation is applied, metadata (GPS, camera) is removed, it is center-cropped to a square, scaled down to at most 512×512 px (never up), and saved as a high-quality JPEG.
The response holds the new public link, also returned from now on by
GET /users/{user} (and GET /me) as profile_picture_url:
https://cockpit.voxbi.com/avatar/{key} (optional ?size=32…512)
The link needs no token, is cacheable (Cache-Control: public, max-age=86400,
ETag), and changes with every upload.
User bearer token. Default authentication for customer-facing endpoints.
Obtain a token by calling POST /login with your credentials, then send it
on every subsequent request as Authorization: Bearer <token>. The token
inherits the permissions and PBX scope of the authenticated user.
- HTTP Authorization Scheme
bearer- Bearer format
Bearer <token>
API key created on the Cockpit Integrations page (an "API key" integration).
It is a bearer token owned by the customer's PBX and limited to the scopes
selected when the key was created (e.g. phone-numbers, push-configuration).
Send it in the Authorization header:
Authorization: Bearer <api_key>
Manage keys (create / reveal / revoke) from Integrations → New integration → API key.
- HTTP Authorization Scheme
bearer
application/jsonRequest body · required · multipart/form-data
Responses
dataobject
Authorization Token is missingdataobject
errorsobject
https://cockpit.voxbi.com/api/v1/users/{user}/profile-picture
curl -X POST 'https://cockpit.voxbi.com/api/v1/users/{user}/profile-picture' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-F 'image=@/path/to/image'
const body = new FormData();
body.append('image', fileInput.files[0]); // /path/to/image
const response = await fetch('https://cockpit.voxbi.com/api/v1/users/{user}/profile-picture', {
method: 'POST',
headers: { Authorization: `Bearer ${YOUR_TOKEN}` },
body,
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://cockpit.voxbi.com/api/v1/users/{user}/profile-picture',
headers={'Authorization': f'Bearer {YOUR_TOKEN}'},
files={
'image': open('/path/to/image', 'rb'),
},
)
response.raise_for_status()
data = response.json()
print(data)
<?php
$ch = curl_init('https://cockpit.voxbi.com/api/v1/users/{user}/profile-picture');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_TOKEN']);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'image' => new CURLFile('/path/to/image'),
]);
$data = json_decode(curl_exec($ch), true);
print_r($data);
{ … }
{ … }
"data": { … }
{ … }
private, must-revalidatekeep-aliveapplication/jsonOrigin6057