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-agentLogto (https://logto.io/) by default.
content-typeapplication/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.
sessionIdstringThe Session ID (not Interaction ID) for this event, if applicable.
userAgentstringThe user-agent for the request that triggers this hook.
userIpstringThe IP address for the request that triggers this hook.
userIdstringThe related User ID for this event, if applicable.
userUserEntityThe related user entity for this event, if applicable.
applicationIdstringThe related Application ID for this event, if applicable.
applicationApplicationEntityThe 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.
userAgentstringThe user-agent for the request.
ipstringThe 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
interactionEventstringThe interaction event that triggers this hook.
sessionIdstringThe Session ID (not Interaction ID) for this event, if applicable.
applicationIdstringThe related Application ID for this event, if applicable.
applicationApplicationEntityThe 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
pathstringThe path of the API call that triggers this hook.
methodstringThe method of the API call that triggers this hook.
statusnumberThe response status code of the API call that triggers this hook.
paramsobjectThe request koa path params of the API call that triggers this hook.
matchedRoutestringThe 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.UpdatedroleIdstringThe 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.UpdatedorganizationRoleIdstringThe 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/