Create organization invitation
curl --request POST \
--url https://api.openworklabs.com/v1/invitations \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"email": "jsmith@example.com",
"role": "<string>",
"teamId": "<string>"
}
'import requests
url = "https://api.openworklabs.com/v1/invitations"
payload = {
"email": "jsmith@example.com",
"role": "<string>",
"teamId": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({email: 'jsmith@example.com', role: '<string>', teamId: '<string>'})
};
fetch('https://api.openworklabs.com/v1/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://api.openworklabs.com/v1/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([
'email' => 'jsmith@example.com',
'role' => '<string>',
'teamId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-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.openworklabs.com/v1/invitations"
payload := strings.NewReader("{\n \"email\": \"jsmith@example.com\",\n \"role\": \"<string>\",\n \"teamId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-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.openworklabs.com/v1/invitations")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jsmith@example.com\",\n \"role\": \"<string>\",\n \"teamId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openworklabs.com/v1/invitations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"jsmith@example.com\",\n \"role\": \"<string>\",\n \"teamId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"invitationId": "<string>",
"email": "jsmith@example.com",
"role": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"inviteToken": "<string>",
"memberId": "<string>"
}{
"invitationId": "<string>",
"email": "jsmith@example.com",
"role": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"inviteToken": "<string>",
"memberId": "<string>"
}{
"error": "invalid_request",
"details": [
{
"message": "<string>",
"path": [
"<string>"
]
}
],
"message": "<string>",
"capability": "<string>"
}{
"error": "unauthorized"
}{
"error": "payment_required",
"reason": "seat_subscription_required",
"subscriptionType": "seat",
"currentCount": 123,
"freeSeatCount": 123,
"message": "<string>",
"billingUrl": "<string>",
"quote": {
"plan": "team",
"people": 0,
"joined": 0,
"invited": 0,
"unitAmount": 0,
"monthlyTotal": 0,
"currency": "<string>",
"interval": "<string>",
"available": true
}
}{
"error": "forbidden",
"reason": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "invite_email_domain_not_allowed",
"message": "<string>",
"emailDomain": "<string>",
"allowedEmailDomains": [
"<string>"
]
}{
"error": "invitation_email_failed",
"reason": "email_not_configured",
"message": "<string>",
"invitationId": "<string>",
"memberId": "<string>"
}Invitations
Create organization invitation
Creates or refreshes a pending organization invitation for an email address and sends the invite email. Returns 502 when the invitation is saved but no email could be sent, including when the deployment has no email service: the invitation and its link stay valid, so tell the user it is saved and offer the invite link (GET /v1/invitations/:invitationId/link) or sending again. Returns 402 with billingUrl when a Free workspace has used its free users: give the user billingUrl to start seat billing, then invite again. Returns 409 org_limit_reached when a Team or Enterprise plan set by OpenWork is full: OpenWork must add seats.
POST
/
v1
/
invitations
Create organization invitation
curl --request POST \
--url https://api.openworklabs.com/v1/invitations \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"email": "jsmith@example.com",
"role": "<string>",
"teamId": "<string>"
}
'import requests
url = "https://api.openworklabs.com/v1/invitations"
payload = {
"email": "jsmith@example.com",
"role": "<string>",
"teamId": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({email: 'jsmith@example.com', role: '<string>', teamId: '<string>'})
};
fetch('https://api.openworklabs.com/v1/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://api.openworklabs.com/v1/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([
'email' => 'jsmith@example.com',
'role' => '<string>',
'teamId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-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.openworklabs.com/v1/invitations"
payload := strings.NewReader("{\n \"email\": \"jsmith@example.com\",\n \"role\": \"<string>\",\n \"teamId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-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.openworklabs.com/v1/invitations")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jsmith@example.com\",\n \"role\": \"<string>\",\n \"teamId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openworklabs.com/v1/invitations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"jsmith@example.com\",\n \"role\": \"<string>\",\n \"teamId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"invitationId": "<string>",
"email": "jsmith@example.com",
"role": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"inviteToken": "<string>",
"memberId": "<string>"
}{
"invitationId": "<string>",
"email": "jsmith@example.com",
"role": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"inviteToken": "<string>",
"memberId": "<string>"
}{
"error": "invalid_request",
"details": [
{
"message": "<string>",
"path": [
"<string>"
]
}
],
"message": "<string>",
"capability": "<string>"
}{
"error": "unauthorized"
}{
"error": "payment_required",
"reason": "seat_subscription_required",
"subscriptionType": "seat",
"currentCount": 123,
"freeSeatCount": 123,
"message": "<string>",
"billingUrl": "<string>",
"quote": {
"plan": "team",
"people": 0,
"joined": 0,
"invited": 0,
"unitAmount": 0,
"monthlyTotal": 0,
"currency": "<string>",
"interval": "<string>",
"available": true
}
}{
"error": "forbidden",
"reason": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "invite_email_domain_not_allowed",
"message": "<string>",
"emailDomain": "<string>",
"allowedEmailDomains": [
"<string>"
]
}{
"error": "invitation_email_failed",
"reason": "email_not_configured",
"message": "<string>",
"invitationId": "<string>",
"memberId": "<string>"
}Authorizations
denApiKeybearerAuth
Body
application/json
Response
Existing invitation refreshed successfully.
Was this page helpful?