Invite user
curl --request POST \
--url https://api.royalti.io/auth/invite \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jsmith@example.com",
"sendEmail": true,
"message": "Welcome to the workspace!",
"redirectUrl": "https://app.royalti.io/email/activate"
}
'import requests
url = "https://api.royalti.io/auth/invite"
payload = {
"email": "jsmith@example.com",
"sendEmail": True,
"message": "Welcome to the workspace!",
"redirectUrl": "https://app.royalti.io/email/activate"
}
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({
email: 'jsmith@example.com',
sendEmail: true,
message: 'Welcome to the workspace!',
redirectUrl: 'https://app.royalti.io/email/activate'
})
};
fetch('https://api.royalti.io/auth/invite', 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://api.royalti.io/auth/invite",
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([
'email' => 'jsmith@example.com',
'sendEmail' => true,
'message' => 'Welcome to the workspace!',
'redirectUrl' => 'https://app.royalti.io/email/activate'
]),
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://api.royalti.io/auth/invite"
payload := strings.NewReader("{\n \"email\": \"jsmith@example.com\",\n \"sendEmail\": true,\n \"message\": \"Welcome to the workspace!\",\n \"redirectUrl\": \"https://app.royalti.io/email/activate\"\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://api.royalti.io/auth/invite")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jsmith@example.com\",\n \"sendEmail\": true,\n \"message\": \"Welcome to the workspace!\",\n \"redirectUrl\": \"https://app.royalti.io/email/activate\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.royalti.io/auth/invite")
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 \"email\": \"jsmith@example.com\",\n \"sendEmail\": true,\n \"message\": \"Welcome to the workspace!\",\n \"redirectUrl\": \"https://app.royalti.io/email/activate\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Successful, Email verification Instructions have been sent to your email"
}{
"message": "Only workspace owners can invite users"
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<string>"
]
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<string>"
]
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<string>"
]
}
}Auth
Invite user
/auth/invite
POST
/
auth
/
invite
Invite user
curl --request POST \
--url https://api.royalti.io/auth/invite \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jsmith@example.com",
"sendEmail": true,
"message": "Welcome to the workspace!",
"redirectUrl": "https://app.royalti.io/email/activate"
}
'import requests
url = "https://api.royalti.io/auth/invite"
payload = {
"email": "jsmith@example.com",
"sendEmail": True,
"message": "Welcome to the workspace!",
"redirectUrl": "https://app.royalti.io/email/activate"
}
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({
email: 'jsmith@example.com',
sendEmail: true,
message: 'Welcome to the workspace!',
redirectUrl: 'https://app.royalti.io/email/activate'
})
};
fetch('https://api.royalti.io/auth/invite', 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://api.royalti.io/auth/invite",
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([
'email' => 'jsmith@example.com',
'sendEmail' => true,
'message' => 'Welcome to the workspace!',
'redirectUrl' => 'https://app.royalti.io/email/activate'
]),
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://api.royalti.io/auth/invite"
payload := strings.NewReader("{\n \"email\": \"jsmith@example.com\",\n \"sendEmail\": true,\n \"message\": \"Welcome to the workspace!\",\n \"redirectUrl\": \"https://app.royalti.io/email/activate\"\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://api.royalti.io/auth/invite")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jsmith@example.com\",\n \"sendEmail\": true,\n \"message\": \"Welcome to the workspace!\",\n \"redirectUrl\": \"https://app.royalti.io/email/activate\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.royalti.io/auth/invite")
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 \"email\": \"jsmith@example.com\",\n \"sendEmail\": true,\n \"message\": \"Welcome to the workspace!\",\n \"redirectUrl\": \"https://app.royalti.io/email/activate\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Successful, Email verification Instructions have been sent to your email"
}{
"message": "Only workspace owners can invite users"
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<string>"
]
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<string>"
]
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<string>"
]
}
}This endpoint requires authentication. Include your Bearer token in the Authorization header.
Description
/auth/invite Description: Creates or updates an invitation for a workspace member. The endpoint guarantees that aTenantInvite record exists so workspace admins can audit, resend, or cancel the invite through /user/invites. When an invite is cancelled later, the associated activation link is invalidated automatically.
Method:POST
Security:
- Basic Authentication required
| Parameter | Type | Description | Required |
|---|---|---|---|
| userId (Optional) | string | Existing tenant user record to attach to the invite | No |
| Parameter | Type | Description |
|---|---|---|
| string | Email address to invite. | |
| sendEmail (Optional) | boolean | Whether to send the invite email (defaults to true). |
| message (Optional) | string | Custom text to include with the invite email. |
| redirectUrl (Optional) | string | Override activation redirect URL in the invite email. |
Invitations are only available to workspace owners or admins. A tenant user can only have one active invitation at a time.
Code Examples
const response = await fetch('https://api.royalti.io/auth/invite', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"email": "sample-email",
"sendEmail": true,
"message": "Welcome to the workspace!",
"redirectUrl": "https://app.royalti.io/email/activate"
})
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://api.royalti.io/auth/invite',
headers={
'Authorization': f'Bearer {token}'
},
json={"email":"sample-email","sendEmail":true,"message":"Welcome to the workspace!","redirectUrl":"https://app.royalti.io/email/activate"}
)
data = response.json()
print(data)
curl -X POST https://api.royalti.io/auth/invite \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"email":"sample-email","sendEmail":true,"message":"Welcome to the workspace!","redirectUrl":"https://app.royalti.io/email/activate"}'
Authorizations
JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"
Query Parameters
The tenant user record to associate with the invite
Body
application/json
The email address of the user to be invited
Whether to email the invitation (defaults to true)
Custom message that will be included in the invite email
Example:
"Welcome to the workspace!"
URL override for the activation link in the invite email
Example:
"https://app.royalti.io/email/activate"
Response
Success - Existing User Invite
⌘I