Update a billing group
curl --request PATCH \
--url https://api-eu.flexportal.io/v1/billing-groups/{billingGroupId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Tenant-ID: <tenant-id>' \
--data '
{
"groupName": "<string>",
"billingDay": 14,
"rentalIds": [
"<string>"
],
"notes": "<string>"
}
'import requests
url = "https://api-eu.flexportal.io/v1/billing-groups/{billingGroupId}"
payload = {
"groupName": "<string>",
"billingDay": 14,
"rentalIds": ["<string>"],
"notes": "<string>"
}
headers = {
"Tenant-ID": "<tenant-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'Tenant-ID': '<tenant-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
groupName: '<string>',
billingDay: 14,
rentalIds: ['<string>'],
notes: '<string>'
})
};
fetch('https://api-eu.flexportal.io/v1/billing-groups/{billingGroupId}', 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-eu.flexportal.io/v1/billing-groups/{billingGroupId}",
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([
'groupName' => '<string>',
'billingDay' => 14,
'rentalIds' => [
'<string>'
],
'notes' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Tenant-ID: <tenant-id>"
],
]);
$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-eu.flexportal.io/v1/billing-groups/{billingGroupId}"
payload := strings.NewReader("{\n \"groupName\": \"<string>\",\n \"billingDay\": 14,\n \"rentalIds\": [\n \"<string>\"\n ],\n \"notes\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Tenant-ID", "<tenant-id>")
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-eu.flexportal.io/v1/billing-groups/{billingGroupId}")
.header("Tenant-ID", "<tenant-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"groupName\": \"<string>\",\n \"billingDay\": 14,\n \"rentalIds\": [\n \"<string>\"\n ],\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-eu.flexportal.io/v1/billing-groups/{billingGroupId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Tenant-ID"] = '<tenant-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"groupName\": \"<string>\",\n \"billingDay\": 14,\n \"rentalIds\": [\n \"<string>\"\n ],\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"billingGroup": {
"billingGroupId": "<string>",
"tenantId": "<string>",
"customerId": "<string>",
"groupName": "<string>",
"billingDay": 14,
"totalMonthlyAmount": 1,
"currency": "<string>",
"status": "active",
"createdBy": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"rentalIds": [],
"activeRentalCount": 0,
"notes": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Billing Groups
Update Billing Group
Updates billing group settings. Can add/remove rentals, change billing day, or update name.
PATCH
/
v1
/
billing-groups
/
{billingGroupId}
Update a billing group
curl --request PATCH \
--url https://api-eu.flexportal.io/v1/billing-groups/{billingGroupId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Tenant-ID: <tenant-id>' \
--data '
{
"groupName": "<string>",
"billingDay": 14,
"rentalIds": [
"<string>"
],
"notes": "<string>"
}
'import requests
url = "https://api-eu.flexportal.io/v1/billing-groups/{billingGroupId}"
payload = {
"groupName": "<string>",
"billingDay": 14,
"rentalIds": ["<string>"],
"notes": "<string>"
}
headers = {
"Tenant-ID": "<tenant-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'Tenant-ID': '<tenant-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
groupName: '<string>',
billingDay: 14,
rentalIds: ['<string>'],
notes: '<string>'
})
};
fetch('https://api-eu.flexportal.io/v1/billing-groups/{billingGroupId}', 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-eu.flexportal.io/v1/billing-groups/{billingGroupId}",
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([
'groupName' => '<string>',
'billingDay' => 14,
'rentalIds' => [
'<string>'
],
'notes' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Tenant-ID: <tenant-id>"
],
]);
$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-eu.flexportal.io/v1/billing-groups/{billingGroupId}"
payload := strings.NewReader("{\n \"groupName\": \"<string>\",\n \"billingDay\": 14,\n \"rentalIds\": [\n \"<string>\"\n ],\n \"notes\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Tenant-ID", "<tenant-id>")
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-eu.flexportal.io/v1/billing-groups/{billingGroupId}")
.header("Tenant-ID", "<tenant-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"groupName\": \"<string>\",\n \"billingDay\": 14,\n \"rentalIds\": [\n \"<string>\"\n ],\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-eu.flexportal.io/v1/billing-groups/{billingGroupId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Tenant-ID"] = '<tenant-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"groupName\": \"<string>\",\n \"billingDay\": 14,\n \"rentalIds\": [\n \"<string>\"\n ],\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"billingGroup": {
"billingGroupId": "<string>",
"tenantId": "<string>",
"customerId": "<string>",
"groupName": "<string>",
"billingDay": 14,
"totalMonthlyAmount": 1,
"currency": "<string>",
"status": "active",
"createdBy": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"rentalIds": [],
"activeRentalCount": 0,
"notes": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Overview
Update a billing group’s settings, add or remove subscriptions, or change the billing day. Use this to manage consolidated B2B billing as customer needs change.Updatable Fields
| Field | Description |
|---|---|
groupName | Display name |
rentalIds | Array of subscription IDs (replaces existing) |
billingDay | Day of month for billing (1-28) |
status | active or inactive |
Example: Add Subscription to Group
{
"rentalIds": ["sub_001", "sub_002", "sub_003", "sub_004"]
}
The
rentalIds array replaces the existing subscriptions. Include all subscriptions you want in the group, not just new ones.Example: Change Billing Day
{
"billingDay": 15
}
Example: Rename Group
{
"groupName": "Acme Corp - Engineering Team"
}
Common Operations
Add New Subscription
async function addToGroup(billingGroupId, newSubscriptionId) {
const group = await getBillingGroup(billingGroupId);
// Add new subscription to existing list
const updatedRentalIds = [...group.rentalIds, newSubscriptionId];
return await updateBillingGroup(billingGroupId, {
rentalIds: updatedRentalIds
});
}
Remove Subscription
async function removeFromGroup(billingGroupId, subscriptionIdToRemove) {
const group = await getBillingGroup(billingGroupId);
// Filter out the subscription to remove
const updatedRentalIds = group.rentalIds.filter(
id => id !== subscriptionIdToRemove
);
return await updateBillingGroup(billingGroupId, {
rentalIds: updatedRentalIds
});
}
Deactivate Group
async function deactivateGroup(billingGroupId) {
return await updateBillingGroup(billingGroupId, {
status: 'inactive'
});
}
Error Handling
| Error Code | Cause | Solution |
|---|---|---|
NOT_FOUND | Group doesn’t exist | Verify billing group ID |
SUBSCRIPTION_NOT_FOUND | Invalid subscription in array | Verify all subscription IDs |
SUBSCRIPTION_DIFFERENT_CUSTOMER | Subscription belongs to different customer | Only include same-customer subscriptions |
Related Endpoints
- Get Billing Group - View current state
- Delete Billing Group - Remove group
- List Subscriptions - Find subscriptions to add
Authorizations
API key obtained from FlexPortal dashboard
Headers
Your tenant identifier
Path Parameters
The billing group ID
Body
application/json
Was this page helpful?