Reorder subscriptions in potential invoice
What does this do? Reorders the subscription billing rows in a potential invoice. The subscriptions will appear on the invoice in the order specified by the items array.
When to use:
- To change the display order of subscription billing rows on the invoice
- To group related subscriptions together
- To organize subscriptions in a logical sequence (e.g., by priority or billing type)
How it works:
- Updates the sort order of subscription billing rows stored in the potential invoice metadata
- The items array should contain all subscription billing IDs (billingId) in the desired order
- Subscriptions not included in the array will maintain their original order
- The order affects how subscriptions appear on the final invoice document
Subscription requirements:
- All subscription billing IDs in the items array must exist in the potential invoice
- Use the billingId field from subscription billing rows (not the id field)
- The array can include a subset of subscriptions (others will maintain their order)
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/sortAuthorization
AuthorizationOAuth2 access token · headerrequiredScopes:
api:writeor
AuthorizationBearer token (JWT) · headerrequiredPath parameters
idstringrequiredPotential invoice ID in format: {type}::{projectId}::{dateFrom}::{dateTo}
Request body
requiredapplication/jsonitemsstring[][]requiredArray of subscription billing IDs (billingId) in the desired sort order. The subscriptions will appear on the invoice in this order. All subscription billing IDs from the potential invoice should be included.
Responses
200Subscriptions reordered successfully
successbooleanrequiredOperation success flag
401Unauthorized - Invalid or missing authentication token
403User lacks Invoices.manage permission or project access
404Potential invoice 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/sort" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"items": [
"550e8400-e29b-41d4-a716-446655440000",
"660e8400-e29b-41d4-a716-446655440001"
]
}'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/sort", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"items": [
"550e8400-e29b-41d4-a716-446655440000",
"660e8400-e29b-41d4-a716-446655440001"
]
})
});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/sort",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
json={
"items": [
"550e8400-e29b-41d4-a716-446655440000",
"660e8400-e29b-41d4-a716-446655440001"
]
},
)Response
{
"success": true
}Unauthorized - Invalid or missing authentication token
User lacks Invoices.manage permission or project access
Potential invoice not found