Update project subscription billing
What this endpoint does: Partially updates an existing subscription billing item. You can update any combination of fields without providing all values. The system automatically regenerates billing rows if the date range or frequency changes.
How updates work:
- Only provide the fields you want to change (all fields are optional)
- If you update fromDate, toDate, or frequency, the system will:
- Delete unbilled billing rows
- Regenerate billing rows based on new date range and frequency
- Preserve already billed rows (they are not affected)
- Other fields (price, title, payment type) update immediately without regenerating rows
Important notes:
- If updating both fromDate and toDate, ensure fromDate is before or equal to toDate
- Changing frequency will affect all future billing periods
- Already billed rows remain unchanged
- Sort order is preserved unless explicitly changed
Permissions required:
- Projects.edit: Ability to edit project settings
- Invoices.manage: Ability to manage invoice configurations
Example use cases:
- Extend subscription end date
- Change billing frequency (e.g., from monthly to quarterly)
- Update subscription price
- Modify subscription title or description
- Change payment type
PATCH
/projects/{projectId}/subscription-billings/{id}Authorization
AuthorizationOAuth2 access token · headerrequiredScopes:
api:writeor
AuthorizationBearer token (JWT) · headerrequiredPath parameters
projectIdstringrequiredidstringrequiredRequest body
requiredapplication/jsonbillingTimingstringInvoice timing: arrears (after period ends) or advance (from period start). Updating changes when unbilled rows qualify for potential invoices; it does not regenerate billing rows.
Allowed:
arrearsadvancefrequencynumberBilling frequency in months. Common values: 1 = monthly, 3 = quarterly, 6 = semi-annual, 12 = yearly. Updating this will regenerate billing rows. Must be between 1 and 12 if provided. Optional.
min 1 · max 12
fromDatestringStart date when the subscription becomes active. Format: ISO 8601 date string (YYYY-MM-DD). Updating this will regenerate billing rows. If both fromDate and toDate are provided, fromDate must be before or equal to toDate. Optional.
manualTitlestringHuman-readable title or description that appears on invoices and in project settings. Examples: "Monthly Support Package", "Quarterly Maintenance". Optional.
paymentstringPayment calculation method. "fixed" = fixed amount per billing period. "perUnit" = variable pricing based on units. "oneTime" = one-time charge (requires quantity). Optional.
Allowed:
fixedperUnitoneTimepricenumberPrice amount. For "fixed": amount per billing period. For "perUnit": price per unit. For "oneTime": total charge amount. Must be positive if provided. Optional.
quantitynumberQuantity for variable pricing. Required when payment type is "oneTime" to calculate total charge (price × quantity). Optional for other payment types.
toDatestringEnd date when the subscription expires. Format: ISO 8601 date string (YYYY-MM-DD). Updating this will regenerate billing rows. If both fromDate and toDate are provided, fromDate must be before or equal to toDate. Optional.
typestringType of subscription billing. "manual" for manually created subscriptions, "product" for subscriptions linked to product catalog items. Optional.
Allowed:
manualproductResponses
200Subscription billing updated successfully
successbooleanrequiredOperation success flag
400Invalid date range, frequency, or other validation error
401Unauthorized - Invalid or missing authentication token
403Insufficient permissions (requires Projects.edit and Invoices.manage)
404Project or subscription billing not found
Request
curl -X PATCH "https://leadtime.app/api/public/projects/string/subscription-billings/string" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"billingTiming": "advance",
"frequency": 1,
"fromDate": "2024-01-01",
"manualTitle": "Monthly Support Package",
"payment": "fixed",
"price": 5000,
"quantity": 1,
"toDate": "2024-12-31",
"type": "manual"
}'const response = await fetch("https://leadtime.app/api/public/projects/string/subscription-billings/string", {
method: "PATCH",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"billingTiming": "advance",
"frequency": 1,
"fromDate": "2024-01-01",
"manualTitle": "Monthly Support Package",
"payment": "fixed",
"price": 5000,
"quantity": 1,
"toDate": "2024-12-31",
"type": "manual"
})
});import requests
response = requests.patch(
"https://leadtime.app/api/public/projects/string/subscription-billings/string",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
json={
"billingTiming": "advance",
"frequency": 1,
"fromDate": "2024-01-01",
"manualTitle": "Monthly Support Package",
"payment": "fixed",
"price": 5000,
"quantity": 1,
"toDate": "2024-12-31",
"type": "manual"
},
)Response
{
"success": true
}Invalid date range, frequency, or other validation error
Unauthorized - Invalid or missing authentication token
Insufficient permissions (requires Projects.edit and Invoices.manage)
Project or subscription billing not found