TypeScript
import { MyOrganizationClient } from "@auth0/myorganization-js";
async function main() {
const client = new MyOrganizationClient({
domain: "{YOUR_DOMAIN}",
token: "<token>",
});
await client.organization.invitations.create({
invitees: [
{
email: "user@example.com",
roles: [
"rol_0000000000000001",
],
},
],
inviter: {
name: "Allison the Admin",
},
identity_provider_id: "con_2CZPv6IY0gWzDaQJ",
ttl_sec: 3600,
});
}
main();import { MyOrganizationClient } from "@auth0/myorganization-js";
async function main() {
const client = new MyOrganizationClient({
domain: "{YOUR_DOMAIN}",
token: "<token>",
});
await client.organization.invitations.create({
invitees: [
{
email: "user@example.com",
roles: [
"rol_0000000000000001",
],
},
],
inviter: {
name: "Allison the Admin",
},
identity_provider_id: "con_2CZPv6IY0gWzDaQJ",
ttl_sec: 3600,
});
}
main();
package example
import (
context "context"
myorganization "github.com/auth0/myorganization-go/v2"
client "github.com/auth0/myorganization-go/v2/client"
option "github.com/auth0/myorganization-go/v2/option"
)
func do() {
c, err := client.New(
"{YOUR_DOMAIN}",
option.WithToken(
"<token>",
),
)
if err != nil {
return
}
request := &myorganization.CreateMemberInvitationRequestContent{
Invitees: []*myorganization.CreateMemberInvitationInvitee{
&myorganization.CreateMemberInvitationInvitee{
Email: "user@example.com",
Roles: []myorganization.RoleID{
"rol_0000000000000001",
},
},
},
Inviter: &myorganization.MemberInvitationInviter{
Name: myorganization.String(
"Allison the Admin",
),
},
IdentityProviderID: myorganization.String(
"con_2CZPv6IY0gWzDaQJ",
),
TTLSec: myorganization.Int(
3600,
),
}
c.Organization.Invitations.Create(
context.TODO(),
request,
)
}
using Auth0.MyOrganizationApi;
using System.Threading.Tasks;
using Auth0.MyOrganizationApi.Organization;
using System.Collections.Generic;
public partial class Examples
{
public async Task Example() {
var client = new MyOrganizationClient(new MyOrganizationClientOptions
{
Domain = "{YOUR_DOMAIN}",
TokenProvider = new DelegateTokenProvider(_ => Task.FromResult("<token>"))
});
await client.Organization.Invitations.CreateAsync(
new CreateMemberInvitationRequestContent {
Invitees = new List<CreateMemberInvitationInvitee>(){
new CreateMemberInvitationInvitee {
Email = "user@example.com",
Roles = new List<string>(){
"rol_0000000000000001",
}
},
}
,
Inviter = new MemberInvitationInviter {
Name = "Allison the Admin"
},
IdentityProviderId = "con_2CZPv6IY0gWzDaQJ",
TtlSec = 3600
}
);
}
}
package com.example.usage;
import com.auth0.client.myorganization.auth.MyOrganizationClient;
import com.auth0.client.myorganization.organization.types.CreateMemberInvitationRequestContent;
import com.auth0.client.myorganization.types.CreateMemberInvitationInvitee;
import com.auth0.client.myorganization.types.MemberInvitationInviter;
import java.util.Arrays;
import java.util.Optional;
public class Example {
public static void main(String[] args) {
MyOrganizationClient client = MyOrganizationClient
.builder()
.domain("{YOUR_DOMAIN}")
.token("<token>")
.build();
client.organization().invitations().create(
CreateMemberInvitationRequestContent
.builder()
.invitees(
Arrays.asList(
CreateMemberInvitationInvitee
.builder()
.email("user@example.com")
.roles(
Optional.of(
Arrays.asList("rol_0000000000000001")
)
)
.build()
)
)
.inviter(
MemberInvitationInviter
.builder()
.name("Allison the Admin")
.build()
)
.identityProviderId("con_2CZPv6IY0gWzDaQJ")
.ttlSec(3600)
.build()
);
}
}from auth0.myorganization import MyOrganizationClient, CreateMemberInvitationInvitee, MemberInvitationInviter
client = MyOrganizationClient(
domain="{YOUR_DOMAIN}",
token="<token>",
)
client.organization.invitations.create(
invitees=[
CreateMemberInvitationInvitee(
email="user@example.com",
roles=[
"rol_0000000000000001"
],
)
],
inviter=MemberInvitationInviter(
name="Allison the Admin",
),
identity_provider_id="con_2CZPv6IY0gWzDaQJ",
ttl_sec=3600,
)
curl --request POST \
--url https://{tenantDomain}/my-org/v1/member-invitations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"invitees": [
{
"email": "user@example.com",
"roles": [
"rol_0000000000000001"
]
}
],
"inviter": {
"name": "Allison the Admin"
},
"identity_provider_id": "con_2CZPv6IY0gWzDaQJ",
"ttl_sec": 3600
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenantDomain}/my-org/v1/member-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([
'invitees' => [
[
'email' => 'user@example.com',
'roles' => [
'rol_0000000000000001'
]
]
],
'inviter' => [
'name' => 'Allison the Admin'
],
'identity_provider_id' => 'con_2CZPv6IY0gWzDaQJ',
'ttl_sec' => 3600
]),
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;
}require 'uri'
require 'net/http'
url = URI("https://{tenantDomain}/my-org/v1/member-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 \"invitees\": [\n {\n \"email\": \"user@example.com\",\n \"roles\": [\n \"rol_0000000000000001\"\n ]\n }\n ],\n \"inviter\": {\n \"name\": \"Allison the Admin\"\n },\n \"identity_provider_id\": \"con_2CZPv6IY0gWzDaQJ\",\n \"ttl_sec\": 3600\n}"
response = http.request(request)
puts response.read_body[
{
"id": "uinv_12345678abcdefgh",
"organization_id": "org_12345678abcdefgh",
"inviter": {
"name": "Allison the Admin"
},
"invitee": {
"email": "user@example.com"
},
"identity_provider_id": "con_2CZPv6IY0gWzDaQJ",
"created_at": "2025-04-11T20:11:45.431Z",
"expires_at": "2025-04-11T20:11:45.431Z",
"roles": [
"rol_BKW1BKIfBKd0BaI0"
],
"invitation_url": "https://example.auth0.com/login?invitation=uinv_12345678abcdefgh&organization=org_12345678abcdefgh",
"ticket_id": "1asdfasd23usjdef"
}
]Créer des invitations destinées à un membre
Créez une ou plusieurs invitations destinées aux membres de cette organisation. Si une invitation active existe déjà pour un utilisateur, la génération d’une nouvelle invitation révoquera automatiquement toutes les invitations en attente pour cet utilisateur. Les rôles spécifiés dans la charge utile seront attribués à l’utilisateur lorsqu’il acceptera l’invitation.
POST
/
member-invitations
TypeScript
import { MyOrganizationClient } from "@auth0/myorganization-js";
async function main() {
const client = new MyOrganizationClient({
domain: "{YOUR_DOMAIN}",
token: "<token>",
});
await client.organization.invitations.create({
invitees: [
{
email: "user@example.com",
roles: [
"rol_0000000000000001",
],
},
],
inviter: {
name: "Allison the Admin",
},
identity_provider_id: "con_2CZPv6IY0gWzDaQJ",
ttl_sec: 3600,
});
}
main();import { MyOrganizationClient } from "@auth0/myorganization-js";
async function main() {
const client = new MyOrganizationClient({
domain: "{YOUR_DOMAIN}",
token: "<token>",
});
await client.organization.invitations.create({
invitees: [
{
email: "user@example.com",
roles: [
"rol_0000000000000001",
],
},
],
inviter: {
name: "Allison the Admin",
},
identity_provider_id: "con_2CZPv6IY0gWzDaQJ",
ttl_sec: 3600,
});
}
main();
package example
import (
context "context"
myorganization "github.com/auth0/myorganization-go/v2"
client "github.com/auth0/myorganization-go/v2/client"
option "github.com/auth0/myorganization-go/v2/option"
)
func do() {
c, err := client.New(
"{YOUR_DOMAIN}",
option.WithToken(
"<token>",
),
)
if err != nil {
return
}
request := &myorganization.CreateMemberInvitationRequestContent{
Invitees: []*myorganization.CreateMemberInvitationInvitee{
&myorganization.CreateMemberInvitationInvitee{
Email: "user@example.com",
Roles: []myorganization.RoleID{
"rol_0000000000000001",
},
},
},
Inviter: &myorganization.MemberInvitationInviter{
Name: myorganization.String(
"Allison the Admin",
),
},
IdentityProviderID: myorganization.String(
"con_2CZPv6IY0gWzDaQJ",
),
TTLSec: myorganization.Int(
3600,
),
}
c.Organization.Invitations.Create(
context.TODO(),
request,
)
}
using Auth0.MyOrganizationApi;
using System.Threading.Tasks;
using Auth0.MyOrganizationApi.Organization;
using System.Collections.Generic;
public partial class Examples
{
public async Task Example() {
var client = new MyOrganizationClient(new MyOrganizationClientOptions
{
Domain = "{YOUR_DOMAIN}",
TokenProvider = new DelegateTokenProvider(_ => Task.FromResult("<token>"))
});
await client.Organization.Invitations.CreateAsync(
new CreateMemberInvitationRequestContent {
Invitees = new List<CreateMemberInvitationInvitee>(){
new CreateMemberInvitationInvitee {
Email = "user@example.com",
Roles = new List<string>(){
"rol_0000000000000001",
}
},
}
,
Inviter = new MemberInvitationInviter {
Name = "Allison the Admin"
},
IdentityProviderId = "con_2CZPv6IY0gWzDaQJ",
TtlSec = 3600
}
);
}
}
package com.example.usage;
import com.auth0.client.myorganization.auth.MyOrganizationClient;
import com.auth0.client.myorganization.organization.types.CreateMemberInvitationRequestContent;
import com.auth0.client.myorganization.types.CreateMemberInvitationInvitee;
import com.auth0.client.myorganization.types.MemberInvitationInviter;
import java.util.Arrays;
import java.util.Optional;
public class Example {
public static void main(String[] args) {
MyOrganizationClient client = MyOrganizationClient
.builder()
.domain("{YOUR_DOMAIN}")
.token("<token>")
.build();
client.organization().invitations().create(
CreateMemberInvitationRequestContent
.builder()
.invitees(
Arrays.asList(
CreateMemberInvitationInvitee
.builder()
.email("user@example.com")
.roles(
Optional.of(
Arrays.asList("rol_0000000000000001")
)
)
.build()
)
)
.inviter(
MemberInvitationInviter
.builder()
.name("Allison the Admin")
.build()
)
.identityProviderId("con_2CZPv6IY0gWzDaQJ")
.ttlSec(3600)
.build()
);
}
}from auth0.myorganization import MyOrganizationClient, CreateMemberInvitationInvitee, MemberInvitationInviter
client = MyOrganizationClient(
domain="{YOUR_DOMAIN}",
token="<token>",
)
client.organization.invitations.create(
invitees=[
CreateMemberInvitationInvitee(
email="user@example.com",
roles=[
"rol_0000000000000001"
],
)
],
inviter=MemberInvitationInviter(
name="Allison the Admin",
),
identity_provider_id="con_2CZPv6IY0gWzDaQJ",
ttl_sec=3600,
)
curl --request POST \
--url https://{tenantDomain}/my-org/v1/member-invitations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"invitees": [
{
"email": "user@example.com",
"roles": [
"rol_0000000000000001"
]
}
],
"inviter": {
"name": "Allison the Admin"
},
"identity_provider_id": "con_2CZPv6IY0gWzDaQJ",
"ttl_sec": 3600
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenantDomain}/my-org/v1/member-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([
'invitees' => [
[
'email' => 'user@example.com',
'roles' => [
'rol_0000000000000001'
]
]
],
'inviter' => [
'name' => 'Allison the Admin'
],
'identity_provider_id' => 'con_2CZPv6IY0gWzDaQJ',
'ttl_sec' => 3600
]),
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;
}require 'uri'
require 'net/http'
url = URI("https://{tenantDomain}/my-org/v1/member-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 \"invitees\": [\n {\n \"email\": \"user@example.com\",\n \"roles\": [\n \"rol_0000000000000001\"\n ]\n }\n ],\n \"inviter\": {\n \"name\": \"Allison the Admin\"\n },\n \"identity_provider_id\": \"con_2CZPv6IY0gWzDaQJ\",\n \"ttl_sec\": 3600\n}"
response = http.request(request)
puts response.read_body[
{
"id": "uinv_12345678abcdefgh",
"organization_id": "org_12345678abcdefgh",
"inviter": {
"name": "Allison the Admin"
},
"invitee": {
"email": "user@example.com"
},
"identity_provider_id": "con_2CZPv6IY0gWzDaQJ",
"created_at": "2025-04-11T20:11:45.431Z",
"expires_at": "2025-04-11T20:11:45.431Z",
"roles": [
"rol_BKW1BKIfBKd0BaI0"
],
"invitation_url": "https://example.auth0.com/login?invitation=uinv_12345678abcdefgh&organization=org_12345678abcdefgh",
"ticket_id": "1asdfasd23usjdef"
}
]Autorisations
OAuth2ClientCredentialsOAuth2AuthCode
Scopes
Corps
application/json
Nombre de secondes pendant lesquelles l’invitation est valide avant d’expirer. S’il n’est pas précisé ou s’il est défini à 0, ce paramètre prend par défaut la valeur de 604800 secondes (7 jours). Valeur maximale : 2592000 secondes (30 jours).
Plage requise:
0 <= x <= 2592000Réponse
Créer des invitations de membres pour une organisation.