Skip to content
FeedbackDashboard

Retrieve the current user

client.User.Get(ctx) (*UserGetResponse, error)
GET/v0/user

Retrieve the currently authenticated user's information.

ReturnsExpand Collapse
type UserGetResponse struct{…}
ID string
Email string
GitHub UserGetResponseGitHub
Username string
Name string
Object UserGetResponseObject

Retrieve the current user

package main

import (
  "context"
  "fmt"

  "github.com/stainless-api/stainless-api-go"
  "github.com/stainless-api/stainless-api-go/option"
)

func main() {
  client := stainless.NewClient(
    option.WithAPIKey("My API Key"),
  )
  user, err := client.User.Get(context.TODO())
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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"
}