Skip to content
Leadtime
English
Esc
navigateopen⌘Jpreview

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 · headerrequired
Scopes:api:write
or
AuthorizationBearer token (JWT) · headerrequired
Path parameters
projectIdstringrequired
idstringrequired
Request body
requiredapplication/json
billingTimingstring
Invoice 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:arrearsadvance
frequencynumber
Billing 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
fromDatestring
Start 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.
manualTitlestring
Human-readable title or description that appears on invoices and in project settings. Examples: "Monthly Support Package", "Quarterly Maintenance". Optional.
paymentstring
Payment calculation method. "fixed" = fixed amount per billing period. "perUnit" = variable pricing based on units. "oneTime" = one-time charge (requires quantity). Optional.
Allowed:fixedperUnitoneTime
pricenumber
Price amount. For "fixed": amount per billing period. For "perUnit": price per unit. For "oneTime": total charge amount. Must be positive if provided. Optional.
quantitynumber
Quantity for variable pricing. Required when payment type is "oneTime" to calculate total charge (price × quantity). Optional for other payment types.
toDatestring
End 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.
typestring
Type of subscription billing. "manual" for manually created subscriptions, "product" for subscriptions linked to product catalog items. Optional.
Allowed:manualproduct
Responses
200Subscription billing updated successfully
successbooleanrequired
Operation 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"
}'
Response
{
  "success": true
}