Users API
The Users API allows you to interact with user accounts. This API is generated by PayloadCMS and uses cookie-based authentication.
Authentication
All endpoints require authentication via cookies. You must be logged in to access these endpoints.
Endpoints
Get Current User
http
GET /api/users/me
Returns the currently authenticated user's profile.
Response
json
{
"id": "user_123",
"email": "user@example.com",
"githubUsername": "username",
"contributorStatus": "verified",
"wallet": {
"id": "wallet_123",
"credits": 1000
}
}
Note: Some fields like stripeCustomerId
and internal fields are only visible to admins.
Update Current User
http
PATCH /api/users/me
Update your own user profile. Note that some fields like roles
, contributorStatus
, and wallet
can only be modified by admins.
Request Body
json
{
"email": "newemail@example.com"
}
Response
Returns the updated user object with the same format as the GET response.
Error Responses
json
{
"errors": [{
"message": "Unauthorized",
"field": "email"
}]
}
Common error codes:
401
- Not authenticated403
- Not authorized to perform the action422
- Invalid input data