GET

List Hooks

Use this API to return a list of all Smart Hooks that have been created in a OneLogin account.

Resource URL

https://<subdomain>.onelogin.com/api/2/hooks

Header Parameters

Authorization

required

string

Set to bearer <access_token>.

Set <access_token> to the access token you generated using the Generate Token API.

The access token must have been generated using an API credential pair created using the scope required to call this API. This API can be called using any one of the following scopes: Manage All.

In order to use Smart Hooks your API Credentials must be created after 21st October 2020.

Query Parameters

Standard pagination is supported. Max page limit is 1000. See Pagination for detail on how this works.

Many of the search tools described in our Getting Started documentation can be applied to your parameters, allowing you to fine-tune your results.

Sample Responses

[
  {
    "id": "d360aded-6063-4c60-8add-45f32772ff71",
    "type": "pre-authentication",
    "packages": {
      "ua-parser-js": "0.7.21"
    },
    "runtime": "nodejs18.x",
    "context_version": ">= 1.0.0",
    "retries": 0,
    "timeout": 1,
    "disabled": false,
    "status": "ready",
    "env_vars": [
      "MY_API_KEY"
    ],
    "options": {
      "location_enabled": false,
      "risk_enabled": false,
      "mfa_device_info_enabled": false
    },
    "created_at": "2020-10-14T01:54:59.976Z",
    "updated_at": "2020-10-16T17:28:45.970Z"
  }
]

Typically, this error means that your access token value is invalid.

{
    "name": "UnauthorizedError",
    "message": "The request requires user authentication."
}

Response Elements

idThe Hook unique ID in OneLogin.
typeA string describing the type of hook. e.g. pre-authentication
packagesAn object containing NPM packages that are bundled with the hook function.
runtimeThe Smart Hooks supported Node.js version to execute this hook with.
context_versionThe semantic version of the content that will be injected into this hook.
retriesDefault 0. Max 4. Number of retries if execution fails.
timeoutDefault 1. The number of seconds to allow the hook function to run before before timing out. Maximum timeout varies based on the type of hook. See overview for more details.
disabledBoolean to enable or disable the hook. Disabled hooks will not run.
statusString describing the state of the hook function. When a hook is ready and disabled is false it will be executed.
  • ready
  • create-queued
  • create-running
  • create-failed
  • update-queued
  • update-running
  • update-failed
env_varsArray of Environment Variable objects that will be available via process.env.ENV_VAR_NAME in the hook code.
options

A set of attributes allow control over the information that is included in the hook context.

See the docs for each hook type to learn about which config options are available.

created_atISO8601 format date that they hook function was created.
created_atISO8601 format date that they hook function was last updated.

Postman Collection

Run In Postman

Sample Code

cURL

Replace sample values indicated by < > with your actual values.

List Smart Hooks

curl 'https://<subdomain>.onelogin.com/api/2/hooks' \
-X GET \
-H "Authorization: bearer <access_token>"