cURL
curl --request GET \ --url https://auth.nullpass.xyz/api/auth/me \ --header 'Authorization: Bearer <token>'
{ "id": "<string>", "email": "jsmith@example.com", "username": "<string>", "displayName": "<string>", "avatar": "<string>", "twoFactorEnabled": true, "createdAt": "2023-11-07T05:31:56Z", "serviceAccess": [ { "id": "<string>", "userId": "<string>", "service": "DROP", "tier": "premium", "isPremium": true, "accessFlags": {}, "metadata": {}, "customStorageLimit": 123, "customApiKeyLimit": 123, "createdAt": "2023-11-07T05:31:56Z", "updatedAt": "2023-11-07T05:31:56Z" } ] }
Get authenticated user profile or update profile information
GET /api/auth/me PATCH /api/auth/me
Show User Object
avatar
export async function GET(request: NextRequest) { const corsResponse = handleCors(request) if (corsResponse) return corsResponse const blocked = await protectRoute(request) if (blocked) return blocked const auth = await requireAuth(request) if ('error' in auth) return auth.error try { const user = await prisma.user.findUnique({ where: { id: auth.userId }, select: { id: true, email: true, avatar: true, displayName: true, twoFactorEnabled: true, createdAt: true, updatedAt: true, serviceAccess: true, }, }) if (!user) { return errorResponse('User not found', 404, request.headers.get('origin')) } return jsonResponse({ user }, 200, request.headers.get('origin')) } catch (error) { logger.error('Get user error:', error) return errorResponse('Internal server error', 500, request.headers.get('origin')) } } export async function PATCH(request: NextRequest) { const corsResponse = handleCors(request) if (corsResponse) return corsResponse const blocked = await protectRoute(request) if (blocked) return blocked const auth = await requireAuth(request) if ('error' in auth) return auth.error try { const body = await request.json() const validated = updateProfileSchema.parse(body) const updateData: { displayName?: string avatar?: string | null } = {} if (validated.displayName !== undefined) { updateData.displayName = validated.displayName } if (validated.avatar !== undefined) { updateData.avatar = validated.avatar === '' ? null : validated.avatar } if (Object.keys(updateData).length === 0) { return errorResponse('No fields to update', 400, request.headers.get('origin')) } const user = await prisma.user.update({ where: { id: auth.userId }, data: updateData, select: { id: true, email: true, avatar: true, displayName: true, twoFactorEnabled: true, createdAt: true, updatedAt: true, }, }) await createAuditLog(auth.userId, 'USER_UPDATE', { fields: Object.keys(updateData), }) return jsonResponse({ user }, 200, request.headers.get('origin')) } catch (error: any) { if (error.name === 'ZodError') { logger.warn('Profile update validation error:', error.errors) return errorResponse(error.errors[0].message, 400, request.headers.get('origin')) } logger.error('Update profile error:', error) return errorResponse('Internal server error', 500, request.headers.get('origin')) } }
curl -X GET https://auth.nullpass.xyz/api/auth/me \ -H "Authorization: Bearer YOUR_TOKEN"
curl -X PATCH https://auth.nullpass.xyz/api/auth/me \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "displayName": "Jane Doe", "avatar": "https://example.com/avatar.jpg" }'
curl -X PATCH https://auth.nullpass.xyz/api/auth/me \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "avatar": "" }'
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Bearer <token>
<token>
User profile
Show child attributes
DROP
MAILS
VAULT
DB
"premium"