Skip to main content

Webhooks 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​

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​

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/