Invite new members
For the complete documentation index, see llms.txt. For the full documentation snapshot, see llms-full.txt.
Invite one or more new members to join an account. Each member is sent an invitation. Members with Admin or Owner roles may create new members, as well as anyone with a createMember permission for “member/*”. If a member cannot be invited, the entire request is rejected and no members are invited from that request.
Each member must have an email field and either a role or a customRoles field. If any of the fields are not populated correctly, the request is rejected with the reason specified in the “message” field of the response.
Valid base role names that you can provide for the role field include reader, writer, admin, owner/admin, and no_access. To learn more about base roles, read Organization roles.
If you are using the customRoles field instead, you can provide the key for any role that you have created, or for any preset organization role or project role provided by LaunchDarkly. Some preset roles additionally require that you specify roleAttributes. To learn more, read Using role scope.
Requests to create account members will not work if SCIM is enabled for the account.
No more than 50 members may be created per request.
A request may also fail because of conflicts with existing members. These conflicts are reported using the additional code and invalid_emails response fields with the following possible values for code:
- email_already_exists_in_account: A member with this email address already exists in this account.
- email_taken_in_different_account: A member with this email address exists in another account.
- duplicate_emails: This request contains two or more members with the same email address.
A request that fails for one of the above reasons returns an HTTP response code of 400 (Bad Request).
curl --request POST \
--url https://app.launchdarkly.com/api/v2/members \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
[
{
"email": "sandy@acme.com",
"password": "***",
"firstName": "Ariel",
"lastName": "Flores",
"role": "reader",
"customRoles": [
"customRole1",
"launchdarkly-developer"
],
"teamKeys": [
"team-1",
"team-2"
],
"roleAttributes": "{\"developerProjectKeys\": [\"default\"]}"
}
]
'import requests
url = "https://app.launchdarkly.com/api/v2/members"
payload = [
{
"email": "sandy@acme.com",
"password": "***",
"firstName": "Ariel",
"lastName": "Flores",
"role": "reader",
"customRoles": ["customRole1", "launchdarkly-developer"],
"teamKeys": ["team-1", "team-2"],
"roleAttributes": "{\"developerProjectKeys\": [\"default\"]}"
}
]
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
email: 'sandy@acme.com',
password: '***',
firstName: 'Ariel',
lastName: 'Flores',
role: 'reader',
customRoles: ['customRole1', 'launchdarkly-developer'],
teamKeys: ['team-1', 'team-2'],
roleAttributes: '{"developerProjectKeys": ["default"]}'
}
])
};
fetch('https://app.launchdarkly.com/api/v2/members', 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://app.launchdarkly.com/api/v2/members",
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' => 'sandy@acme.com',
'password' => '***',
'firstName' => 'Ariel',
'lastName' => 'Flores',
'role' => 'reader',
'customRoles' => [
'customRole1',
'launchdarkly-developer'
],
'teamKeys' => [
'team-1',
'team-2'
],
'roleAttributes' => '{"developerProjectKeys": ["default"]}'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.launchdarkly.com/api/v2/members"
payload := strings.NewReader("[\n {\n \"email\": \"sandy@acme.com\",\n \"password\": \"***\",\n \"firstName\": \"Ariel\",\n \"lastName\": \"Flores\",\n \"role\": \"reader\",\n \"customRoles\": [\n \"customRole1\",\n \"launchdarkly-developer\"\n ],\n \"teamKeys\": [\n \"team-1\",\n \"team-2\"\n ],\n \"roleAttributes\": \"{\\\"developerProjectKeys\\\": [\\\"default\\\"]}\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://app.launchdarkly.com/api/v2/members")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"email\": \"sandy@acme.com\",\n \"password\": \"***\",\n \"firstName\": \"Ariel\",\n \"lastName\": \"Flores\",\n \"role\": \"reader\",\n \"customRoles\": [\n \"customRole1\",\n \"launchdarkly-developer\"\n ],\n \"teamKeys\": [\n \"team-1\",\n \"team-2\"\n ],\n \"roleAttributes\": \"{\\\"developerProjectKeys\\\": [\\\"default\\\"]}\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/members")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"email\": \"sandy@acme.com\",\n \"password\": \"***\",\n \"firstName\": \"Ariel\",\n \"lastName\": \"Flores\",\n \"role\": \"reader\",\n \"customRoles\": [\n \"customRole1\",\n \"launchdarkly-developer\"\n ],\n \"teamKeys\": [\n \"team-1\",\n \"team-2\"\n ],\n \"roleAttributes\": \"{\\\"developerProjectKeys\\\": [\\\"default\\\"]}\"\n }\n]"
response = http.request(request)
puts response.read_body{
"items": [
{
"_links": {},
"_id": "507f1f77bcf86cd799439011",
"role": "reader",
"email": "ariel@acme.com",
"_pendingInvite": false,
"_verified": true,
"customRoles": [
"devOps",
"backend-devs"
],
"mfa": "<string>",
"_lastSeen": "1608260796147",
"creationDate": "1628001602644",
"firstName": "Ariel",
"lastName": "Flores",
"_pendingEmail": "<string>",
"excludedDashboards": [
"<string>"
],
"_lastSeenMetadata": {
"tokenId": "5b52207f8ca8e631d31fdb2b"
},
"_integrationMetadata": {
"externalId": "<string>",
"externalStatus": {
"display": "<string>",
"value": "<string>"
},
"externalUrl": "<string>",
"lastChecked": 123
},
"teams": [
{
"customRoleKeys": [
"access-to-test-projects"
],
"key": "team-key-123abc",
"name": "QA Team",
"_links": {}
}
],
"permissionGrants": [
{
"resource": "team/qa-team",
"actionSet": "<string>",
"actions": [
"maintainTeam"
]
}
],
"oauthProviders": [
"<string>"
],
"version": 1,
"roleAttributes": {}
}
],
"_links": {},
"totalCount": 123
}{
"code": "invalid_request",
"message": "Invalid request body"
}{
"code": "unauthorized",
"message": "Invalid access token"
}{
"code": "forbidden",
"message": "Forbidden. Access to the requested resource was denied."
}{
"code": "optimistic_locking_error",
"message": "Conflict. Optimistic lock error. Try again later."
}{
"code": "rate_limited",
"message": "You've exceeded the API rate limit. Try again later."
}Authorizations
Body
The member's email
"sandy@acme.com"
The member's password
"***"
The member's first name
"Ariel"
The member's last name
"Flores"
The member's initial role, if you are using a base role for the initial role
reader, writer, admin, no_access "reader"
An array of the member's initial roles, if you are using custom roles or preset roles provided by LaunchDarkly
["customRole1", "launchdarkly-developer"]
An array of the member's teams
["team-1", "team-2"]
An object of role attributes for the member
Show child attributes
Show child attributes
"{\"developerProjectKeys\": [\"default\"]}"
curl --request POST \
--url https://app.launchdarkly.com/api/v2/members \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
[
{
"email": "sandy@acme.com",
"password": "***",
"firstName": "Ariel",
"lastName": "Flores",
"role": "reader",
"customRoles": [
"customRole1",
"launchdarkly-developer"
],
"teamKeys": [
"team-1",
"team-2"
],
"roleAttributes": "{\"developerProjectKeys\": [\"default\"]}"
}
]
'import requests
url = "https://app.launchdarkly.com/api/v2/members"
payload = [
{
"email": "sandy@acme.com",
"password": "***",
"firstName": "Ariel",
"lastName": "Flores",
"role": "reader",
"customRoles": ["customRole1", "launchdarkly-developer"],
"teamKeys": ["team-1", "team-2"],
"roleAttributes": "{\"developerProjectKeys\": [\"default\"]}"
}
]
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
email: 'sandy@acme.com',
password: '***',
firstName: 'Ariel',
lastName: 'Flores',
role: 'reader',
customRoles: ['customRole1', 'launchdarkly-developer'],
teamKeys: ['team-1', 'team-2'],
roleAttributes: '{"developerProjectKeys": ["default"]}'
}
])
};
fetch('https://app.launchdarkly.com/api/v2/members', 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://app.launchdarkly.com/api/v2/members",
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' => 'sandy@acme.com',
'password' => '***',
'firstName' => 'Ariel',
'lastName' => 'Flores',
'role' => 'reader',
'customRoles' => [
'customRole1',
'launchdarkly-developer'
],
'teamKeys' => [
'team-1',
'team-2'
],
'roleAttributes' => '{"developerProjectKeys": ["default"]}'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.launchdarkly.com/api/v2/members"
payload := strings.NewReader("[\n {\n \"email\": \"sandy@acme.com\",\n \"password\": \"***\",\n \"firstName\": \"Ariel\",\n \"lastName\": \"Flores\",\n \"role\": \"reader\",\n \"customRoles\": [\n \"customRole1\",\n \"launchdarkly-developer\"\n ],\n \"teamKeys\": [\n \"team-1\",\n \"team-2\"\n ],\n \"roleAttributes\": \"{\\\"developerProjectKeys\\\": [\\\"default\\\"]}\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://app.launchdarkly.com/api/v2/members")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"email\": \"sandy@acme.com\",\n \"password\": \"***\",\n \"firstName\": \"Ariel\",\n \"lastName\": \"Flores\",\n \"role\": \"reader\",\n \"customRoles\": [\n \"customRole1\",\n \"launchdarkly-developer\"\n ],\n \"teamKeys\": [\n \"team-1\",\n \"team-2\"\n ],\n \"roleAttributes\": \"{\\\"developerProjectKeys\\\": [\\\"default\\\"]}\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/members")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"email\": \"sandy@acme.com\",\n \"password\": \"***\",\n \"firstName\": \"Ariel\",\n \"lastName\": \"Flores\",\n \"role\": \"reader\",\n \"customRoles\": [\n \"customRole1\",\n \"launchdarkly-developer\"\n ],\n \"teamKeys\": [\n \"team-1\",\n \"team-2\"\n ],\n \"roleAttributes\": \"{\\\"developerProjectKeys\\\": [\\\"default\\\"]}\"\n }\n]"
response = http.request(request)
puts response.read_body{
"items": [
{
"_links": {},
"_id": "507f1f77bcf86cd799439011",
"role": "reader",
"email": "ariel@acme.com",
"_pendingInvite": false,
"_verified": true,
"customRoles": [
"devOps",
"backend-devs"
],
"mfa": "<string>",
"_lastSeen": "1608260796147",
"creationDate": "1628001602644",
"firstName": "Ariel",
"lastName": "Flores",
"_pendingEmail": "<string>",
"excludedDashboards": [
"<string>"
],
"_lastSeenMetadata": {
"tokenId": "5b52207f8ca8e631d31fdb2b"
},
"_integrationMetadata": {
"externalId": "<string>",
"externalStatus": {
"display": "<string>",
"value": "<string>"
},
"externalUrl": "<string>",
"lastChecked": 123
},
"teams": [
{
"customRoleKeys": [
"access-to-test-projects"
],
"key": "team-key-123abc",
"name": "QA Team",
"_links": {}
}
],
"permissionGrants": [
{
"resource": "team/qa-team",
"actionSet": "<string>",
"actions": [
"maintainTeam"
]
}
],
"oauthProviders": [
"<string>"
],
"version": 1,
"roleAttributes": {}
}
],
"_links": {},
"totalCount": 123
}{
"code": "invalid_request",
"message": "Invalid request body"
}{
"code": "unauthorized",
"message": "Invalid access token"
}{
"code": "forbidden",
"message": "Forbidden. Access to the requested resource was denied."
}{
"code": "optimistic_locking_error",
"message": "Conflict. Optimistic lock error. Try again later."
}{
"code": "rate_limited",
"message": "You've exceeded the API rate limit. Try again later."
}