User
Get current user profile from OAuth token
Overview
The User API lets OAuth apps retrieve and manage the current user's profile information using their access token.
Authentication: OAuth token only (API keys not supported)
Required Scopes: user:read, user:write
Important: Personal Team Context
Every user has a personal team that represents their individual account:
- Billing - All credits and spending are tied to the user's personal team
- Developer Profile - Published under the user's personal team (for apps in marketplace)
- Default Context - Used when no specific team is selected
When you get a user with /api/user/me, the slug field is their personal team slug. Use this for building URLs like /settings/{slug}.
Get Current User
Get the authenticated user's profile.
Endpoint: GET /api/user/me
const response = await fetch('https://hypery.ai/api/user/me', {
headers: {
'Authorization': `Bearer ${oauthAccessToken}`
}
})
const user = await response.json()
console.log(user.email)import requests
response = requests.get(
'https://hypery.ai/api/user/me',
headers={'Authorization': f'Bearer {oauth_access_token}'}
)
user = response.json()
print(user['email'])curl https://hypery.ai/api/user/me \
-H "Authorization: Bearer OAUTH_ACCESS_TOKEN"Response:
{
"id": "507f1f77bcf86cd799439011",
"email": "user@example.com",
"name": "John Doe",
"image": "https://...avatar.jpg",
"slug": "johndoe"
}Output Fields
Update Profile
Modify user profile information.
Endpoint: PUT /api/user/profile
const response = await fetch('https://hypery.ai/api/user/profile', {
method: 'PUT',
headers: {
'Authorization': `Bearer ${oauthToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'John Doe',
bio: 'Software engineer',
username: 'johndoe'
})
})
const result = await response.json()response = requests.put(
'https://hypery.ai/api/user/profile',
headers={'Authorization': f'Bearer {oauth_token}'},
json={
'name': 'John Doe',
'bio': 'Software engineer',
'username': 'johndoe'
}
)curl -X PUT https://hypery.ai/api/user/profile \
-H "Authorization: Bearer OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"bio": "Software engineer",
"username": "johndoe"
}'Input Parameters
Update Preferences
Modify user preferences.
Endpoint: PUT /api/user/preferences
await fetch('https://hypery.ai/api/user/preferences', {
method: 'PUT',
headers: {
'Authorization': `Bearer ${oauthToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
theme: 'dark',
notifications: true
})
})requests.put(
'https://hypery.ai/api/user/preferences',
headers={'Authorization': f'Bearer {oauth_token}'},
json={'theme': 'dark', 'notifications': True}
)curl -X PUT https://hypery.ai/api/user/preferences \
-H "Authorization: Bearer OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"theme": "dark", "notifications": true}'Input Parameters
Upload Avatar
Update user avatar image.
Endpoint: POST /api/user/avatar
const formData = new FormData()
formData.append('image', fileInput.files[0]) // Note: field name is 'image'
const response = await fetch('https://hypery.ai/api/user/avatar', {
method: 'POST',
headers: { 'Authorization': `Bearer ${oauthToken}` },
body: formData
})
const { imageUrl } = await response.json()
console.log('Avatar URL:', imageUrl)files = {'image': open('avatar.jpg', 'rb')} # Note: field name is 'image'
response = requests.post(
'https://hypery.ai/api/user/avatar',
headers={'Authorization': f'Bearer {oauth_token}'},
files=files
)
image_url = response.json()['imageUrl']curl -X POST https://hypery.ai/api/user/avatar \
-H "Authorization: Bearer OAUTH_TOKEN" \
-F "image=@avatar.jpg"Image Requirements:
- Max size: 5 MB
- Formats: JPG, PNG, WebP, GIF
- Recommended: 512x512px square
Get Connected Accounts
List linked OAuth providers (GitHub, Google).
Endpoint: GET /api/user/connected-accounts
const response = await fetch('https://hypery.ai/api/user/connected-accounts', {
headers: { 'Authorization': `Bearer ${oauthToken}` }
})
const { accounts } = await response.json()response = requests.get(
'https://hypery.ai/api/user/connected-accounts',
headers={'Authorization': f'Bearer {oauth_token}'}
)curl https://hypery.ai/api/user/connected-accounts \
-H "Authorization: Bearer OAUTH_TOKEN"Set Password
Set or update password.
Endpoint: POST /api/user/set-password
await fetch('https://hypery.ai/api/user/set-password', {
method: 'POST',
headers: {
'Authorization': `Bearer ${oauthToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
currentPassword: 'old123',
newPassword: 'new456'
})
})requests.post(
'https://hypery.ai/api/user/set-password',
headers={'Authorization': f'Bearer {oauth_token}'},
json={'currentPassword': 'old123', 'newPassword': 'new456'}
)curl -X POST https://hypery.ai/api/user/set-password \
-H "Authorization: Bearer OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"currentPassword": "old123", "newPassword": "new456"}'Error Responses
Unauthorized
{
"success": false,
"error": "Missing or invalid Authorization header"
}Status Code: 401
Token Expired
{
"success": false,
"error": "Invalid or expired access token"
}Status Code: 401