Profiles API
Profiles API
Manage user and community profiles.
Endpoints
Get Own Profile
GET /api/meGet the authenticated user’s profile (requires authentication). For the public server identity endpoint, see GET /api/me in the Authentication API.
Authentication: Required
Example:
const api = cloudillo.createApiClient()
const profile = await api.me.get()Response:
{
"data": {
"tnId": 12345,
"idTag": "alice@example.com",
"name": "Alice Johnson",
"profilePic": "/file/b1~abc123",
"x": {
"bio": "Software developer",
"location": "San Francisco"
}
}
}Update Own Profile
PATCH /api/meUpdate the authenticated user’s profile.
Authentication: Required
Request:
await api.me.patch({
name: 'Alice Smith',
x: {
bio: 'Senior developer',
website: 'https://alice.example.com'
}
})Upload Profile Image
PUT /api/me/imageUpload or update your profile picture.
Authentication: Required
Content-Type: Image type (e.g., image/jpeg, image/png)
Request Body: Raw image binary data
Example:
const imageFile = document.querySelector('input[type="file"]').files[0]
const response = await fetch('/api/me/image', {
method: 'PUT',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': imageFile.type
},
body: imageFile
})
const result = await response.json()
console.log('Profile image updated:', result.data.profilePic)Response:
{
"data": {
"profilePic": "/api/file/b1~abc123",
"fileId": "b1~abc123"
},
"time": 1735000000,
"reqId": "req_abc123"
}Upload Cover Image
PUT /api/me/coverUpload or update your cover photo.
Authentication: Required
Content-Type: Image type (e.g., image/jpeg, image/png)
Request Body: Raw image binary data
Example:
const coverFile = document.querySelector('input[type="file"]').files[0]
const response = await fetch('/api/me/cover', {
method: 'PUT',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': coverFile.type
},
body: coverFile
})
const result = await response.json()
console.log('Cover image updated:', result.data.coverPic)Response:
{
"data": {
"coverPic": "/api/file/b1~xyz789",
"fileId": "b1~xyz789"
},
"time": 1735000000,
"reqId": "req_abc123"
}Get Profile
GET /api/profiles/:idTagGet a specific user or community profile.
Example:
const profile = await api.profiles.get({ idTag: 'bob@example.com' })List Profiles
GET /api/profilesList all accessible profiles.
Query Parameters:
type- Filter by type (person, community)_limit- Max results_offset- Pagination offset
Example:
const communities = await api.profiles.get({
type: 'community',
_limit: 20
})Update Relationship
PATCH /api/profiles/:idTagUpdate your relationship with another profile (follow, block, etc.).
Authentication: Required
Request:
{
"relationship": "follow"
}Response:
{
"data": {
"idTag": "bob@example.com",
"relationship": "follow",
"updatedAt": 1735000000
},
"time": 1735000000,
"reqId": "req_abc123"
}Admin: Update Profile
PATCH /api/admin/profiles/:idTagAdmin endpoint to update any user’s profile.
Authentication: Required (admin role)
Request:
{
"name": "Updated Name",
"status": "active",
"roles": ["user", "moderator"]
}Response:
{
"data": {
"tnId": 12345,
"idTag": "bob@example.com",
"name": "Updated Name",
"status": "active",
"roles": ["user", "moderator"]
},
"time": 1735000000,
"reqId": "req_abc123"
}See Also
- Authentication - Managing profile access
- Actions API - Profile-related actions