Skip to main content
GET
https://{tenantDomain}/api/v2
/
rules
/
{id}
C#
using Auth0.ManagementApi;
using System.Threading.Tasks;

public partial class Examples
{
    public async Task Example() {
        var client = new ManagementClient(
            token: "<token>"
        );

        await client.Rules.GetAsync(
            id: "id",
            request: new GetRuleRequestParameters {
                Fields = "fields",
                IncludeFields = true
            }
        );
    }

}
package example

import (
    context "context"

    management "github.com/auth0/go-auth0/management/management"
    client "github.com/auth0/go-auth0/management/management/client"
    option "github.com/auth0/go-auth0/management/management/option"
)

func do() {
    client := client.NewClient(
        option.WithToken(
            "<token>",
        ),
    )
    request := &management.GetRuleRequestParameters{
        Fields: management.String(
            "fields",
        ),
        IncludeFields: management.Bool(
            true,
        ),
    }
    client.Rules.Get(
        context.TODO(),
        "id",
        request,
    )
}
package com.example.usage;

import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.resources.rules.requests.GetRuleRequestParameters;

public class Example {
    public static void main(String[] args) {
        ManagementApi client = ManagementApi
            .builder()
            .token("<token>")
            .build();

        client.rules().get(
            "id",
            GetRuleRequestParameters
                .builder()
                .fields("fields")
                .includeFields(true)
                .build()
        );
    }
}
<?php

namespace Example;

use Auth0\SDK\API\Management\Management;
use Auth0\SDK\API\Management\Rules\Requests\GetRuleRequestParameters;

$client = new Management(
    token: '<token>',
);
$client->rules->get(
    'id',
    new GetRuleRequestParameters([
        'fields' => 'fields',
        'includeFields' => true,
    ]),
);
from auth0.management import ManagementClient

client = ManagementClient(
    token="<token>",
)

client.rules.get(
    id="id",
    fields="fields",
    include_fields=True,
)
require "auth0"

client = Auth0::Management.new(token: "<token>")

client.rules.get(
  id: "id",
  fields: "fields",
  include_fields: true
)
import { ManagementClient } from "auth0";

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.rules.get("id", {
        fields: "fields",
        includeFields: true,
    });
}
main();
import { ManagementClient } from "auth0";

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.rules.get("id", {
        fields: "fields",
        includeFields: true,
    });
}
main();
curl --request GET \
  --url https://{tenantDomain}/api/v2/rules/{id} \
  --header 'Authorization: Bearer <token>'
{
  "name": "rule_1",
  "id": "con_0000000000000001",
  "enabled": true,
  "script": "function (user, context, callback) {\n  callback(null, user, context);\n}",
  "order": 1,
  "stage": "login_success"
}

Authorizations

Authorization
string
header
required

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

Path Parameters

id
string
required

ID of the rule to retrieve.

Query Parameters

fields
string

Comma-separated list of fields to include or exclude (based on value provided for include_fields) in the result. Leave empty to retrieve all fields.

include_fields
boolean

Whether specified fields are to be included (true) or excluded (false).

Response

Rule successfully retrieved.

name
string
default:rule_1

Name of this rule.

id
string
default:con_0000000000000001

ID of this rule.

enabled
boolean
default:true

Whether the rule is enabled (true), or disabled (false).

script
string
default:function (user, context, callback) { callback(null, user, context); }

Code to be executed when this rule runs.

order
number
default:1

Order that this rule should execute in relative to other rules. Lower-valued rules execute first.

stage
string
default:login_success

Execution stage of this rule. Can be login_success, login_failure, or pre_authorize.