openapi: 3.0.0
info:
title: Auth0 Authentication actions rules API
description: Auth0 Authentication API. Endpoints for authentication and authorization using OpenID Connect, OAuth 2.0, SAML, WS-Federation, and Passwordless flows.
version: 1.0.0
servers:
- url: '{auth0_domain}'
description: The Authentication API is served over HTTPS.
variables:
auth0_domain:
description: Auth0 domain
default: https://demo.us.auth0.com
tags:
- name: rules
paths:
/rules:
get:
summary: Get Rules
description: 'Retrieve a filtered list of rules. Accepts a list of fields to include or exclude.
'
tags:
- rules
parameters:
- name: page
in: query
description: Page index of the results to return. First page is 0.
schema:
type: integer
minimum: 0
- name: per_page
in: query
description: Number of results per page.
schema:
type: integer
minimum: 0
maximum: 100
- name: include_totals
in: query
description: Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).
schema:
type: boolean
- name: enabled
in: query
description: Optional filter on whether a rule is enabled (true) or disabled (false).
schema:
type: boolean
- name: fields
in: query
description: 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.
schema:
type: string
pattern: ^((name)|(enabled)|(script)|(order)|(id)|(stage))(,((name)|(enabled)|(script)|(order)|(id)|(stage)))*$
- name: include_fields
in: query
description: Whether specified fields are to be included (true) or excluded (false).
schema:
type: boolean
responses:
'200':
description: Rules successfully retrieved.
content:
application/json:
schema:
$ref: '#/components/schemas/ListRulesResponseContent'
'400':
description: Invalid request query string. The message will vary depending on the cause.
'401':
description: Invalid token.
x-description-1: Client is not global.
x-description-2: Invalid signature received for JSON Web Token validation.
'403':
description: 'Insufficient scope; expected any of: read:rules.'
'404':
description: Rule not found.
'429':
description: Too many requests. Check the X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers.
operationId: get_rules
x-release-lifecycle: GA
x-operation-name: list
x-operation-request-parameters-name: ListRulesRequestParameters
x-operation-group: rules
security:
- bearerAuth: []
- oAuth2ClientCredentials:
- read:rules
post:
summary: Create a Rule
description: 'Create a new rule.
Note: Changing a rule''s stage of execution from the default login_success can change the rule''s function signature to have user omitted.
'
tags:
- rules
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateRuleRequestContent'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/CreateRuleRequestContent'
responses:
'201':
description: Rule successfully created.
content:
application/json:
schema:
$ref: '#/components/schemas/CreateRuleResponseContent'
'400':
description: Invalid request body. The message will vary depending on the cause.
'401':
description: Invalid token.
x-description-1: Client is not global.
x-description-2: Invalid signature received for JSON Web Token validation.
'403':
description: 'Insufficient scope; expected any of: read:rules.'
x-description-1: You reached the limit of entities of this type for this tenant.
'409':
description: A rule with the same name already exists.
x-description-1: A rule with the same order already exists.
x-description-2: A rule with the same execution stage already exists.
'429':
description: Too many requests. Check the X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers.
operationId: post_rules
x-release-lifecycle: GA
x-operation-name: create
x-operation-group: rules
security:
- bearerAuth: []
- oAuth2ClientCredentials:
- create:rules
/rules/{id}:
get:
summary: Get a Rule
description: 'Retrieve rule details. Accepts a list of fields to include or exclude in the result.
'
tags:
- rules
parameters:
- name: id
in: path
description: ID of the rule to retrieve.
required: true
schema:
type: string
pattern: ^rul_[A-Za-z0-9]{16}$
- name: fields
in: query
description: 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.
schema:
type: string
pattern: ^((name)|(enabled)|(script)|(order)|(id)|(stage))(,((name)|(enabled)|(script)|(order)|(id)|(stage)))*$
- name: include_fields
in: query
description: Whether specified fields are to be included (true) or excluded (false).
schema:
type: boolean
responses:
'200':
description: Rule successfully retrieved.
content:
application/json:
schema:
$ref: '#/components/schemas/GetRuleResponseContent'
'400':
description: Invalid request URI. The message will vary depending on the cause.
x-description-1: Invalid request query string. The message will vary depending on the cause.
'401':
description: Invalid token.
x-description-1: Client is not global.
x-description-2: Invalid signature received for JSON Web Token validation.
'403':
description: 'Insufficient scope; expected any of: read:rules.'
'404':
description: Rule not found.
'429':
description: Too many requests. Check the X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers.
operationId: get_rules_by_id
x-release-lifecycle: GA
x-operation-name: get
x-operation-request-parameters-name: GetRuleRequestParameters
x-operation-group: rules
security:
- bearerAuth: []
- oAuth2ClientCredentials:
- read:rules
delete:
summary: Delete a Rule
description: 'Delete a rule.
'
tags:
- rules
parameters:
- name: id
in: path
description: ID of the rule to delete.
required: true
schema:
type: string
pattern: ^rul_[A-Za-z0-9]{16}$
responses:
'204':
description: Rule successfully deleted.
'400':
description: Invalid request URI. The message will vary depending on the cause.
'401':
description: Invalid token.
x-description-1: Client is not global.
x-description-2: Invalid signature received for JSON Web Token validation.
'403':
description: 'Insufficient scope; expected any of: delete:rules.'
'429':
description: Too many requests. Check the X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers.
operationId: delete_rules_by_id
x-release-lifecycle: GA
x-operation-name: delete
x-operation-group: rules
security:
- bearerAuth: []
- oAuth2ClientCredentials:
- delete:rules
patch:
summary: Update a Rule
description: 'Update an existing rule.
'
tags:
- rules
parameters:
- name: id
in: path
description: ID of the rule to retrieve.
required: true
schema:
type: string
pattern: ^rul_[A-Za-z0-9]{16}$
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateRuleRequestContent'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/UpdateRuleRequestContent'
responses:
'200':
description: Rule successfully updated.
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateRuleResponseContent'
'400':
description: Invalid request URI. The message will vary depending on the cause.
x-description-1: Invalid request body. The message will vary depending on the cause.
'401':
description: Invalid token.
x-description-1: Client is not global.
x-description-2: Invalid signature received for JSON Web Token validation.
'403':
description: 'Insufficient scope; expected any of: update:rules.'
'404':
description: Rule not found.
'409':
description: A rule with the same name already exists.
'429':
description: Too many requests. Check the X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers.
operationId: patch_rules_by_id
x-release-lifecycle: GA
x-operation-name: update
x-operation-group: rules
security:
- bearerAuth: []
- oAuth2ClientCredentials:
- update:rules
components:
schemas:
CreateRuleRequestContent:
type: object
additionalProperties: false
required:
- name
- script
properties:
name:
type: string
description: Name of this rule.
default: my-rule
pattern: ^[a-zA-Z0-9]([ \-a-zA-Z0-9]*[a-zA-Z0-9])?$
script:
type: string
description: Code to be executed when this rule runs.
default: "function (user, context, callback) {\n callback(null, user, context);\n}"
minLength: 1
order:
type: number
description: Order that this rule should execute in relative to other rules. Lower-valued rules execute first.
default: 2
minimum: 0
enabled:
type: boolean
description: Whether the rule is enabled (true), or disabled (false).
default: true
CreateRuleResponseContent:
type: object
additionalProperties: false
properties:
name:
type: string
description: Name of this rule.
default: rule_1
id:
type: string
description: ID of this rule.
default: con_0000000000000001
enabled:
type: boolean
description: Whether the rule is enabled (true), or disabled (false).
default: true
script:
type: string
description: Code to be executed when this rule runs.
default: "function (user, context, callback) {\n callback(null, user, context);\n}"
order:
type: number
description: Order that this rule should execute in relative to other rules. Lower-valued rules execute first.
default: 1
stage:
type: string
description: Execution stage of this rule. Can be `login_success`, `login_failure`, or `pre_authorize`.
default: login_success
ListRulesOffsetPaginatedResponseContent:
type: object
additionalProperties: false
properties:
start:
type: number
limit:
type: number
total:
type: number
rules:
type: array
items:
$ref: '#/components/schemas/Rule'
UpdateRuleResponseContent:
type: object
additionalProperties: false
properties:
name:
type: string
description: Name of this rule.
default: rule_1
id:
type: string
description: ID of this rule.
default: con_0000000000000001
enabled:
type: boolean
description: Whether the rule is enabled (true), or disabled (false).
default: true
script:
type: string
description: Code to be executed when this rule runs.
default: "function (user, context, callback) {\n callback(null, user, context);\n}"
order:
type: number
description: Order that this rule should execute in relative to other rules. Lower-valued rules execute first.
default: 1
stage:
type: string
description: Execution stage of this rule. Can be `login_success`, `login_failure`, or `pre_authorize`.
default: login_success
Rule:
type: object
additionalProperties: false
properties:
name:
type: string
description: Name of this rule.
default: rule_1
id:
type: string
description: ID of this rule.
default: con_0000000000000001
enabled:
type: boolean
description: Whether the rule is enabled (true), or disabled (false).
default: true
script:
type: string
description: Code to be executed when this rule runs.
default: "function (user, context, callback) {\n callback(null, user, context);\n}"
order:
type: number
description: Order that this rule should execute in relative to other rules. Lower-valued rules execute first.
default: 1
stage:
type: string
description: Execution stage of this rule. Can be `login_success`, `login_failure`, or `pre_authorize`.
default: login_success
GetRuleResponseContent:
type: object
additionalProperties: false
properties:
name:
type: string
description: Name of this rule.
default: rule_1
id:
type: string
description: ID of this rule.
default: con_0000000000000001
enabled:
type: boolean
description: Whether the rule is enabled (true), or disabled (false).
default: true
script:
type: string
description: Code to be executed when this rule runs.
default: "function (user, context, callback) {\n callback(null, user, context);\n}"
order:
type: number
description: Order that this rule should execute in relative to other rules. Lower-valued rules execute first.
default: 1
stage:
type: string
description: Execution stage of this rule. Can be `login_success`, `login_failure`, or `pre_authorize`.
default: login_success
UpdateRuleRequestContent:
type: object
additionalProperties: false
minProperties: 1
properties:
script:
type: string
description: Code to be executed when this rule runs.
default: "function (user, context, callback) {\n callback(null, user, context);\n}"
minLength: 1
name:
type: string
description: Name of this rule.
default: my-rule
pattern: ^[a-zA-Z0-9]([ \-a-zA-Z0-9]*[a-zA-Z0-9])?$
order:
type: number
description: Order that this rule should execute in relative to other rules. Lower-valued rules execute first.
default: 2
minimum: 0
enabled:
type: boolean
description: Whether the rule is enabled (true), or disabled (false).
default: true
ListRulesResponseContent:
oneOf:
- type: array
items:
$ref: '#/components/schemas/Rule'
- $ref: '#/components/schemas/ListRulesOffsetPaginatedResponseContent'