Passer au contenu principal
POST
/
member-invitations
Create member invitations
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
}
'
import requests

url = "https://{tenantDomain}/my-org/v1/member-invitations"

payload = {
    "invitees": [
        {
            "email": "user@example.com",
            "roles": ["rol_0000000000000001"]
        }
    ],
    "inviter": { "name": "Allison the Admin" },
    "identity_provider_id": "con_2CZPv6IY0gWzDaQJ",
    "ttl_sec": 3600
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    invitees: [{email: 'user@example.com', roles: ['rol_0000000000000001']}],
    inviter: {name: 'Allison the Admin'},
    identity_provider_id: 'con_2CZPv6IY0gWzDaQJ',
    ttl_sec: 3600
  })
};

fetch('https://{tenantDomain}/my-org/v1/member-invitations', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?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;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://{tenantDomain}/my-org/v1/member-invitations"

	payload := strings.NewReader("{\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}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://{tenantDomain}/my-org/v1/member-invitations")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .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}")
  .asString();
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

Authorization
string
header
requis

The access token received from the authorization server in the OAuth 2.0 flow.

En-têtes

auth0-custom-domain
string

Corps

application/json
invitees
object[]
requis
Required array length: 1 - 10 elements
inviter
object
identity_provider_id
string

Identity provider identifier.

Pattern: ^con_[A-Za-z0-9]{16}$
ttl_sec
integer
défaut:604800

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).

Plage requise: 0 <= x <= 2592000

Réponse

Create Member Invitations for an Organization.

id
string
read-only

The id of the member invitation

Pattern: ^uinv_[A-Za-z0-9]{16}$
organization_id
string
read-only

Organization identifier.

Pattern: ^org_[A-Za-z0-9]{16}$
inviter
object
invitee
object
identity_provider_id
string
read-only

Identity provider identifier.

Pattern: ^con_[A-Za-z0-9]{16}$
created_at
string<date-time>

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

expires_at
string<date-time>

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

roles
string[]
read-only

The ID of a role that can be assigned to a member of an organization.

Pattern: ^rol_[A-Za-z0-9]{16}$
invitation_url
string<uri>

The invitation url to be sent to the invitee.

ticket_id
string

The ID of the invitation ticket.