Skip to main content

Webhook request

Once a valid hook event is emitted, Logto will find corresponding webhooks and send a POST request per hook config.

Request headersโ€‹

KeyCustomizableNotes
user-agentโœ…Logto (https://logto.io/) by default.
content-typeโœ…application/json by default.
logto-signature-sha-256the signature of the request body, refer to Securing your webhooks.

You can overwrite customizable headers by customizing request headers with the same key.

Interaction hook events request bodyโ€‹

Cloud availabilityOSS availability

available events: PostRegister, PostSignIn, PostResetPassword;

The request body is a JSON object that contains three types of data field:

type UserEntity = {
id: string;
username?: string;
primaryEmail?: string;
primaryPhone?: string;
name?: string;
avatar?: string;
customData?: object;
identities?: object;
lastSignInAt?: string;
createdAt?: string;
applicationId?: string;
isSuspended?: boolean;
};
type ApplicationEntity = {
id: string;
name: string;
description?: string;
};
FieldTypeOptionalNotes
hookIdstringThe identifier in Logto.
eventstringWhich event that triggers this hook.
createdAtstringThe create time of payload in ISO format.
interactionEventstringThe interaction event that triggers this hook.
sessionIdstringโœ…The Session ID (not Interaction ID) for this event, if applicable.
userAgentstringโœ…The user-agent for the request that triggers this hook.
userIpstringโœ…The IP address for the request that triggers this hook.
userIdstringโœ…The related User ID for this event, if applicable.
userUserEntityโœ…The related user entity for this event, if applicable.
applicationIdstringโœ…The related Application ID for this event, if applicable.
applicationApplicationEntityโœ…The related application info for this event, if applicable.

See Users and Applications reference for detailed field explanations.

Data mutation hook events request bodyโ€‹

Cloud availabilityOSS availability

Standard request body fieldsโ€‹

FieldTypeOptionalNotes
hookIdstringThe identifier in Logto.
eventstringWhich event that triggers this hook.
createdAtstringThe create time of payload in ISO format.
userAgentstringโœ…The user-agent for the request.
ipstringโœ…The IP address for the request.

Interaction API context body fieldsโ€‹

Data mutation hook events that are triggered by user interaction API calls.

Available events: User.Created, User.Data.Updated,

FieldTypeOptionalNotes
interactionEventstringโœ…The interaction event that triggers this hook.
sessionIdstringโœ…The Session ID (not Interaction ID) for this event, if applicable.
applicationIdstringโœ…The related Application ID for this event, if applicable.
applicationApplicationEntityโœ…The related application info for this event, if applicable.

Management API context body fieldsโ€‹

Data mutation hook events that are triggered by Management API calls.

FieldTypeOptionalNotes
pathstringโœ…The path of the API call that triggers this hook.
methodstringโœ…The method of the API call that triggers this hook.
statusnumberโœ…The response status code of the API call that triggers this hook.
paramsobjectโœ…The request koa path params of the API call that triggers this hook.
matchedRoutestringโœ…The koa matched route of the API call that triggers this hook. Logto uses this field to match the enabled hook events.

Data payload body fieldsโ€‹

User eventsโ€‹

EventFieldTypeOptionalNotes
User.CreateddataUserEntityThe created user entity for this event.
User.Data.UpdateddataUserEntityThe updated user entity for this event.
User.Deleteddatanull/

Role eventsโ€‹

type Role = {
id: string;
name: string;
description: string;
type: 'User' | 'MachineToMachine';
isDefault: boolean;
};
type Scope = {
id: string;
name: string;
description: string;
resourceId: string;
createdAt: number;
};
EventFieldTypeOptionalNotes
Role.CreateddataRoleThe created role entity for this event.
Role.Data.UpdateddataRoleThe updated role entity for this event.
Role.Deleteddatanull
Role.Scope.UpdateddataScope[]The updated scopes assigned to the role.
Role.Scope.UpdatedroleIdstringโœ…The role ID that scopes are assigned to. (Only available when the event was triggered by create new role with pre-assigned scopes)

Permission(Scope) eventsโ€‹

EventFieldTypeOptionalNotes
Scope.CreateddataScopeThe created scope entity for this event.
Scope.Data.UpdateddataScopeThe updated scope entity for this event.
Scope.Deleteddatanull/

Organization eventsโ€‹

type Organization = {
id: string;
name: string;
description?: string;
customData: object;
createdAt: number;
};
EventFieldTypeOptionalNotes
Organization.CreateddataOrganizationThe created organization entity for this event.
Organization.Data.UpdateddataOrganizationThe updated organization entity for this event.
Organization.Deleteddatanull/
Organization.Membership.Updateddatanull/

OrganizationRole eventsโ€‹

type OrganizationRole = {
id: string;
name: string;
description?: string;
};
type OrganizationScope = {
id: string;
name: string;
description?: string;
};
EventFieldTypeOptionalNotes
OrganizationRole.CreateddataOrganizationRoleThe created organization role entity for this event.
OrganizationRole.Data.UpdateddataOrganizationRoleThe updated organization role entity for this event.
OrganizationRole.Deleteddatanull/
OrganizationRole.Scope.Updateddatanull/
OrganizationRole.Scope.UpdatedorganizationRoleIdstringโœ…The role ID that scopes are assigned to. (Only available when the event was triggered by create new role with pre-assigned scopes)

Organization permission(OrganizationScope) eventsโ€‹

EventFieldTypeOptionalNotes
OrganizationScope.CreateddataOrganizationScopeThe created organization scope entity.
OrganizationScope.Data.UpdateddataOrganizationScopeThe updated organization scope entity.
OrganizationScope.Deleteddatanull/