Skip to main content

Update User By ID

Update a user's basic profile data.

Authentication​

This endpoint requires a bearer access token for the System API.

Endpoint​

PUT /api/v1/users/{userId}
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

Request​

Headers​

HeaderRequiredDescription
AuthorizationYesBearer token for a System API client
Content-TypeYesMust be application/json

Path Parameters​

ParameterTypeRequiredDescription
userIdintegerYesUser identifier

Query Parameters​

This endpoint does not accept query parameters.

Request Body​

{
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"triggerWebhook": true
}

Request Fields​

FieldTypeRequiredDescription
firstNamestringYesUser first name. Maximum length: 50.
lastNamestringYesUser last name. Maximum length: 50.
emailstringYesUser email address. Must be a valid email address.
triggerWebhookbooleanNoWhen true, the API sends the UserUpdated webhook event to subscriptions for that event. Default: false.

Validation Rules​

  • firstName is required and must not exceed 50 characters
  • lastName is required and must not exceed 50 characters
  • email must be a valid email address

Response​

204 No Content​

The user was updated successfully.

This endpoint does not return a response body on success.

Errors​

StatusWhen it happens
400 Bad RequestThe request body is invalid
401 UnauthorizedThe bearer token is missing, invalid, or expired
403 ForbiddenThe token is valid but does not have access to this endpoint
404 Not FoundNo user exists with the provided userId

404 Example​

User not found

Behavior​

  • The API trims firstName and lastName
  • The API trims and lowercases the email address before storing it
  • When triggerWebhook is true, Guardhouse sends the UserUpdated webhook event to subscriptions for that event

Example​

cURL​

curl -X PUT "https://your-tenant.guardhouse.cloud/api/v1/users/101" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"triggerWebhook": true
}'

.NET SDK​

using Guardhouse.SDK.Models.Users;
using Guardhouse.SDK.Services;

// Assumes AddGuardhouseClientWithApiClients(...) is already configured.
app.MapPut("/example/users/{userId:int}", async (int userId, IGuardhouseUsersClient usersClient) =>
{
var updated = await usersClient.UpdateUserAsync(userId, new UpdateUserRequest
{
FirstName = "John",
LastName = "Doe",
Email = "[email protected]",
TriggerWebhook = true
});

return updated ? Results.NoContent() : Results.NotFound();
});

Python (raw HTTP)​

# The Python beta does not expose System API helpers.
# Use raw HTTP for now.
#
# Example shape:
# response = requests.put(
# "https://your-tenant.guardhouse.cloud/api/v1/users/101",
# headers={
# "Authorization": "Bearer YOUR_ACCESS_TOKEN",
# "Content-Type": "application/json",
# },
# json={
# "firstName": "John",
# "lastName": "Doe",
# "email": "[email protected]",
# "triggerWebhook": True,
# },
# )

Notes​