Skip to content
FeedbackDashboard

Retrieve the current user

client.user.retrieve(RequestOptionsoptions?): UserRetrieveResponse { id, email, github, 2 more }
GET/v0/user

Retrieve the currently authenticated user's information.

ReturnsExpand Collapse
UserRetrieveResponse { id, email, github, 2 more }
id: string
email: string | null
github: GitHub | null
username: string
name: string | null
object: "user"

Retrieve the current user

import Stainless from '@stainless-api/sdk';

const client = new Stainless({
  apiKey: process.env['STAINLESS_API_KEY'], // This is the default and can be omitted
});

const user = await client.user.retrieve();

console.log(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"
}