Change subscription quantity in potential invoice
What does this do? Sets a custom quantity for a subscription billing row in a potential invoice. For per-unit pricing subscriptions, this allows you to adjust how many units are billed, which may differ from the default quantity calculated by the system.
When to use:
- To adjust the quantity for per-unit pricing subscriptions before finalizing the invoice
- To bill a different number of units than the default calculated amount
- To correct billing quantities based on actual usage or customer agreements
- To clear a custom quantity and revert to the default calculated quantity
How it works:
- Updates the subscription quantity stored in the potential invoice metadata
- The quantity is used to calculate the total charge (quantity × unit price)
- Setting value to null or omitting it clears the custom quantity and reverts to default
- The quantity must be a non-negative integer
- Only affects the current potential invoice; does not modify the subscription billing configuration
Subscription requirements:
- Subscription billing ID (itemId) must exist in the potential invoice
- Use the billingId field from subscription billing rows
- Only per-unit pricing subscriptions (payment type: perUnit) typically use quantities
- Fixed monthly fees and one-time charges may not use quantities
Invoice ID Format: The invoice ID follows the format: {type}::{projectId}::{dateFrom}::{dateTo}
- Example: SingleProject::0e9d033a-ab41-4212-8637-66c4e3b01fe2::2025-10-01::2025-10-31
Permission requirements: Requires Invoices.manage permission and access to the project.
POST
/billing/potential-invoices/{id}/subscriptions/{itemId}/quantityAuthorization
AuthorizationOAuth2 access token · headerrequiredScopes:
api:writeor
AuthorizationBearer token (JWT) · headerrequiredPath parameters
idstringrequiredPotential invoice ID in format: {type}::{projectId}::{dateFrom}::{dateTo}
itemIdstring<uuid>requiredSubscription billing ID (billingId UUID) to change quantity for
Request body
requiredapplication/jsonvaluenumber | nullQuantity value for the subscription billing row. For per-unit pricing subscriptions, this sets how many units to bill. Set to null or omit to clear a custom quantity and revert to default. Must be a non-negative integer if provided.
min 0
Responses
200Subscription quantity updated successfully
successbooleanrequiredOperation success flag
401Unauthorized - Invalid or missing authentication token
403User lacks Invoices.manage permission or project access
404Potential invoice or subscription billing not found
Request
curl -X POST "https://leadtime.app/api/public/billing/potential-invoices/SingleProject%3A%3A0e9d033a-ab41-4212-8637-66c4e3b01fe2%3A%3A2025-10-01%3A%3A2025-10-31/subscriptions/550e8400-e29b-41d4-a716-446655440000/quantity" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"value": 5
}'const response = await fetch("https://leadtime.app/api/public/billing/potential-invoices/SingleProject%3A%3A0e9d033a-ab41-4212-8637-66c4e3b01fe2%3A%3A2025-10-01%3A%3A2025-10-31/subscriptions/550e8400-e29b-41d4-a716-446655440000/quantity", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"value": 5
})
});import requests
response = requests.post(
"https://leadtime.app/api/public/billing/potential-invoices/SingleProject%3A%3A0e9d033a-ab41-4212-8637-66c4e3b01fe2%3A%3A2025-10-01%3A%3A2025-10-31/subscriptions/550e8400-e29b-41d4-a716-446655440000/quantity",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
json={
"value": 5
},
)Response
{
"success": true
}Unauthorized - Invalid or missing authentication token
User lacks Invoices.manage permission or project access
Potential invoice or subscription billing not found