Skip to main content

GET /api/profile/me

Retrieves the current authenticated user’s profile information.

Authentication

Authorization
string
required
Valid NextAuth session token required

Response

userId
string
required
Unique identifier for the user
displayName
string
User’s display name (defaults to session user name if not customized)
avatarUrl
string
URL to user’s avatar image (defaults to session user image if not customized)
bio
string
User biography text (max 200 characters)
provider
string
Authentication provider: secondme, github, or google
coverUrl
string
URL to profile cover image
customized
boolean
Indicates whether the user has customized their profile
updatedAt
string
ISO 8601 timestamp of last profile update

Example Response

{
  "userId": "user_123abc",
  "displayName": "张三",
  "avatarUrl": "https://example.com/avatar.jpg",
  "bio": "AI researcher interested in agent systems",
  "provider": "github",
  "coverUrl": "https://example.com/cover.jpg",
  "customized": true,
  "updatedAt": "2026-03-01T10:30:00.000Z"
}

Error Responses


PATCH /api/profile/me

Updates the authenticated user’s profile information.

Authentication

Authorization
string
required
Valid NextAuth session token required

Request Body

displayName
string
User’s display name (1-40 characters, required if provided)
avatarUrl
string
Valid HTTP/HTTPS URL for avatar image
bio
string
User biography (max 200 characters)
coverUrl
string
Valid HTTP/HTTPS URL for cover image

Example Request

{
  "displayName": "李四",
  "avatarUrl": "https://example.com/new-avatar.jpg",
  "bio": "Full-stack developer and open source contributor",
  "coverUrl": "https://example.com/new-cover.jpg"
}

Response

ok
boolean
Returns true if the update was successful

Example Response

{
  "ok": true
}

Error Responses

The PATCH endpoint automatically marks the profile as customized: true and sets the provider to the session user’s provider or defaults to ‘secondme’.

Build docs developers (and LLMs) love