User Management
Add a User
Add someone to your business with a role, or bring back a user removed earlier ➕
POST
/
external
/
v1
/
businesses
/
{businessId}
/
users
Add a User
curl --request POST \
--url https://api.example.com/external/v1/businesses/{businessId}/usersimport requests
url = "https://api.example.com/external/v1/businesses/{businessId}/users"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/external/v1/businesses/{businessId}/users', 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/external/v1/businesses/{businessId}/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/external/v1/businesses/{businessId}/users"
req, _ := http.NewRequest("POST", url, nil)
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/external/v1/businesses/{businessId}/users")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/external/v1/businesses/{businessId}/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyEndpoint
POST https://api.connectly.ai/external/v1/businesses/{businessId}/users
| Parameter | Location | Description |
|---|---|---|
businessId | Path | Your Connectly business ID. |
X-API-Key | Header | A User Management key. |
Request body
{
"email": "ana@example.com",
"displayName": "Ana Souza",
"role": "ROLE_AGENT"
}
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | The email the person signs in with. |
role | string | Yes | ROLE_MARKETING, ROLE_ANALYTICS or ROLE_AGENT. Owners cannot be added through the API. |
displayName | string | No | The name shown in Connectly. Defaults to the email. Ignored when a removed user comes back (MEMBERSHIP_REVIVED): they keep their name. |
Response
The API returns HTTP201 with the user as added, what the call did with the email, and what became of the invite email.
{
"entity": {
"id": "2438ac3c-37eb-4902-adef-ed16b4431030",
"email": "ana@example.com",
"displayName": "Ana Souza",
"role": "ROLE_AGENT"
},
"outcome": "CREATE_USER_OUTCOME_CREATED",
"inviteEmail": "INVITE_EMAIL_SENT"
}
outcome
| Value | When | Invite email |
|---|---|---|
CREATE_USER_OUTCOME_CREATED | The email had no Connectly account. A new account is created. | Sent |
CREATE_USER_OUTCOME_ACCOUNT_RESTORED | The email belonged to a deleted account that used to be a user of your business. The account is restored. | Sent |
CREATE_USER_OUTCOME_MEMBERSHIP_REVIVED | The email belongs to someone removed from your business earlier who still has their account. They come back with the same id and sign in as before. | Not sent |
inviteEmail
The invite is an email with a link to set a password. The link is valid for 24 hours.
| Value | Meaning |
|---|---|
INVITE_EMAIL_SENT | Connectly’s mail service accepted the email. |
INVITE_EMAIL_FAILED | The send was not confirmed. The email may still arrive. |
INVITE_EMAIL_NOT_SENT | No invite was due: the user came back with their own account. |
The invite is sent once and never resent automatically. A user who did not get it can use Forgot password on the sign-in page, or sign in with SSO if your business uses Enterprise SSO.
If your mail server rejects email from Connectly, the people you add receive neither the invite nor a Forgot password email. They can still sign in through your company’s SSO if your business uses Enterprise SSO; otherwise ask your email administrator to accept mail from Connectly.
Error responses
| HTTP status | errorCode | Meaning |
|---|---|---|
400 | PRFL.USR.OWNER_PROTECTED | role is ROLE_OWNER. |
400 | PRFL.USR.MEMBERSHIP_REVOKED_BY_SSO | Your identity provider removed this person. Restore them in the identity provider. |
400 | email is missing or not an email, or role is missing or unknown. | |
409 | The email cannot be added: it already belongs to a user of your business, to a user of another business, or to a Connectly account that was never a user of your business. Contact Connectly support for the last two. |
Was this page helpful?
⌘I
