Invites
Generate invite code
Creates a shareable invite code that can be used by anyone to join the workspace.
POST
/
workspaces
/
{workspaceSlug}
/
invites
/
code
/
Generate invite code
curl --request POST \
--url https://api.example.com/workspaces/{workspaceSlug}/invites/code/ \
--header 'Content-Type: application/json' \
--data '
{
"expiresIn": "in24Hours",
"invitedRole": "owner"
}
'import requests
url = "https://api.example.com/workspaces/{workspaceSlug}/invites/code/"
payload = {
"expiresIn": "in24Hours",
"invitedRole": "owner"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({expiresIn: 'in24Hours', invitedRole: 'owner'})
};
fetch('https://api.example.com/workspaces/{workspaceSlug}/invites/code/', 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.example.com/workspaces/{workspaceSlug}/invites/code/",
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([
'expiresIn' => 'in24Hours',
'invitedRole' => 'owner'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/workspaces/{workspaceSlug}/invites/code/"
payload := strings.NewReader("{\n \"expiresIn\": \"in24Hours\",\n \"invitedRole\": \"owner\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/workspaces/{workspaceSlug}/invites/code/")
.header("Content-Type", "application/json")
.body("{\n \"expiresIn\": \"in24Hours\",\n \"invitedRole\": \"owner\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/workspaces/{workspaceSlug}/invites/code/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"expiresIn\": \"in24Hours\",\n \"invitedRole\": \"owner\"\n}"
response = http.request(request)
puts response.read_body{
"expiresAt": "2023-11-07T05:31:56Z",
"inviteCode": "<string>",
"role": "owner",
"workspaceSlug": "<string>"
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}"<string>""<string>"Path Parameters
URL-safe workspace identifier.
Body
application/json
Request to generate a shareable invite code for a workspace.
Request to generate a shareable invite code for a workspace.
Response
Response containing a generated shareable invite code.
Response containing a generated shareable invite code.
When the invite code expires.
The generated invite code that can be shared.
Role assigned when someone joins via this code.
Allowed value:
"owner"Handle of the workspace this invite code is for.
Required string length:
3 - 32Pattern:
^[a-z0-9]+(?:-[a-z0-9]+)*$Generate invite code
curl --request POST \
--url https://api.example.com/workspaces/{workspaceSlug}/invites/code/ \
--header 'Content-Type: application/json' \
--data '
{
"expiresIn": "in24Hours",
"invitedRole": "owner"
}
'import requests
url = "https://api.example.com/workspaces/{workspaceSlug}/invites/code/"
payload = {
"expiresIn": "in24Hours",
"invitedRole": "owner"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({expiresIn: 'in24Hours', invitedRole: 'owner'})
};
fetch('https://api.example.com/workspaces/{workspaceSlug}/invites/code/', 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.example.com/workspaces/{workspaceSlug}/invites/code/",
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([
'expiresIn' => 'in24Hours',
'invitedRole' => 'owner'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/workspaces/{workspaceSlug}/invites/code/"
payload := strings.NewReader("{\n \"expiresIn\": \"in24Hours\",\n \"invitedRole\": \"owner\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/workspaces/{workspaceSlug}/invites/code/")
.header("Content-Type", "application/json")
.body("{\n \"expiresIn\": \"in24Hours\",\n \"invitedRole\": \"owner\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/workspaces/{workspaceSlug}/invites/code/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"expiresIn\": \"in24Hours\",\n \"invitedRole\": \"owner\"\n}"
response = http.request(request)
puts response.read_body{
"expiresAt": "2023-11-07T05:31:56Z",
"inviteCode": "<string>",
"role": "owner",
"workspaceSlug": "<string>"
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}{
"message": "<string>",
"name": "<string>",
"resource": "<string>",
"suggestion": "<string>",
"validation": [
{
"code": "<string>",
"field": "<string>",
"message": "<string>",
"params": {}
}
]
}"<string>""<string>"