Skip to content
FeedbackDashboard

Retrieve the current user

user.retrieve() -> UserRetrieveResponse
GET/v0/user

Retrieve the currently authenticated user's information.

ReturnsExpand Collapse
class UserRetrieveResponse:
id: str
email: Optional[str]
github: Optional[GitHub]
username: str
name: Optional[str]
object: Literal["user"]

Retrieve the current user

import os
from stainless_v0 import Stainless

client = Stainless(
    api_key=os.environ.get("STAINLESS_API_KEY"),  # This is the default and can be omitted
)
user = client.user.retrieve()
print(user.id)
{
  "id": "id",
  "email": "email",
  "github": {
    "username": "username"
  },
  "name": "name",
  "object": "user"
}
Returns Examples
{
  "id": "id",
  "email": "email",
  "github": {
    "username": "username"
  },
  "name": "name",
  "object": "user"
}