Update a user
curl --request PATCH \
--url https://app.formbricks.com/api/v2/organizations/{organizationId}/users \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"email": "[email protected]",
"isActive": true,
"name": "<string>",
"role": "member",
"teams": [
"team1",
"team2"
]
}
'import requests
url = "https://app.formbricks.com/api/v2/organizations/{organizationId}/users"
payload = {
"email": "[email protected]",
"isActive": True,
"name": "<string>",
"role": "member",
"teams": ["team1", "team2"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '[email protected]',
isActive: true,
name: '<string>',
role: 'member',
teams: ['team1', 'team2']
})
};
fetch('https://app.formbricks.com/api/v2/organizations/{organizationId}/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://app.formbricks.com/api/v2/organizations/{organizationId}/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'email' => '[email protected]',
'isActive' => true,
'name' => '<string>',
'role' => 'member',
'teams' => [
'team1',
'team2'
]
]),
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://app.formbricks.com/api/v2/organizations/{organizationId}/users"
payload := strings.NewReader("{\n \"email\": \"[email protected]\",\n \"isActive\": true,\n \"name\": \"<string>\",\n \"role\": \"member\",\n \"teams\": [\n \"team1\",\n \"team2\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.formbricks.com/api/v2/organizations/{organizationId}/users")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"[email protected]\",\n \"isActive\": true,\n \"name\": \"<string>\",\n \"role\": \"member\",\n \"teams\": [\n \"team1\",\n \"team2\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.formbricks.com/api/v2/organizations/{organizationId}/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"[email protected]\",\n \"isActive\": true,\n \"name\": \"<string>\",\n \"role\": \"member\",\n \"teams\": [\n \"team1\",\n \"team2\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"createdAt": "2021-01-01T00:00:00.000Z",
"updatedAt": "2021-01-01T00:00:00.000Z",
"lastLoginAt": "2021-01-01T00:00:00.000Z",
"isActive": true,
"name": "John Doe",
"email": "[email protected]",
"role": "member",
"teams": [
"team1",
"team2"
]
}Organizations API - Users
Update a user
Updates an existing user in the database.
Only available for self-hosted Formbricks.
PATCH
/
organizations
/
{organizationId}
/
users
Update a user
curl --request PATCH \
--url https://app.formbricks.com/api/v2/organizations/{organizationId}/users \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"email": "[email protected]",
"isActive": true,
"name": "<string>",
"role": "member",
"teams": [
"team1",
"team2"
]
}
'import requests
url = "https://app.formbricks.com/api/v2/organizations/{organizationId}/users"
payload = {
"email": "[email protected]",
"isActive": True,
"name": "<string>",
"role": "member",
"teams": ["team1", "team2"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '[email protected]',
isActive: true,
name: '<string>',
role: 'member',
teams: ['team1', 'team2']
})
};
fetch('https://app.formbricks.com/api/v2/organizations/{organizationId}/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://app.formbricks.com/api/v2/organizations/{organizationId}/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'email' => '[email protected]',
'isActive' => true,
'name' => '<string>',
'role' => 'member',
'teams' => [
'team1',
'team2'
]
]),
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://app.formbricks.com/api/v2/organizations/{organizationId}/users"
payload := strings.NewReader("{\n \"email\": \"[email protected]\",\n \"isActive\": true,\n \"name\": \"<string>\",\n \"role\": \"member\",\n \"teams\": [\n \"team1\",\n \"team2\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.formbricks.com/api/v2/organizations/{organizationId}/users")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"[email protected]\",\n \"isActive\": true,\n \"name\": \"<string>\",\n \"role\": \"member\",\n \"teams\": [\n \"team1\",\n \"team2\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.formbricks.com/api/v2/organizations/{organizationId}/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"[email protected]\",\n \"isActive\": true,\n \"name\": \"<string>\",\n \"role\": \"member\",\n \"teams\": [\n \"team1\",\n \"team2\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"createdAt": "2021-01-01T00:00:00.000Z",
"updatedAt": "2021-01-01T00:00:00.000Z",
"lastLoginAt": "2021-01-01T00:00:00.000Z",
"isActive": true,
"name": "John Doe",
"email": "[email protected]",
"role": "member",
"teams": [
"team1",
"team2"
]
}Authorizations
Use your Formbricks x-api-key to authenticate.
Path Parameters
The ID of the organization
Body
application/json
The user to update
Whether the user is active
Example:
true
Minimum string length:
1Pattern:
^[\p{L}\p{M}\s'\d-]+$The role of the user in the organization
Available options:
owner, manager, member Example:
"member"
The list of teams the user is a member of
Example:
["team1", "team2"]
Response
200 - application/json
User updated successfully.
The ID of the user
The date and time the user was created
Example:
"2021-01-01T00:00:00.000Z"
The date and time the user was last updated
Example:
"2021-01-01T00:00:00.000Z"
The date and time the user last logged in
Example:
"2021-01-01T00:00:00.000Z"
Whether the user is active
Example:
true
The name of the user
Minimum string length:
1Pattern:
^[\p{L}\p{M}\s'\d-]+$Example:
"John Doe"
The role of the user in the organization
Available options:
owner, manager, member Example:
"member"
The list of teams the user is a member of
Example:
["team1", "team2"]
Was this page helpful?