メインコンテンツへスキップ
POST
https://{tenantDomain}/api/v2
/
organizations
/
{id}
/
invitations
Go
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"
    organizations "github.com/auth0/go-auth0/management/management/organizations"
)

func do() {
    client := client.NewClient(
        option.WithToken(
            "<token>",
        ),
    )
    request := &organizations.CreateOrganizationInvitationRequestContent{
        Inviter: &management.OrganizationInvitationInviter{
            Name: "name",
        },
        Invitee: &management.OrganizationInvitationInvitee{
            Email: "email",
        },
        ClientId: "client_id",
    }
    client.Organizations.Invitations.Create(
        context.TODO(),
        "id",
        request,
    )
}
import { ManagementClient } from "auth0";

async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.organizations.invitations.create("id", {
inviter: {
name: "name",
},
invitee: {
email: "email",
},
clientId: "client_id",
});
}
main();
import { ManagementClient } from "auth0";

async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.organizations.invitations.create("id", {
inviter: {
name: "name",
},
invitee: {
email: "email",
},
clientId: "client_id",
});
}
main();
curl --request POST \
--url https://{tenantDomain}/api/v2/organizations/{id}/invitations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inviter": {
"name": "Jane Doe"
},
"invitee": {
"email": "john.doe@gmail.com"
},
"client_id": "AaiyAPdpYdesoKnqjj8HJqRn4T5titww",
"connection_id": "con_0000000000000001",
"app_metadata": {},
"user_metadata": {},
"ttl_sec": 1296000,
"roles": [
"<string>"
],
"send_invitation_email": true
}
'
import requests

url = "https://{tenantDomain}/api/v2/organizations/{id}/invitations"

payload = {
"inviter": { "name": "Jane Doe" },
"invitee": { "email": "john.doe@gmail.com" },
"client_id": "AaiyAPdpYdesoKnqjj8HJqRn4T5titww",
"connection_id": "con_0000000000000001",
"app_metadata": {},
"user_metadata": {},
"ttl_sec": 1296000,
"roles": ["<string>"],
"send_invitation_email": 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/organizations/{id}/invitations",
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([
'inviter' => [
'name' => 'Jane Doe'
],
'invitee' => [
'email' => 'john.doe@gmail.com'
],
'client_id' => 'AaiyAPdpYdesoKnqjj8HJqRn4T5titww',
'connection_id' => 'con_0000000000000001',
'app_metadata' => [

],
'user_metadata' => [

],
'ttl_sec' => 1296000,
'roles' => [
'<string>'
],
'send_invitation_email' => 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/organizations/{id}/invitations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inviter\": {\n \"name\": \"Jane Doe\"\n },\n \"invitee\": {\n \"email\": \"john.doe@gmail.com\"\n },\n \"client_id\": \"AaiyAPdpYdesoKnqjj8HJqRn4T5titww\",\n \"connection_id\": \"con_0000000000000001\",\n \"app_metadata\": {},\n \"user_metadata\": {},\n \"ttl_sec\": 1296000,\n \"roles\": [\n \"<string>\"\n ],\n \"send_invitation_email\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{tenantDomain}/api/v2/organizations/{id}/invitations")

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 \"inviter\": {\n \"name\": \"Jane Doe\"\n },\n \"invitee\": {\n \"email\": \"john.doe@gmail.com\"\n },\n \"client_id\": \"AaiyAPdpYdesoKnqjj8HJqRn4T5titww\",\n \"connection_id\": \"con_0000000000000001\",\n \"app_metadata\": {},\n \"user_metadata\": {},\n \"ttl_sec\": 1296000,\n \"roles\": [\n \"<string>\"\n ],\n \"send_invitation_email\": true\n}"

response = http.request(request)
puts response.read_body
{
  "id": "uinv_0000000000000001",
  "organization_id": "<string>",
  "inviter": {
    "name": "Jane Doe"
  },
  "invitee": {
    "email": "john.doe@gmail.com"
  },
  "invitation_url": "https://mycompany.org/login?invitation=f81dWWYW6gzGGicxT8Ha0txBkGNcAcYr&organization=org_0000000000000001&organization_name=acme",
  "created_at": "2020-08-20T19:10:06.299Z",
  "expires_at": "2020-08-27T19:10:06.299Z",
  "client_id": "AaiyAPdpYdesoKnqjj8HJqRn4T5titww",
  "connection_id": "con_0000000000000001",
  "app_metadata": {},
  "user_metadata": {},
  "roles": [
    "<string>"
  ],
  "ticket_id": "<string>"
}

承認

Authorization
string
header
必須

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

ヘッダー

auth0-custom-domain
string

Custom domain to be used for this request

Required string length: 3 - 255

パスパラメータ

id
string
必須

Organization identifier.

Maximum string length: 50

ボディ

inviter
object
必須
invitee
object
必須
client_id
string<client-id>
デフォルト:AaiyAPdpYdesoKnqjj8HJqRn4T5titww
必須

Auth0 client ID. Used to resolve the application's login initiation endpoint.

connection_id
string<connection-id>
デフォルト:con_0000000000000001

The id of the connection to force invitee to authenticate with.

app_metadata
object

Data related to the user that does affect the application's core functionality.

user_metadata
object

Data related to the user that does not affect the application's core functionality.

ttl_sec
integer

Number of seconds for which the invitation is valid before expiration. If unspecified or set to 0, this value defaults to 604800 seconds (7 days). Max value: 2592000 seconds (30 days).

必須範囲: 0 <= x <= 2592000
roles
string<role-id>[]

List of roles IDs to associated with the user.

Minimum array length: 1
send_invitation_email
boolean
デフォルト:true

Whether the user will receive an invitation email (true) or no email (false), true by default

レスポンス

Invitation successfully created.

id
string<user-invitation-id>
デフォルト:uinv_0000000000000001

The id of the user invitation.

organization_id
string<organization-id>

Organization identifier.

Maximum string length: 50
inviter
object
invitee
object
invitation_url
string<strict-https-uri>
デフォルト:https://mycompany.org/login?invitation=f81dWWYW6gzGGicxT8Ha0txBkGNcAcYr&organization=org_0000000000000001&organization_name=acme

The invitation url to be send to the invitee.

created_at
string<date-time>
デフォルト:2020-08-20T19:10:06.299Z

The ISO 8601 formatted timestamp representing the creation time of the invitation.

expires_at
string<date-time>
デフォルト:2020-08-27T19:10:06.299Z

The ISO 8601 formatted timestamp representing the expiration time of the invitation.

client_id
string<client-id>
デフォルト:AaiyAPdpYdesoKnqjj8HJqRn4T5titww

Auth0 client ID. Used to resolve the application's login initiation endpoint.

connection_id
string<connection-id>
デフォルト:con_0000000000000001

The id of the connection to force invitee to authenticate with.

app_metadata
object

Data related to the user that does affect the application's core functionality.

user_metadata
object

Data related to the user that does not affect the application's core functionality.

roles
string<role-id>[]

List of roles IDs to associated with the user.

Minimum array length: 1
ticket_id
string<ticket-id>

The id of the invitation ticket