Update Member - Stytch Docs
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
C# Code Example
// PUT /v1/b2b/organizations/{organization_id}/members/{member_id}
const stytch = require('stytch');
const client = new stytch.B2BClient({
project_id: '${projectId}',
secret: '${secret}',
});
const params = {
organization_id: "organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931",
member_id: "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
name: "Jane Doe",
external_id: "my-new-external-id",
};
const options = {
authorization: {
session_token: '${sessionToken}',
},
};
client.Organizations.Members.Update(params, options)
.then(resp => { console.log(resp) })
.catch(err => { console.log(err) });
Go Code Example
// PUT /v1/b2b/organizations/{organization_id}/members/{member_id}
package main
import (
"context"
"log"
"github.com/stytchauth/stytch-go/v18/stytch/b2b/b2bstytchapi"
"github.com/stytchauth/stytch-go/v18/stytch/b2b/organizations/members"
"github.com/stytchauth/stytch-go/v18/stytch/methodoptions"
)
func main() {
client, err := b2bstytchapi.NewClient(
"${projectId}",
"${secret}",
)
if err != nil {
log.Fatalf("error instantiating client: %v", err)
}
params := &members.UpdateParams{
OrganizationID: "organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931",
MemberID: "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
Name: "Jane Doe",
ExternalID: "my-new-external-id",
}
options := &members.UpdateParamsOptions{
Authorization: methodoptions.Authorization{
SessionToken: "${sessionToken}",
},
}
resp, err := client.Organizations.Members.Update(context.Background(), params, options)
if err != nil {
log.Fatalf("error in method call: %v", err)
}
log.Println(resp)
}
Java Code Example
// PUT /v1/b2b/organizations/{organization_id}/members/{member_id}
package com.example;
import com.stytch.java.b2b.models.organizationsmembers.UpdateRequest;
import com.stytch.java.b2b.models.organizationsmembers.UpdateRequestOptions;
import com.stytch.java.b2b.StytchB2BClient;
import com.stytch.java.common.methodoptions.Authorization;
import com.stytch.java.common.StytchResult;
public class Main {
public static void main(String[] args) {
StytchB2BClient.configure("${projectId}", "${secret}");
UpdateRequest params = new UpdateRequest();
params.setOrganizationId("organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931");
params.setMemberId("member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f");
params.setName("Jane Doe");
params.setExternalId("my-new-external-id");
UpdateRequestOptions options = new UpdateRequestOptions();
Authorization authorization = new Authorization();
authorization.setSessionToken("${sessionToken}");
options.setAuthorization(authorization);
Object result = StytchB2BClient.getOrganizations().getMembers().update(params, options);
if (result instanceof StytchResult.Success) {
System.out.println(((StytchResult.Success) result).getValue());
} else {
System.out.println(((StytchResult.Error) result).getException());
}
}
}
Python Code Example
# PUT /v1/b2b/organizations/{organization_id}/members/{member_id}
from stytch import B2BClient
from stytch.b2b.models.organizations_members import UpdateRequestOptions
from stytch.shared.method_options import Authorization
client = B2BClient(
project_id="${projectId}",
secret="${secret}",
)
resp = client.organizations.members.update(
organization_id="organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931",
member_id="member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
name="Jane Doe",
external_id="my-new-external-id",
method_options=UpdateRequestOptions(
authorization=Authorization(
session_token="${sessionToken}",
),
),
)
print(resp)
cURL Example
# PUT /v1/b2b/organizations/{organization_id}/members/{member_id}
curl --request PUT \
--url https://test.stytch.com/v1/b2b/organizations/organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931/members/member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f \
-u '${projectId}:${secret}' \
-H 'Content-Type: application/json' \
-H "X-Stytch-Member-Session: ${sessionToken}" \
-d '{
"name": "Jane Doe",
"external_id": "my-new-external-id"
}'
Template Response
{
"request_id": "<string>",
"member_id": "<string>",
"member": {
"organization_id": "<string>",
"member_id": "<string>",
"email_address": "<string>",
"status": "<string>",
"name": "<string>",
"sso_registrations": [{
"connection_id": "<string>",
"external_id": "<string>",
"registration_id": "<string>",
"sso_attributes": {}
}],
"is_breakglass": true,
"member_password_id": "<string>",
"oauth_registrations": [{
"provider_type": "<string>",
"provider_subject": "<string>",
"member_oauth_registration_id": "<string>",
"profile_picture_url": "<string>",
"locale": "<string>"
}],
"email_address_verified": true,
"mfa_phone_number_verified": true,
"is_admin": true,
"roles": [{
"role_id": "<string>",
"sources": [{
"type": "<string>",
"details": {}
}]
}],
"trusted_metadata": {},
"created_at": "<string>",
"updated_at": "<string>"
},
"organization": {
"organization_id": "<string>",
"organization_name": "<string>",
"organization_logo_url": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
},
"status_code": 123
}
Error Codes
{
"status_code": 401,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"error_type": "unauthorized_credentials",
"error_message": "Unauthorized credentials."
}
{
"status_code": 429,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"error_type": "too_many_requests",
"error_message": "Too many requests have been made."
}
{
"status_code": 500,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"error_type": "internal_server_error",
"error_message": "Oops, something seems to have gone wrong."
}