curl --request POST \
--url https://accounts.livechat.com/v2/accounts/invitations \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "john@example.com",
"name": "John",
"product": "LiveChat"
}
'import requests
url = "https://accounts.livechat.com/v2/accounts/invitations"
payload = {
"email": "john@example.com",
"name": "John",
"product": "LiveChat"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({email: 'john@example.com', name: 'John', product: 'LiveChat'})
};
fetch('https://accounts.livechat.com/v2/accounts/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://accounts.livechat.com/v2/accounts/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' => 'john@example.com',
'name' => 'John',
'product' => 'LiveChat'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://accounts.livechat.com/v2/accounts/invitations"
payload := strings.NewReader("{\n \"email\": \"john@example.com\",\n \"name\": \"John\",\n \"product\": \"LiveChat\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://accounts.livechat.com/v2/accounts/invitations")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"john@example.com\",\n \"name\": \"John\",\n \"product\": \"LiveChat\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://accounts.livechat.com/v2/accounts/invitations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"john@example.com\",\n \"name\": \"John\",\n \"product\": \"LiveChat\"\n}"
response = http.request(request)
puts response.read_body{
"invitation_id": "496a94f2-cbbf-444e-a3cb-305b9f5f8cbb"
}{
"invitation_id": "496a94f2-cbbf-444e-a3cb-305b9f5f8cbb"
}{
"error": "bad_request",
"error_description": "The server cannot or will not process the request due to an apparent client error (for example, malformed request syntax, size too large).",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "unauthorized",
"error_description": "The account is not authorized.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "conflict",
"error_description": "The request couldn't be processed because of conflict in the current state of the resource.",
"resource_name": "account",
"resource_id": "5903c51b-89f0-41a9-a25d-4f39af100353",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "invalid_request",
"error_description": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.",
"invalid_fields": {
"email": "invalid email address"
},
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "server_error",
"error_description": "The server encountered an unexpected condition that prevented it from fulfilling the request.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}Create an account invitation
Create an account invitation for the given email, organization_id, and product. After the successful creation, it sends an email to all users with the invitation approval scopes, informing them about the new account awaiting the approval. organization_id and creator_id are retrieved from the access token.
curl --request POST \
--url https://accounts.livechat.com/v2/accounts/invitations \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "john@example.com",
"name": "John",
"product": "LiveChat"
}
'import requests
url = "https://accounts.livechat.com/v2/accounts/invitations"
payload = {
"email": "john@example.com",
"name": "John",
"product": "LiveChat"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({email: 'john@example.com', name: 'John', product: 'LiveChat'})
};
fetch('https://accounts.livechat.com/v2/accounts/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://accounts.livechat.com/v2/accounts/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' => 'john@example.com',
'name' => 'John',
'product' => 'LiveChat'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://accounts.livechat.com/v2/accounts/invitations"
payload := strings.NewReader("{\n \"email\": \"john@example.com\",\n \"name\": \"John\",\n \"product\": \"LiveChat\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://accounts.livechat.com/v2/accounts/invitations")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"john@example.com\",\n \"name\": \"John\",\n \"product\": \"LiveChat\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://accounts.livechat.com/v2/accounts/invitations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"john@example.com\",\n \"name\": \"John\",\n \"product\": \"LiveChat\"\n}"
response = http.request(request)
puts response.read_body{
"invitation_id": "496a94f2-cbbf-444e-a3cb-305b9f5f8cbb"
}{
"invitation_id": "496a94f2-cbbf-444e-a3cb-305b9f5f8cbb"
}{
"error": "bad_request",
"error_description": "The server cannot or will not process the request due to an apparent client error (for example, malformed request syntax, size too large).",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "unauthorized",
"error_description": "The account is not authorized.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "conflict",
"error_description": "The request couldn't be processed because of conflict in the current state of the resource.",
"resource_name": "account",
"resource_id": "5903c51b-89f0-41a9-a25d-4f39af100353",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "invalid_request",
"error_description": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.",
"invalid_fields": {
"email": "invalid email address"
},
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "server_error",
"error_description": "The server encountered an unexpected condition that prevented it from fulfilling the request.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}accounts.invitations--my:rwAuthorizations
Use your account ID as the username and your personal access token (PAT) as the password, or pass a Base64-encoded value directly in the Authorization header. For more information, see the personal access tokens guide.
Body
Email address of the invited account.
The name of the invited account (nick; first, second name; or both). If an invitation was issued to an existing account, this field will be replaced with the name assigned to that account.
The product to which an account is invited.
Response
OK: Returns an existing account's invitation ID.
Unique account invitation identifier.
Was this page helpful?