Skip to main content
GET
/
hooks
TypeScript
import { ManagementClient } from "auth0";

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.hooks.list({
        page: 1,
        perPage: 1,
        includeTotals: true,
        enabled: true,
        fields: "fields",
        triggerId: "credentials-exchange",
    });
}
main();
[
  {
    "triggerId": "<string>",
    "id": "00001",
    "name": "hook",
    "enabled": true,
    "script": "module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };",
    "dependencies": {}
  }
]

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

page
integer

Page index of the results to return. First page is 0.

Required range: x >= 0
per_page
integer

Number of results per page.

Required range: 0 <= x <= 100
include_totals
boolean

Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).

enabled
boolean

Optional filter on whether a hook is enabled (true) or disabled (false).

fields
string

Comma-separated list of fields to include in the result. Leave empty to retrieve all fields.

Pattern: ^((id)|(name)|(script)|(dependencies)|(enabled)|(triggerId))(,((id)|(name)|(script)|(dependencies)|(enabled)|(triggerId)))*$
triggerId
enum<string>

Retrieves hooks that match the trigger

Available options:
credentials-exchange,
pre-user-registration,
post-user-registration,
post-change-password,
send-phone-message

Response

Hooks successfully retrieved.

triggerId
string

Trigger ID

id
string
default:00001

ID of this hook.

name
string
default:hook

Name of this hook.

enabled
boolean
default:true

Whether this hook will be executed (true) or ignored (false).

script
string
default:module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };

Code to be executed when this hook runs.

dependencies
object

Dependencies of this hook used by webtask server.