Skip to main content
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": "example@example.com",
  "isActive": true,
  "name": "<string>",
  "role": "member",
  "teams": [
    "team1",
    "team2"
  ]
}
'
import requests

url = "https://app.formbricks.com/api/v2/organizations/{organizationId}/users"

payload = {
"email": "example@example.com",
"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: 'example@example.com',
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' => 'example@example.com',
'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\": \"example@example.com\",\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\": \"example@example.com\",\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\": \"example@example.com\",\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": "example@example.com",
  "role": "member",
  "teams": [
    "team1",
    "team2"
  ]
}

Authorizations

x-api-key
string
header
required

Use your Formbricks x-api-key to authenticate.

Path Parameters

organizationId
string
required

The ID of the organization

Body

application/json

The user to update

email
string<email>
required

The email of the user

Maximum string length: 255
Example:

"example@example.com"

isActive
boolean

Whether the user is active

Example:

true

name
string
Minimum string length: 1
Pattern: ^[\p{L}\p{M}\s'\d-]+$
role
enum<string>

The role of the user in the organization

Available options:
owner,
manager,
member
Example:

"member"

teams
string[]

The list of teams the user is a member of

Example:
["team1", "team2"]

Response

200 - application/json

User updated successfully.

id
string

The ID of the user

createdAt
string

The date and time the user was created

Example:

"2021-01-01T00:00:00.000Z"

updatedAt
string

The date and time the user was last updated

Example:

"2021-01-01T00:00:00.000Z"

lastLoginAt
string

The date and time the user last logged in

Example:

"2021-01-01T00:00:00.000Z"

isActive
boolean

Whether the user is active

Example:

true

name
string

The name of the user

Minimum string length: 1
Pattern: ^[\p{L}\p{M}\s'\d-]+$
Example:

"John Doe"

email
string<email>

The email of the user

Maximum string length: 255
Example:

"example@example.com"

role
enum<string>

The role of the user in the organization

Available options:
owner,
manager,
member
Example:

"member"

teams
string[]

The list of teams the user is a member of

Example:
["team1", "team2"]