Invite
Invite users
Invite users to the workspace by email. Each email gets its own result: an email that cannot be invited does not prevent the others from being invited.
POST
/
v1
/
invites
cURL
curl --request POST \
--url https://api.claap.io/v1/invites \
--header 'Content-Type: application/json' \
--header 'X-Claap-Key: <api-key>' \
--data '
{
"emails": [
"jane.doe@example.com",
"john.smith@example.com",
"alex.martin@example.com"
],
"role": "Member",
"message": "Welcome to the team!"
}
'import requests
url = "https://api.claap.io/v1/invites"
payload = {
"emails": ["jane.doe@example.com", "john.smith@example.com", "alex.martin@example.com"],
"role": "Member",
"message": "Welcome to the team!"
}
headers = {
"X-Claap-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Claap-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
emails: ['jane.doe@example.com', 'john.smith@example.com', 'alex.martin@example.com'],
role: 'Member',
message: 'Welcome to the team!'
})
};
fetch('https://api.claap.io/v1/invites', 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.claap.io/v1/invites",
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([
'emails' => [
'jane.doe@example.com',
'john.smith@example.com',
'alex.martin@example.com'
],
'role' => 'Member',
'message' => 'Welcome to the team!'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Claap-Key: <api-key>"
],
]);
$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.claap.io/v1/invites"
payload := strings.NewReader("{\n \"emails\": [\n \"jane.doe@example.com\",\n \"john.smith@example.com\",\n \"alex.martin@example.com\"\n ],\n \"role\": \"Member\",\n \"message\": \"Welcome to the team!\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Claap-Key", "<api-key>")
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.claap.io/v1/invites")
.header("X-Claap-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"emails\": [\n \"jane.doe@example.com\",\n \"john.smith@example.com\",\n \"alex.martin@example.com\"\n ],\n \"role\": \"Member\",\n \"message\": \"Welcome to the team!\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.claap.io/v1/invites")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Claap-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"emails\": [\n \"jane.doe@example.com\",\n \"john.smith@example.com\",\n \"alex.martin@example.com\"\n ],\n \"role\": \"Member\",\n \"message\": \"Welcome to the team!\"\n}"
response = http.request(request)
puts response.read_body{
"result": {
"results": [
{
"email": "jane.doe@example.com",
"outcome": "invited"
},
{
"email": "john.smith@example.com",
"outcome": "already_member",
"userId": "Xk2Rd7Mv4Bn9Ts1Lq6Wf3"
},
{
"email": "alex.martin@example.com",
"outcome": "failed",
"error": "Cannot invite suspended user"
}
]
}
}Invites up to 50 people to the workspace by email. The invite email is sent on behalf of the person who created the API key.
Each email gets its own
outcome:
invited: an invite was created, the user joins the workspace when they accept it.added: the email already has a Claap account, the user was added to the workspace right away.already_member: the email is already an active user of the workspace.failed: the email could not be invited, for instance because it is not valid, the user is suspended, or the invite limit is reached for that workspace.errorexplains why.
Authorizations
Body
application/json
Emails to invite.
Required array length:
1 - 50 elementsRole given to the invited users. On a workspace without an active subscription, users are always invited as Owner.
Available options:
Member, Admin, Owner User groups the invited users join.
Personal message added to the invite email.
Response
Invites were processed
Show child attributes
Show child attributes
⌘I
cURL
curl --request POST \
--url https://api.claap.io/v1/invites \
--header 'Content-Type: application/json' \
--header 'X-Claap-Key: <api-key>' \
--data '
{
"emails": [
"jane.doe@example.com",
"john.smith@example.com",
"alex.martin@example.com"
],
"role": "Member",
"message": "Welcome to the team!"
}
'import requests
url = "https://api.claap.io/v1/invites"
payload = {
"emails": ["jane.doe@example.com", "john.smith@example.com", "alex.martin@example.com"],
"role": "Member",
"message": "Welcome to the team!"
}
headers = {
"X-Claap-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Claap-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
emails: ['jane.doe@example.com', 'john.smith@example.com', 'alex.martin@example.com'],
role: 'Member',
message: 'Welcome to the team!'
})
};
fetch('https://api.claap.io/v1/invites', 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.claap.io/v1/invites",
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([
'emails' => [
'jane.doe@example.com',
'john.smith@example.com',
'alex.martin@example.com'
],
'role' => 'Member',
'message' => 'Welcome to the team!'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Claap-Key: <api-key>"
],
]);
$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.claap.io/v1/invites"
payload := strings.NewReader("{\n \"emails\": [\n \"jane.doe@example.com\",\n \"john.smith@example.com\",\n \"alex.martin@example.com\"\n ],\n \"role\": \"Member\",\n \"message\": \"Welcome to the team!\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Claap-Key", "<api-key>")
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.claap.io/v1/invites")
.header("X-Claap-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"emails\": [\n \"jane.doe@example.com\",\n \"john.smith@example.com\",\n \"alex.martin@example.com\"\n ],\n \"role\": \"Member\",\n \"message\": \"Welcome to the team!\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.claap.io/v1/invites")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Claap-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"emails\": [\n \"jane.doe@example.com\",\n \"john.smith@example.com\",\n \"alex.martin@example.com\"\n ],\n \"role\": \"Member\",\n \"message\": \"Welcome to the team!\"\n}"
response = http.request(request)
puts response.read_body{
"result": {
"results": [
{
"email": "jane.doe@example.com",
"outcome": "invited"
},
{
"email": "john.smith@example.com",
"outcome": "already_member",
"userId": "Xk2Rd7Mv4Bn9Ts1Lq6Wf3"
},
{
"email": "alex.martin@example.com",
"outcome": "failed",
"error": "Cannot invite suspended user"
}
]
}
}