メインコンテンツへスキップ
PATCH
/
api
/
v1
/
organizations
/
{organizationId}
/
users
/
{userId}
Update an organization's user
curl --request PATCH \
  --url https://api.itmc.i.moneyforward.com/api/v1/organizations/{organizationId}/users/{userId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "roleIds": [
    2,
    3
  ]
}
'
import requests

url = "https://api.itmc.i.moneyforward.com/api/v1/organizations/{organizationId}/users/{userId}"

payload = { "roleIds": [2, 3] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({roleIds: [2, 3]})
};

fetch('https://api.itmc.i.moneyforward.com/api/v1/organizations/{organizationId}/users/{userId}', 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.itmc.i.moneyforward.com/api/v1/organizations/{organizationId}/users/{userId}",
  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([
    'roleIds' => [
        2,
        3
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "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://api.itmc.i.moneyforward.com/api/v1/organizations/{organizationId}/users/{userId}"

	payload := strings.NewReader("{\n  \"roleIds\": [\n    2,\n    3\n  ]\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	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://api.itmc.i.moneyforward.com/api/v1/organizations/{organizationId}/users/{userId}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"roleIds\": [\n    2,\n    3\n  ]\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.itmc.i.moneyforward.com/api/v1/organizations/{organizationId}/users/{userId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"roleIds\": [\n    2,\n    3\n  ]\n}"

response = http.request(request)
puts response.read_body
{
  "id": 1,
  "email": "foo.bar@example.com",
  "name": "foo.bar",
  "location": "jp",
  "roles": [
    {
      "id": 1,
      "name": "Admin"
    }
  ],
  "status": "active"
}

承認

Authorization
string
header
必須

For authenticated requests, set the Authorization: Bearer your_api_key parameter in the header.
You can create and manage your API Keys by visiting the API Keys tab in the Settings page of your organization in Admina

パスパラメータ

organizationId
number
必須
userId
number
必須

ボディ

application/json
roleIds
number[]
必須

The list of role ids to assign to the user. Note that admin role cannot be used with other roles, and a user can not have more than 10 roles. This methods performs a full update, so all roles will be replaced with the roles in the request.

:
[2, 3]

レスポンス

200 - application/json
id
number
必須
read-only
:

1

email
string
必須
read-only
:

"foo.bar@example.com"

name
string
必須
read-only
:

"foo.bar"

location
enum<string>
必須
利用可能なオプション:
global,
us,
jp
:

"jp"

roles
object[]
必須
read-only
status
enum<string>
必須
利用可能なオプション:
active,
invited
:

"active"

最終更新日 2026年7月10日