Create a hook

POST /api/hooks

Create a new hook with the given data.

application/json

Body Required

  • tenantId string

    Maximum length is 21.

  • name string

    The name of the hook.

    Minimum length is 1, maximum length is 256.

  • event string Deprecated

    Use events instead.

    Values are PostRegister, PostSignIn, PostResetPassword, User.Created, User.Deleted, User.Data.Updated, User.SuspensionStatus.Updated, Role.Created, Role.Deleted, Role.Data.Updated, Role.Scopes.Updated, Scope.Created, Scope.Deleted, Scope.Data.Updated, Organization.Created, Organization.Deleted, Organization.Data.Updated, Organization.Membership.Updated, OrganizationRole.Created, OrganizationRole.Deleted, OrganizationRole.Data.Updated, OrganizationRole.Scopes.Updated, OrganizationScope.Created, OrganizationScope.Deleted, or OrganizationScope.Data.Updated.

  • events array[string]

    An array of hook events.

    Values are PostRegister, PostSignIn, PostResetPassword, User.Created, User.Deleted, User.Data.Updated, User.SuspensionStatus.Updated, Role.Created, Role.Deleted, Role.Data.Updated, Role.Scopes.Updated, Scope.Created, Scope.Deleted, Scope.Data.Updated, Organization.Created, Organization.Deleted, Organization.Data.Updated, Organization.Membership.Updated, OrganizationRole.Created, OrganizationRole.Deleted, OrganizationRole.Data.Updated, OrganizationRole.Scopes.Updated, OrganizationScope.Created, OrganizationScope.Deleted, or OrganizationScope.Data.Updated.

  • config object Required

    Additional properties are allowed.

    Hide config attributes Show config attributes object
    • url string Required
    • headers object
      Hide headers attribute Show headers attribute object
      • * string Additional properties
    • retries number Deprecated

      Now the retry times is fixed to 3. Keep for backward compatibility.

  • enabled boolean

Responses

  • 201 application/json

    The hook was created successfully.

    Hide response attributes Show response attributes object
    • tenantId string Required

      Maximum length is 21.

    • id string Required

      Minimum length is 1, maximum length is 21.

    • name string Required

      Maximum length is 256.

    • event string | null Required

      Values are PostRegister, PostSignIn, PostResetPassword, User.Created, User.Deleted, User.Data.Updated, User.SuspensionStatus.Updated, Role.Created, Role.Deleted, Role.Data.Updated, Role.Scopes.Updated, Scope.Created, Scope.Deleted, Scope.Data.Updated, Organization.Created, Organization.Deleted, Organization.Data.Updated, Organization.Membership.Updated, OrganizationRole.Created, OrganizationRole.Deleted, OrganizationRole.Data.Updated, OrganizationRole.Scopes.Updated, OrganizationScope.Created, OrganizationScope.Deleted, or OrganizationScope.Data.Updated.

    • events array[string] Required

      Values are PostRegister, PostSignIn, PostResetPassword, User.Created, User.Deleted, User.Data.Updated, User.SuspensionStatus.Updated, Role.Created, Role.Deleted, Role.Data.Updated, Role.Scopes.Updated, Scope.Created, Scope.Deleted, Scope.Data.Updated, Organization.Created, Organization.Deleted, Organization.Data.Updated, Organization.Membership.Updated, OrganizationRole.Created, OrganizationRole.Deleted, OrganizationRole.Data.Updated, OrganizationRole.Scopes.Updated, OrganizationScope.Created, OrganizationScope.Deleted, or OrganizationScope.Data.Updated.

    • config object Required

      Additional properties are allowed.

      Hide config attributes Show config attributes object
      • url string Required
      • headers object
        Hide headers attribute Show headers attribute object
        • * string Additional properties
      • retries number
    • signingKey string Required

      Maximum length is 64.

    • enabled boolean Required
    • createdAt number Required
  • Bad Request

  • Unauthorized

  • Forbidden

POST /api/hooks
curl \
 -X POST https://[tenant_id].logto.app/api/hooks \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"tenantId":"string","name":"string","event":"PostRegister","events":["PostRegister"],"config":{"url":"string","headers":{"additionalProperty1":"string","additionalProperty2":"string"},"retries":42.0},"enabled":true,"createdAt":42.0}'
Request examples
{
  "tenantId": "string",
  "name": "string",
  "event": "PostRegister",
  "events": [
    "PostRegister"
  ],
  "config": {
    "url": "string",
    "headers": {
      "additionalProperty1": "string",
      "additionalProperty2": "string"
    },
    "retries": 42.0
  },
  "enabled": true,
  "createdAt": 42.0
}
Response examples (201)
{
  "tenantId": "string",
  "id": "string",
  "name": "string",
  "event": "PostRegister",
  "events": [
    "PostRegister"
  ],
  "config": {
    "url": "string",
    "headers": {
      "additionalProperty1": "string",
      "additionalProperty2": "string"
    },
    "retries": 42.0
  },
  "signingKey": "string",
  "enabled": true,
  "createdAt": 42.0
}