Skip to content
Join our SlackContact usGet started

Update Subject

client.Subjects.Update(ctx, subjectID, body) (*SubjectResource, error)
put/subjects/{subject_id}

Update Subject

ParametersExpand Collapse
subjectID string
body SubjectUpdateParams
Email param.Field[string]

The email of the subject. Must be a valid email address.

formatemail
Metadata param.Field[map[string, string]]

Additional metadata about the subject. You may use this to store any custom data about the subject.

Name param.Field[string]

The name of the subject. Used for display in the dashboard.

ReturnsExpand Collapse
type SubjectResource struct{…}
ID string

The ID of the subject.

CreatedAt Time

The date and time the subject was created.

formatdate-time
Email string

The email of the subject.

formatemail
ExternalID string

The ID of the subject in your system. You may pass it to the API in place of the subject ID.

Metadata map[string, string]

Additional metadata about the subject. You may use this to store any custom data about the subject.

Name string

The name of the subject. Used for display in the dashboard.

Update Subject
package main

import (
  "context"
  "fmt"

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

func main() {
  client := lark.NewClient(
    option.WithAPIKey("My API Key"),
  )
  subjectResource, err := client.Subjects.Update(
    context.TODO(),
    "subject_id",
    lark.SubjectUpdateParams{
      Email: lark.String("john.doe@example.com"),
      Metadata: map[string]string{
      },
      Name: lark.String("John Doe"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", subjectResource.ID)
}
{
  "id": "subj_VyX6Q96h5avMho8O7QWlKeXE",
  "created_at": "2025-11-01T00:00:00Z",
  "email": "john.doe@example.com",
  "external_id": "user_1234567890",
  "metadata": {},
  "name": "John Doe"
}
Returns Examples
{
  "id": "subj_VyX6Q96h5avMho8O7QWlKeXE",
  "created_at": "2025-11-01T00:00:00Z",
  "email": "john.doe@example.com",
  "external_id": "user_1234567890",
  "metadata": {},
  "name": "John Doe"
}