Skip to main content
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>",
  "status": "active"
}
'
{
  "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>"
  }
}

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

FieldDescription
groupNameDisplay name
rentalIdsArray of subscription IDs (replaces existing)
billingDayDay of month for billing (1-28)
statusactive 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 CodeCauseSolution
NOT_FOUNDGroup doesn’t existVerify billing group ID
SUBSCRIPTION_NOT_FOUNDInvalid subscription in arrayVerify all subscription IDs
SUBSCRIPTION_DIFFERENT_CUSTOMERSubscription belongs to different customerOnly include same-customer subscriptions

Authorizations

Authorization
string
header
required

API key obtained from FlexPortal dashboard

Headers

Tenant-ID
string
required

Your tenant identifier

Path Parameters

billingGroupId
string
required

The billing group ID

Body

application/json
groupName
string
Minimum string length: 1
billingDay
integer
Required range: 1 <= x <= 28
rentalIds
string[]
notes
string
status
enum<string>
Available options:
active,
inactive

Response

Billing group updated

success
enum<boolean>
required
Available options:
true,
false
message
string
required
billingGroup
object
required