Set Users' Billing Organizations
curl --request PUT \
--url https://api.devin.ai/v3/enterprise/members/users/billing-orgs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assignments": [
{
"billing_org_id": "<string>",
"user_id": "<string>"
}
]
}
'import requests
url = "https://api.devin.ai/v3/enterprise/members/users/billing-orgs"
payload = { "assignments": [
{
"billing_org_id": "<string>",
"user_id": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({assignments: [{billing_org_id: '<string>', user_id: '<string>'}]})
};
fetch('https://api.devin.ai/v3/enterprise/members/users/billing-orgs', 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.devin.ai/v3/enterprise/members/users/billing-orgs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'assignments' => [
[
'billing_org_id' => '<string>',
'user_id' => '<string>'
]
]
]),
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.devin.ai/v3/enterprise/members/users/billing-orgs"
payload := strings.NewReader("{\n \"assignments\": [\n {\n \"billing_org_id\": \"<string>\",\n \"user_id\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.devin.ai/v3/enterprise/members/users/billing-orgs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assignments\": [\n {\n \"billing_org_id\": \"<string>\",\n \"user_id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3/enterprise/members/users/billing-orgs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"assignments\": [\n {\n \"billing_org_id\": \"<string>\",\n \"user_id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"assigned": [
{
"billing_org_id": "<string>",
"user_id": "<string>"
}
],
"failed": [
{
"billing_org_id": "<string>",
"reason": "user_not_found",
"user_id": "<string>"
}
]
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}Users & Membership (Enterprise)
Set Users' Billing Organizations
Set the billing organization of up to 100 users.
Only the submitted users change. Valid assignments are saved together even
if others are invalid, so a 200 can include failures: always check failed.
An error response means nothing was saved. Resending an assignment overwrites
the user’s current billing organization and records another audit log entry.
PUT
/
v3
/
enterprise
/
members
/
users
/
billing-orgs
Set Users' Billing Organizations
curl --request PUT \
--url https://api.devin.ai/v3/enterprise/members/users/billing-orgs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assignments": [
{
"billing_org_id": "<string>",
"user_id": "<string>"
}
]
}
'import requests
url = "https://api.devin.ai/v3/enterprise/members/users/billing-orgs"
payload = { "assignments": [
{
"billing_org_id": "<string>",
"user_id": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({assignments: [{billing_org_id: '<string>', user_id: '<string>'}]})
};
fetch('https://api.devin.ai/v3/enterprise/members/users/billing-orgs', 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.devin.ai/v3/enterprise/members/users/billing-orgs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'assignments' => [
[
'billing_org_id' => '<string>',
'user_id' => '<string>'
]
]
]),
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.devin.ai/v3/enterprise/members/users/billing-orgs"
payload := strings.NewReader("{\n \"assignments\": [\n {\n \"billing_org_id\": \"<string>\",\n \"user_id\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.devin.ai/v3/enterprise/members/users/billing-orgs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assignments\": [\n {\n \"billing_org_id\": \"<string>\",\n \"user_id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3/enterprise/members/users/billing-orgs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"assignments\": [\n {\n \"billing_org_id\": \"<string>\",\n \"user_id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"assigned": [
{
"billing_org_id": "<string>",
"user_id": "<string>"
}
],
"failed": [
{
"billing_org_id": "<string>",
"reason": "user_not_found",
"user_id": "<string>"
}
]
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}Sets the billing organization for up to 100 users in one request. Only the users you submit change; the rest of the enterprise is untouched. For one user at a time, the beta user settings endpoint also accepts
New reasons may be added over time, so treat unknown values as a failure rather than an error.
An error response (
billing_org_id.
Partial success
Valid assignments are saved together even when other rows in the same request are invalid, so a200 response can include failures. Always read failed: each entry names the user, the requested organization, and a reason. Those users’ billing organizations did not change; fix the rows and resend them.
reason | Meaning |
|---|---|
user_not_found | The user is not a member of the enterprise, directly or through an identity provider group. |
org_not_found | The organization does not belong to the enterprise. |
user_not_org_member | The organization is not the enterprise’s primary organization and the user is not a member of it. |
4xx or 5xx) means nothing in the request was saved. Requests with no assignments, more than 100 assignments, or the same user_id more than once are rejected with 422.
Resending an assignment overwrites the user’s current billing organization and records another audit log entry, so repeated calls are safe but not free.
Permissions
Requires a service user or personal access token with both theManageBilling and ViewOrganizations permissions at the enterprise level. ManageOrganizations also satisfies ViewOrganizations, since it includes it.Body
application/json
Response
Successful Response

