Passer au contenu principal
POST
https://{tenantDomain}/api/v2
/
guardian
/
enrollments
/
ticket
Go
package example

import (
    context "context"

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

func do() {
    client := client.NewClient(
        option.WithToken(
            "<token>",
        ),
    )
    request := &guardian.CreateGuardianEnrollmentTicketRequestContent{
        UserId: "user_id",
    }
    client.Guardian.Enrollments.CreateTicket(
        context.TODO(),
        request,
    )
}
import { ManagementClient } from "auth0";

async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.guardian.enrollments.createTicket({
userId: "user_id",
});
}
main();
import { ManagementClient } from "auth0";

async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.guardian.enrollments.createTicket({
userId: "user_id",
});
}
main();
curl --request POST \
--url https://{tenantDomain}/api/v2/guardian/enrollments/ticket \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user_id": "<string>",
"email": "jsmith@example.com",
"send_mail": true,
"email_locale": "<string>",
"allow_multiple_enrollments": true
}
'
import requests

url = "https://{tenantDomain}/api/v2/guardian/enrollments/ticket"

payload = {
"user_id": "<string>",
"email": "jsmith@example.com",
"send_mail": True,
"email_locale": "<string>",
"allow_multiple_enrollments": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenantDomain}/api/v2/guardian/enrollments/ticket",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'user_id' => '<string>',
'email' => 'jsmith@example.com',
'send_mail' => true,
'email_locale' => '<string>',
'allow_multiple_enrollments' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse<String> response = Unirest.post("https://{tenantDomain}/api/v2/guardian/enrollments/ticket")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"send_mail\": true,\n \"email_locale\": \"<string>\",\n \"allow_multiple_enrollments\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{tenantDomain}/api/v2/guardian/enrollments/ticket")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"send_mail\": true,\n \"email_locale\": \"<string>\",\n \"allow_multiple_enrollments\": true\n}"

response = http.request(request)
puts response.read_body
{
  "ticket_id": "u2x2-u2x2-u2x2-u2x2-u2x2-u2x2",
  "ticket_url": "<string>"
}

Autorisations

Authorization
string
header
requis

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

En-têtes

auth0-custom-domain
string

Custom domain to be used for this request

Required string length: 3 - 255

Corps

user_id
string<user-id>
requis

user_id for the enrollment ticket

email
string<email>

alternate email to which the enrollment email will be sent. Optional - by default, the email will be sent to the user's default address

send_mail
boolean

Send an email to the user to start the enrollment

email_locale
string

Optional. Specify the locale of the enrollment email. Used with send_email.

factor
enum<string>

Optional. Specifies which factor the user must enroll with.
Note: Parameter can only be used with Universal Login; it cannot be used with Classic Login or custom MFA pages.

Options disponibles:
push-notification,
phone,
email,
otp,
webauthn-roaming,
webauthn-platform
allow_multiple_enrollments
boolean

Optional. Allows a user who has previously enrolled in MFA to enroll with additional factors.
Note: Parameter can only be used with Universal Login; it cannot be used with Classic Login or custom MFA pages.

Réponse

Enrollment ticket successfully created.

ticket_id
string
défaut:u2x2-u2x2-u2x2-u2x2-u2x2-u2x2

The ticket_id used to identify the enrollment

ticket_url
string<url>

The url you can use to start enrollment