LedgerBee Developer
  • Getting started
  • Conventions
  • Products
  • Configuration
  • API Reference
Information
Accounts
    List accountsget
API Key
    Get current API keyget
Company
    Get company detailsget
Credit Notes
    List credit notesgetCreate a credit notepostGet a credit notegetGet the delivery status of a credit notegetDownload the credit note PDFgetSend a credit note to the customerpost
Customers
    List customersgetCreate a customerpostGet a customergetUpdate a customerpatchList a customer's contactsgetList a customer's departmentsgetList customer groupsget
Dimensions
    List all dimensionsgetCreate a new dimension categorypostGet a dimensiongetUpdate a dimension categoryputDelete a dimension categorydeleteCreate a new dimension valuepostUpdate a dimension valueputDelete a dimension valuedelete
Document Templates
    List document templatesget
Draft Journal Entries
    Create multiple draft journal entries in batchpostList draft journal entriesgetCreate a draft journal entrypostGet a draft journal entrygetDelete a draft journal entrydeleteBook a draft journal entrypost
Draft Journal Entries (v2)
    Create draft journal entries in batch (v2)postList draft journal entries (v2)getCreate a draft journal entry (v2)postGet a draft journal entry (v2)getDelete a draft journal entry (v2)deleteUpdate a draft journal entry (v2)patchBook a draft journal entry (v2)post
Entitlements
    List entitlementsgetCreate an entitlementpostGet an entitlementgetDelete an entitlementdeleteUpdate an entitlementpatch
Invoices
    List invoicesgetCreate a draft invoicepostGet an invoicegetGet the delivery status of an invoicegetDownload the invoice PDFgetSend an invoice to the customerpost
Journal Categories
    List journal categoriesget
Journal Entries
    Create multiple journal entries in batchpostList journal entriesgetCreate a journal entrypostGet a journal entrygetUpdate a journal entry — correct the reference and/or set your external system idpatchGet attachments for a journal entrygetReverse posted journal entries in batchpostReverse a posted journal entrypost
Journal Entries (v2)
    Create a journal entry (v2)postCreate journal entries in batch (v2)post
MCP
    LedgerBee Developer MCP Serverpost
Meters
    List meter subscriptions by IDgetReport usagepostList meter subscriptions by nameget
Order Confirmations
    List order confirmationsgetCreate a draft order confirmationpostGet an order confirmationgetUpdate a draft order confirmationpatchConvert an order confirmation into an invoicepostDownload an order confirmation as PDFgetSend an order confirmationpost
Payment Methods
    List saved payment methods for a customergetCancel a saved card on the payment providerdeleteUnassign a payment method from a customerdeleteGenerate a link for the customer to save a card for future paymentspostSet a saved payment method as the customer defaultput
Portal Plans
    List the full plan cataloguegetGet a plangetResolve the gated pricing catalogue for an identified buyer (partner display)post
Portal SSO
    Get a tenant's SSO signing keys (JWKS)getMint a customer-portal SSO handoff referencepostProvision a customer + grant portal access (partner JIT provisioning)postRevoke (force-refresh) a user's customer-portal sessionspost
Product Groups
    List product groupsgetCreate a product grouppostGet a product groupgetDelete a product groupdeleteUpdate a product grouppatch
Product Prices
    Create a product pricepostGet a product pricegetDelete a product pricedeleteUpdate a product pricepatchActivate a product pricepostArchive a product pricepostDisable a product pricepostSet a price as the product defaultpost
Products
    List productsgetCreate a productpostGet a productgetDelete a productdeleteUpdate a productpatch
Projects
    List all projectsgetCreate or update a project by external referenceputCreate a projectpostGet a projectgetUpdate a projectputGet project profitgetAdd a subprojectpostUpdate a subprojectputDelete a subprojectdelete
Quotes
    List quotesgetCreate a draft quotepostGet a quotegetUpdate a draft quotepatchConvert a quotepostDownload a quote as PDFgetSend a quotepost
Subscriptions
    List customer subscriptionsgetAssign a subscription to a customerpostGet a customer subscription by its stable idgetUpdate a customer subscriptionpatchRetry a failed card paymentpostList a subscription's pending scheduled changesgetCancel a single pending scheduled changedeleteCancel a customer subscriptionpostList subscription plansgetCreate a subscription planpostArchive a subscription planpost
Suppliers
    List suppliersgetCreate a supplierpostList supplier contactsgetList supplier departmentsgetList supplier groupsget
VAT Codes
    List VAT codesget
Vendors
    List vendorsgetCreate a vendorpostList vendor contactsgetList vendor departmentsgetList vendor groupsget
Webhook Endpoints
    List webhook endpointsgetCreate a webhook endpointpostRetrieve a webhook endpointgetUpdate a webhook endpointputDelete a webhook endpointdeleteRoll the signing secretpostSend a test eventpost
Schemas
LedgerBee Public API
LedgerBee Public API

Subscriptions

Download schema

Subscription plan and customer subscription management endpoints


List customer subscriptions

GET
https://api.ledgerbee.com/api
/v1/subscriptions
x-api-key (header)
or
OAuth 2.0

Retrieves a paginated list of your company's customer subscriptions.

The list can be narrowed by free-text search, subscription statuses, customerId, planId, or your own partnerReferenceId.

Required Scope

  • subscriptions-read

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

List customer subscriptions › query Parameters

page
​number · min: 1

Page number (1-indexed)

Example: 1
Default: 1
limit
​number · min: 1 · max: 100

Number of items per page

Example: 25
Default: 25
search
​string

Search by customer name or subscription name

statuses
​string[]

Filter by subscription statuses

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
customerId
​string

Filter by customer ID

planId
​string

Filter by subscription plan ID

partnerReferenceId
​string

Filter to the subscription(s) carrying this exact partner reconciliation reference — the clientReferenceId you passed at embedded-checkout bind time. Use it to recover a missed subscription webhook: resolve our subscription from your own order id.

Example: order_7f3a9c21

List customer subscriptions › Responses

List of customer subscriptions

PublicListCustomerSubscriptionsResponse
​PublicCustomerSubscriptionListItem[] · required

List of customer subscriptions

total
​number · required

Total number of customer subscriptions matching the query

Example: 42
page
​number · required

Current page number (1-indexed)

Example: 1
limit
​number · required

Maximum number of items per page

Example: 25
totalPages
​number · required

Total number of pages available

Example: 2
GET/v1/subscriptions
curl https://api.ledgerbee.com/api/v1/subscriptions \ --header 'x-api-key: <api-key>'
Example Responses
{ "data": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "customerNumber": "C001", "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "status": "active", "startDate": "2024-01-01", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "currency": "DKK", "partnerReferenceId": "order_7f3a9c21" } ], "total": 42, "page": 1, "limit": 25, "totalPages": 2 }
json
application/json

Assign a subscription to a customer

POST
https://api.ledgerbee.com/api
/v1/subscriptions
x-api-key (header)
or
OAuth 2.0

Creates a customer subscription from a plan, starting on startDate.

When billingDirection is omitted, the subscription defaults to in-advance (ADVANCE) billing.

The response includes the subscription's stable id — use it for all subsequent reads, updates, and cancellations; it stays valid across plan replacements and other scheduled changes.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Assign a subscription to a customer › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Assign a subscription to a customer › Request Body

PublicAssignSubscriptionRequest
customerId
​string · required

Customer ID to assign the subscription to

Example: 550e8400-e29b-41d4-a716-446655440000
planId
​string · required

Subscription plan ID

Example: 550e8400-e29b-41d4-a716-446655440000
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
billingCycleAnchor
​string

Billing cycle anchor date (ISO 8601). When the billing cycle should align to. Defaults to startDate if not provided.

Example: 2024-02-01
prorationBehavior
​string · enum

How to handle proration from startDate to billingCycleAnchor

Enum values:
create_prorations
always_invoice
none
Example: none
Default: none
trialDays
​number · min: 0 · max: 365

Trial period in days

Example: 14
billingDirection
​string · enum

Billing direction for this subscription

Enum values:
advance
arrears
Example: advance
customerDepartmentId
​string

Customer department ID for invoice delivery

Example: 550e8400-e29b-41d4-a716-446655440000
departmentContactOverrideId
​string

Contact override ID for department invoice delivery

Example: 550e8400-e29b-41d4-a716-446655440000
​PublicAssignSubscriptionProductOverride[]

Optional quantity overrides for products in the plan

automaticBilling
​boolean

Whether to enable automatic billing

Example: false
collectViaLeverandorservice
​boolean

Collect each billing cycle via Leverandørservice (Danish direct debit) instead of a card charge. DKK-only. Requires the tenant to hold the Leverandørservice license, a configured creditor number, and a registered mandate for the customer.

Example: false
paymentMethodId
​string · deprecated

Deprecated and non-functional. Cards are attached by the buyer with their consent (card-save link / portal checkout); any value here is rejected. Field retained only so the request is validated cleanly.

Example: 550e8400-e29b-41d4-a716-446655440000

Assign a subscription to a customer › Responses

Subscription assigned to customer successfully

PublicCustomerSubscriptionResponse
id
​string · required

Customer subscription ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerId
​string · required

Customer ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerName
​string · required

Customer name

Example: Acme Corporation
subscriptionName
​string · required

Subscription name

Example: Premium Plan
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
status
​string · enum · required

Status of the customer subscription

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
Example: active
currency
​string · required

Currency code (ISO 4217)

Example: DKK
billingDirection
​string · enum · required

Billing direction: ADVANCE bills at period start, ARREARS at period end

Enum values:
advance
arrears
Example: advance
effectiveBillingDirection
​string · enum · required

Effective billing direction for the current period. Can differ from billingDirection if the direction was changed mid-period.

Enum values:
advance
arrears
Example: advance
​EntitlementRef[]

Entitlements currently granted by the subscription

planId
​string

Subscription plan ID (null for ad-hoc subscriptions)

Example: 550e8400-e29b-41d4-a716-446655440000
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
scheduledChurnDate
​string

Scheduled churn date (ISO 8601)

Example: 2024-07-15
trialDays
​number

Number of trial days granted

Example: 14
cancellationReason
​string

Reason provided when the subscription was cancelled

Example: Customer requested downgrade
effectiveNextBillingDate
​string

The date the NEXT invoice will be created (ISO 8601). This is an invoicing schedule marker, not a payment marker — it does not say what the customer has paid for; see paidThroughDate.

Example: 2024-02-01
paidThroughDate
​string | null

The date the subscription is paid through (ISO 8601): the first day not yet paid for. It is the end of the contiguous run of settled service periods starting at the earliest billed period, so an unpaid period caps it rather than being skipped. Null when the earliest billed period is not settled (or nothing is billed yet). Payment timing never shifts this backwards: a late payment settles exactly the period its invoice stated.

Example: 2024-02-01
commitmentEndDate
​string

End date of the customer commitment period (ISO 8601)

Example: 2025-12-31
originalStartDate
​string

Original start date from source system for migrated subscriptions (ISO 8601)

Example: 2023-01-01
paymentMethodId
​string | null

Assigned payment method ID

Example: 550e8400-e29b-41d4-a716-446655440000
automaticBilling
​boolean

Whether automatic billing is enabled

Example: true
partnerReferenceId
​string | null

Your reconciliation reference (the clientReferenceId you passed at embedded-checkout bind time), echoed back so you can match this subscription to your order. Null for any subscription not created through a partner-bound checkout.

Example: order_7f3a9c21
POST/v1/subscriptions
curl https://api.ledgerbee.com/api/v1/subscriptions \ --request POST \ --header 'Content-Type: application/json' \ --header 'x-api-key: <api-key>' \ --data '{ "customerId": "550e8400-e29b-41d4-a716-446655440000", "planId": "550e8400-e29b-41d4-a716-446655440000", "startDate": "2024-01-01", "endDate": "2025-01-01", "billingCycleAnchor": "2024-02-01", "prorationBehavior": "none", "trialDays": 14, "billingDirection": "advance", "customerDepartmentId": "550e8400-e29b-41d4-a716-446655440000", "departmentContactOverrideId": "550e8400-e29b-41d4-a716-446655440000", "productOverrides": [ { "priceId": "550e8400-e29b-41d4-a716-446655440000", "quantity": 25, "committedQuantity": 100, "usageCarryoverMode": "reset", "underageMode": "forfeit", "minimumCommittedQuantity": 0 } ], "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": false, "collectViaLeverandorservice": false }'
Example Request Body
{ "customerId": "550e8400-e29b-41d4-a716-446655440000", "planId": "550e8400-e29b-41d4-a716-446655440000", "startDate": "2024-01-01", "endDate": "2025-01-01", "billingCycleAnchor": "2024-02-01", "prorationBehavior": "none", "trialDays": 14, "billingDirection": "advance", "customerDepartmentId": "550e8400-e29b-41d4-a716-446655440000", "departmentContactOverrideId": "550e8400-e29b-41d4-a716-446655440000", "productOverrides": [ { "priceId": "550e8400-e29b-41d4-a716-446655440000", "quantity": 25, "committedQuantity": 100, "usageCarryoverMode": "reset", "underageMode": "forfeit", "minimumCommittedQuantity": 0 } ], "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": false, "collectViaLeverandorservice": false }
json
application/json
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "entitlements": [ { "id": "id", "name": "Advanced reporting", "key": "advanced_reporting" } ], "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "startDate": "2024-01-01", "endDate": "2025-01-01", "scheduledChurnDate": "2024-07-15", "status": "active", "currency": "DKK", "trialDays": 14, "cancellationReason": "Customer requested downgrade", "billingDirection": "advance", "effectiveBillingDirection": "advance", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "commitmentEndDate": "2025-12-31", "originalStartDate": "2023-01-01", "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": true, "partnerReferenceId": "order_7f3a9c21" }
json
application/json

Get a customer subscription by its stable id

GET
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}
x-api-key (header)
or
OAuth 2.0

Returns the current state of the subscription identified by its stable id — the chain head id returned at creation. The id is resolved against the version chain, so it keeps working across plan replacements, billing-direction / cadence changes, and scheduled cancellations; the headline plan fields always reflect the version running today.

Required Scope

  • subscriptions-read

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Get a customer subscription by its stable id › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id)

Get a customer subscription by its stable id › Responses

Customer subscription

PublicCustomerSubscriptionResponse
id
​string · required

Customer subscription ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerId
​string · required

Customer ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerName
​string · required

Customer name

Example: Acme Corporation
subscriptionName
​string · required

Subscription name

Example: Premium Plan
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
status
​string · enum · required

Status of the customer subscription

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
Example: active
currency
​string · required

Currency code (ISO 4217)

Example: DKK
billingDirection
​string · enum · required

Billing direction: ADVANCE bills at period start, ARREARS at period end

Enum values:
advance
arrears
Example: advance
effectiveBillingDirection
​string · enum · required

Effective billing direction for the current period. Can differ from billingDirection if the direction was changed mid-period.

Enum values:
advance
arrears
Example: advance
​EntitlementRef[]

Entitlements currently granted by the subscription

planId
​string

Subscription plan ID (null for ad-hoc subscriptions)

Example: 550e8400-e29b-41d4-a716-446655440000
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
scheduledChurnDate
​string

Scheduled churn date (ISO 8601)

Example: 2024-07-15
trialDays
​number

Number of trial days granted

Example: 14
cancellationReason
​string

Reason provided when the subscription was cancelled

Example: Customer requested downgrade
effectiveNextBillingDate
​string

The date the NEXT invoice will be created (ISO 8601). This is an invoicing schedule marker, not a payment marker — it does not say what the customer has paid for; see paidThroughDate.

Example: 2024-02-01
paidThroughDate
​string | null

The date the subscription is paid through (ISO 8601): the first day not yet paid for. It is the end of the contiguous run of settled service periods starting at the earliest billed period, so an unpaid period caps it rather than being skipped. Null when the earliest billed period is not settled (or nothing is billed yet). Payment timing never shifts this backwards: a late payment settles exactly the period its invoice stated.

Example: 2024-02-01
commitmentEndDate
​string

End date of the customer commitment period (ISO 8601)

Example: 2025-12-31
originalStartDate
​string

Original start date from source system for migrated subscriptions (ISO 8601)

Example: 2023-01-01
paymentMethodId
​string | null

Assigned payment method ID

Example: 550e8400-e29b-41d4-a716-446655440000
automaticBilling
​boolean

Whether automatic billing is enabled

Example: true
partnerReferenceId
​string | null

Your reconciliation reference (the clientReferenceId you passed at embedded-checkout bind time), echoed back so you can match this subscription to your order. Null for any subscription not created through a partner-bound checkout.

Example: order_7f3a9c21
GET/v1/subscriptions/{customerSubscriptionId}
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId \ --header 'x-api-key: <api-key>'
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "entitlements": [ { "id": "id", "name": "Advanced reporting", "key": "advanced_reporting" } ], "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "startDate": "2024-01-01", "endDate": "2025-01-01", "scheduledChurnDate": "2024-07-15", "status": "active", "currency": "DKK", "trialDays": 14, "cancellationReason": "Customer requested downgrade", "billingDirection": "advance", "effectiveBillingDirection": "advance", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "commitmentEndDate": "2025-12-31", "originalStartDate": "2023-01-01", "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": true, "partnerReferenceId": "order_7f3a9c21" }
json
application/json

Update a customer subscription

PATCH
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}
x-api-key (header)
or
OAuth 2.0

Update payment-related settings on an existing customer subscription.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Update a customer subscription › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id)

Update a customer subscription › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Update a customer subscription › Request Body

PublicUpdateSubscriptionRequest
paymentMethodId
​string | null

The card linked to the subscription. Send null to remove it. You may also echo back the card already linked (a no-op, so a full-object round-trip works), but you cannot attach or change to a different card - cards are attached by the buyer with their consent, so any value other than the currently-linked card or null is rejected with a 400.

Example: null
automaticBilling
​boolean

Whether to automatically charge the saved card during billing

Example: true

Update a customer subscription › Responses

Customer subscription updated successfully

PublicCustomerSubscriptionResponse
id
​string · required

Customer subscription ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerId
​string · required

Customer ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerName
​string · required

Customer name

Example: Acme Corporation
subscriptionName
​string · required

Subscription name

Example: Premium Plan
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
status
​string · enum · required

Status of the customer subscription

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
Example: active
currency
​string · required

Currency code (ISO 4217)

Example: DKK
billingDirection
​string · enum · required

Billing direction: ADVANCE bills at period start, ARREARS at period end

Enum values:
advance
arrears
Example: advance
effectiveBillingDirection
​string · enum · required

Effective billing direction for the current period. Can differ from billingDirection if the direction was changed mid-period.

Enum values:
advance
arrears
Example: advance
​EntitlementRef[]

Entitlements currently granted by the subscription

planId
​string

Subscription plan ID (null for ad-hoc subscriptions)

Example: 550e8400-e29b-41d4-a716-446655440000
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
scheduledChurnDate
​string

Scheduled churn date (ISO 8601)

Example: 2024-07-15
trialDays
​number

Number of trial days granted

Example: 14
cancellationReason
​string

Reason provided when the subscription was cancelled

Example: Customer requested downgrade
effectiveNextBillingDate
​string

The date the NEXT invoice will be created (ISO 8601). This is an invoicing schedule marker, not a payment marker — it does not say what the customer has paid for; see paidThroughDate.

Example: 2024-02-01
paidThroughDate
​string | null

The date the subscription is paid through (ISO 8601): the first day not yet paid for. It is the end of the contiguous run of settled service periods starting at the earliest billed period, so an unpaid period caps it rather than being skipped. Null when the earliest billed period is not settled (or nothing is billed yet). Payment timing never shifts this backwards: a late payment settles exactly the period its invoice stated.

Example: 2024-02-01
commitmentEndDate
​string

End date of the customer commitment period (ISO 8601)

Example: 2025-12-31
originalStartDate
​string

Original start date from source system for migrated subscriptions (ISO 8601)

Example: 2023-01-01
paymentMethodId
​string | null

Assigned payment method ID

Example: 550e8400-e29b-41d4-a716-446655440000
automaticBilling
​boolean

Whether automatic billing is enabled

Example: true
partnerReferenceId
​string | null

Your reconciliation reference (the clientReferenceId you passed at embedded-checkout bind time), echoed back so you can match this subscription to your order. Null for any subscription not created through a partner-bound checkout.

Example: order_7f3a9c21
PATCH/v1/subscriptions/{customerSubscriptionId}
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId \ --request PATCH \ --header 'Content-Type: application/json' \ --header 'x-api-key: <api-key>' \ --data '{ "paymentMethodId": null, "automaticBilling": true }'
Example Request Body
{ "paymentMethodId": null, "automaticBilling": true }
json
application/json
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "entitlements": [ { "id": "id", "name": "Advanced reporting", "key": "advanced_reporting" } ], "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "startDate": "2024-01-01", "endDate": "2025-01-01", "scheduledChurnDate": "2024-07-15", "status": "active", "currency": "DKK", "trialDays": 14, "cancellationReason": "Customer requested downgrade", "billingDirection": "advance", "effectiveBillingDirection": "advance", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "commitmentEndDate": "2025-12-31", "originalStartDate": "2023-01-01", "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": true, "partnerReferenceId": "order_7f3a9c21" }
json
application/json

Retry a failed card payment

POST
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}/retry-payment
x-api-key (header)
or
OAuth 2.0

Recharges the saved card for a subscription parked in awaiting_payment after a failed charge — the API twin of the buyer portal's "Pay now".

The retry targets the outstanding unpaid card invoice; there is no request body. It works while automatic retries are still running AND after dunning is exhausted (it re-opens the exhausted attempt), and it ignores the automatic ladder's backoff schedule. A cleared retry settles the invoice, resumes the subscription, and fires the subscription.payment_succeeded webhook.

Failure states return coded errors: PORTAL_RETRY_PAYMENT_NOT_AVAILABLE (the subscription is not awaiting payment, has no unpaid card invoice, or has automatic billing disabled), PORTAL_RETRY_PAYMENT_IN_PROGRESS (a concurrent charge holds the claim, or the invoice was just paid — re-read the subscription), and PORTAL_RETRY_PAYMENT_DECLINED (the card genuinely declined). The codes carry the PORTAL_ prefix because this endpoint shares its implementation with the buyer portal's own retry.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Retry a failed card payment › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id)

Retry a failed card payment › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Retry a failed card payment › Responses

The retry charge cleared and the invoice is settled

PublicRetryPaymentResponseDTO
status
​string · required

Always "succeeded" — a failed retry returns a coded error instead.

Example: succeeded
subscriptionId
​string · required

The stable subscription id the retry ran against.

Example: 01890a5d-ac96-774b-b9aa-9d0f8f6c3b45
invoiceId
​string · required

Id of the outstanding invoice the cleared charge paid.

Example: 01890a5d-ac96-774b-b9aa-9d0f8f6c3b46
POST/v1/subscriptions/{customerSubscriptionId}/retry-payment
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId/retry-payment \ --request POST \ --header 'x-api-key: <api-key>'
Example Responses
{ "status": "succeeded", "subscriptionId": "01890a5d-ac96-774b-b9aa-9d0f8f6c3b45", "invoiceId": "01890a5d-ac96-774b-b9aa-9d0f8f6c3b46" }
json
application/json

List a subscription's pending scheduled changes

GET
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}/scheduled-changes
x-api-key (header)
or
OAuth 2.0

Returns the queued, not-yet-active changes on the subscription — future-dated plan replacements, billing-direction / cadence changes, and scheduled cancellations. Each carries a changeId that can be cancelled individually. Empty array when nothing is queued.

Required Scope

  • subscriptions-read

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

List a subscription's pending scheduled changes › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id)

List a subscription's pending scheduled changes › Responses

The list of pending scheduled changes

PublicScheduledChange
changeId
​string · required

Identifier of this queued change. Ephemeral — valid only until the change activates or is cancelled, so re-fetch rather than caching it.

Example: 550e8400-e29b-41d4-a716-446655440000
kind
​string · required

The kind of queued change: one of replace_plan, edit_products, change_direction, or churn.

Example: replace_plan
effectiveDate
​string · required

The date (YYYY-MM-DD) the change takes effect.

Example: 2024-07-01
planId
​string | null · required

The plan the subscription moves to when the change activates (null for ad-hoc / non-plan changes).

Example: 550e8400-e29b-41d4-a716-446655440000
subscriptionName
​string · required

The plan name the change moves to.

Example: Pro (annual)
GET/v1/subscriptions/{customerSubscriptionId}/scheduled-changes
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId/scheduled-changes \ --header 'x-api-key: <api-key>'
Example Responses
{ "changeId": "550e8400-e29b-41d4-a716-446655440000", "kind": "replace_plan", "effectiveDate": "2024-07-01", "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Pro (annual)" }
json
application/json

Cancel a single pending scheduled change

DELETE
https://api.ledgerbee.com/api
/v1/subscriptions/{customerSubscriptionId}/scheduled-changes/{changeId}
x-api-key (header)
or
OAuth 2.0

Cancels exactly one queued change (from the scheduled-changes list) without ending the subscription or touching its other scheduled changes. Returns the subscription’s current state. A changeId that has already activated or been cancelled returns 404.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Cancel a single pending scheduled change › path Parameters

customerSubscriptionId
​string · required

The stable subscription id (chain head id)

changeId
​string · required

The changeId of the scheduled change to cancel

Cancel a single pending scheduled change › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Cancel a single pending scheduled change › Responses

Scheduled change cancelled; the subscription’s current state

PublicCustomerSubscriptionResponse
id
​string · required

Customer subscription ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerId
​string · required

Customer ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerName
​string · required

Customer name

Example: Acme Corporation
subscriptionName
​string · required

Subscription name

Example: Premium Plan
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
status
​string · enum · required

Status of the customer subscription

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
Example: active
currency
​string · required

Currency code (ISO 4217)

Example: DKK
billingDirection
​string · enum · required

Billing direction: ADVANCE bills at period start, ARREARS at period end

Enum values:
advance
arrears
Example: advance
effectiveBillingDirection
​string · enum · required

Effective billing direction for the current period. Can differ from billingDirection if the direction was changed mid-period.

Enum values:
advance
arrears
Example: advance
​EntitlementRef[]

Entitlements currently granted by the subscription

planId
​string

Subscription plan ID (null for ad-hoc subscriptions)

Example: 550e8400-e29b-41d4-a716-446655440000
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
scheduledChurnDate
​string

Scheduled churn date (ISO 8601)

Example: 2024-07-15
trialDays
​number

Number of trial days granted

Example: 14
cancellationReason
​string

Reason provided when the subscription was cancelled

Example: Customer requested downgrade
effectiveNextBillingDate
​string

The date the NEXT invoice will be created (ISO 8601). This is an invoicing schedule marker, not a payment marker — it does not say what the customer has paid for; see paidThroughDate.

Example: 2024-02-01
paidThroughDate
​string | null

The date the subscription is paid through (ISO 8601): the first day not yet paid for. It is the end of the contiguous run of settled service periods starting at the earliest billed period, so an unpaid period caps it rather than being skipped. Null when the earliest billed period is not settled (or nothing is billed yet). Payment timing never shifts this backwards: a late payment settles exactly the period its invoice stated.

Example: 2024-02-01
commitmentEndDate
​string

End date of the customer commitment period (ISO 8601)

Example: 2025-12-31
originalStartDate
​string

Original start date from source system for migrated subscriptions (ISO 8601)

Example: 2023-01-01
paymentMethodId
​string | null

Assigned payment method ID

Example: 550e8400-e29b-41d4-a716-446655440000
automaticBilling
​boolean

Whether automatic billing is enabled

Example: true
partnerReferenceId
​string | null

Your reconciliation reference (the clientReferenceId you passed at embedded-checkout bind time), echoed back so you can match this subscription to your order. Null for any subscription not created through a partner-bound checkout.

Example: order_7f3a9c21
DELETE/v1/subscriptions/{customerSubscriptionId}/scheduled-changes/{changeId}
curl https://api.ledgerbee.com/api/v1/subscriptions/:customerSubscriptionId/scheduled-changes/:changeId \ --request DELETE \ --header 'x-api-key: <api-key>'
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "entitlements": [ { "id": "id", "name": "Advanced reporting", "key": "advanced_reporting" } ], "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "startDate": "2024-01-01", "endDate": "2025-01-01", "scheduledChurnDate": "2024-07-15", "status": "active", "currency": "DKK", "trialDays": 14, "cancellationReason": "Customer requested downgrade", "billingDirection": "advance", "effectiveBillingDirection": "advance", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "commitmentEndDate": "2025-12-31", "originalStartDate": "2023-01-01", "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": true, "partnerReferenceId": "order_7f3a9c21" }
json
application/json

Cancel a customer subscription

POST
https://api.ledgerbee.com/api
/v1/subscriptions/cancel
x-api-key (header)
or
OAuth 2.0

Cancels (churns) a customer subscription according to the chosen strategy — at the end of the current billing cycle, immediately, or on a specific date.

effectiveDate is required when the strategy is SPECIFIC_DATE, and refundBehavior only applies when cancelling immediately. A non-immediate cancellation is queued and appears in the subscription's scheduled-changes list until it takes effect.

Returns the subscription's current state after the command is applied.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Cancel a customer subscription › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Cancel a customer subscription › Request Body

PublicCancelSubscriptionRequest
id
​string · required

Customer subscription ID to cancel

Example: 550e8400-e29b-41d4-a716-446655440000
strategy
​string · enum · required

Cancellation strategy

Enum values:
immediately
end_of_cycle
specific_date
clear_schedule
Example: end_of_cycle
effectiveDate
​string

Effective churn date (ISO 8601). Required when strategy is SPECIFIC_DATE.

Example: 2024-06-30
refundBehavior
​string · enum

Refund behavior when canceling immediately

Enum values:
none
last_invoice
prorated
Example: none
Default: none
cancellationReason
​string

Optional reason for cancelling the subscription

Example: Customer requested downgrade

Cancel a customer subscription › Responses

Customer subscription cancelled successfully

PublicCustomerSubscriptionResponse
id
​string · required

Customer subscription ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerId
​string · required

Customer ID

Example: 550e8400-e29b-41d4-a716-446655440000
customerName
​string · required

Customer name

Example: Acme Corporation
subscriptionName
​string · required

Subscription name

Example: Premium Plan
startDate
​string · required

Start date (ISO 8601)

Example: 2024-01-01
status
​string · enum · required

Status of the customer subscription

Enum values:
scheduled
trial
awaiting_payment
active
pending_cancellation
paused
cancelled
expired
Example: active
currency
​string · required

Currency code (ISO 4217)

Example: DKK
billingDirection
​string · enum · required

Billing direction: ADVANCE bills at period start, ARREARS at period end

Enum values:
advance
arrears
Example: advance
effectiveBillingDirection
​string · enum · required

Effective billing direction for the current period. Can differ from billingDirection if the direction was changed mid-period.

Enum values:
advance
arrears
Example: advance
​EntitlementRef[]

Entitlements currently granted by the subscription

planId
​string

Subscription plan ID (null for ad-hoc subscriptions)

Example: 550e8400-e29b-41d4-a716-446655440000
endDate
​string

End date (ISO 8601)

Example: 2025-01-01
scheduledChurnDate
​string

Scheduled churn date (ISO 8601)

Example: 2024-07-15
trialDays
​number

Number of trial days granted

Example: 14
cancellationReason
​string

Reason provided when the subscription was cancelled

Example: Customer requested downgrade
effectiveNextBillingDate
​string

The date the NEXT invoice will be created (ISO 8601). This is an invoicing schedule marker, not a payment marker — it does not say what the customer has paid for; see paidThroughDate.

Example: 2024-02-01
paidThroughDate
​string | null

The date the subscription is paid through (ISO 8601): the first day not yet paid for. It is the end of the contiguous run of settled service periods starting at the earliest billed period, so an unpaid period caps it rather than being skipped. Null when the earliest billed period is not settled (or nothing is billed yet). Payment timing never shifts this backwards: a late payment settles exactly the period its invoice stated.

Example: 2024-02-01
commitmentEndDate
​string

End date of the customer commitment period (ISO 8601)

Example: 2025-12-31
originalStartDate
​string

Original start date from source system for migrated subscriptions (ISO 8601)

Example: 2023-01-01
paymentMethodId
​string | null

Assigned payment method ID

Example: 550e8400-e29b-41d4-a716-446655440000
automaticBilling
​boolean

Whether automatic billing is enabled

Example: true
partnerReferenceId
​string | null

Your reconciliation reference (the clientReferenceId you passed at embedded-checkout bind time), echoed back so you can match this subscription to your order. Null for any subscription not created through a partner-bound checkout.

Example: order_7f3a9c21
POST/v1/subscriptions/cancel
curl https://api.ledgerbee.com/api/v1/subscriptions/cancel \ --request POST \ --header 'Content-Type: application/json' \ --header 'x-api-key: <api-key>' \ --data '{ "id": "550e8400-e29b-41d4-a716-446655440000", "strategy": "end_of_cycle", "effectiveDate": "2024-06-30", "refundBehavior": "none", "cancellationReason": "Customer requested downgrade" }'
Example Request Body
{ "id": "550e8400-e29b-41d4-a716-446655440000", "strategy": "end_of_cycle", "effectiveDate": "2024-06-30", "refundBehavior": "none", "cancellationReason": "Customer requested downgrade" }
json
application/json
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "customerId": "550e8400-e29b-41d4-a716-446655440000", "customerName": "Acme Corporation", "entitlements": [ { "id": "id", "name": "Advanced reporting", "key": "advanced_reporting" } ], "planId": "550e8400-e29b-41d4-a716-446655440000", "subscriptionName": "Premium Plan", "startDate": "2024-01-01", "endDate": "2025-01-01", "scheduledChurnDate": "2024-07-15", "status": "active", "currency": "DKK", "trialDays": 14, "cancellationReason": "Customer requested downgrade", "billingDirection": "advance", "effectiveBillingDirection": "advance", "effectiveNextBillingDate": "2024-02-01", "paidThroughDate": "2024-02-01", "commitmentEndDate": "2025-12-31", "originalStartDate": "2023-01-01", "paymentMethodId": "550e8400-e29b-41d4-a716-446655440000", "automaticBilling": true, "partnerReferenceId": "order_7f3a9c21" }
json
application/json

List subscription plans

GET
https://api.ledgerbee.com/api
/v1/subscriptions/plans
x-api-key (header)
or
OAuth 2.0

Retrieves a paginated list of your company's subscription plans.

Only active plans are returned — archived plans are excluded. Pass ?search= to filter the list by free text.

Required Scope

  • subscriptions-read

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

List subscription plans › query Parameters

page
​number · min: 1

Page number (1-indexed)

Example: 1
Default: 1
limit
​number · min: 1 · max: 100

Number of items per page

Example: 25
Default: 25
search
​string

Search by plan name

List subscription plans › Responses

List of subscription plans

PublicListSubscriptionPlansResponse
​PublicSubscriptionPlanResponse[] · required

List of subscription plans

total
​number · required

Total number of subscription plans matching the query

Example: 42
page
​number · required

Current page number (1-indexed)

Example: 1
limit
​number · required

Maximum number of items per page

Example: 25
totalPages
​number · required

Total number of pages available

Example: 2
GET/v1/subscriptions/plans
curl https://api.ledgerbee.com/api/v1/subscriptions/plans \ --header 'x-api-key: <api-key>'
Example Responses
{ "data": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Premium Plan", "description": "Our premium subscription plan with all features", "isActive": true, "currency": "DKK", "defaultBillingDirection": "advance", "phases": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "sequence": 1, "name": "Intro promo", "discountType": "percentage", "discountValue": "10.00", "durationValue": 3, "durationUnit": "month", "products": [ { "priceId": "550e8400-e29b-41d4-a716-446655440000", "quantity": 1, "customPrice": "89.99" } ], "intervalDiscounts": [ { "billingInterval": "month", "billingIntervalCount": 1, "discountType": "flat", "value": "50.00", "description": "Negotiated rate discount" } ] } ], "createdAt": "2024-01-01T00:00:00.000Z", "updatedAt": "2024-01-01T00:00:00.000Z" } ], "total": 42, "page": 1, "limit": 25, "totalPages": 2 }
json
application/json

Create a subscription plan

POST
https://api.ledgerbee.com/api
/v1/subscriptions/plans
x-api-key (header)
or
OAuth 2.0

Creates a new subscription plan (template) that can later be assigned to customers.

A plan is made up of one or more phases, and each phase lists the products it bills via their existing priceId. Set durationValue / durationUnit on a phase to make it time-bounded; omit them on the last phase to leave it open-ended. When currency is omitted the company's base currency is used, and when defaultBillingDirection is omitted the plan defaults to in-advance (ADVANCE) billing.

The created plan is returned, including the generated plan and phase ids.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Create a subscription plan › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Create a subscription plan › Request Body

PublicCreateSubscriptionPlanRequest
name
​string · required

Subscription plan name. Must be unique within your company.

Example: Premium Plan
​PublicCreateSubscriptionPlanPhase[] · maxItems: 50 · required

Phases defining the plan’s billing structure. At least one phase is required.

description
​string

Subscription plan description

Example: Our premium subscription plan with all features
currency
​string · minLength: 3 · maxLength: 3

Currency code (ISO 4217). When omitted, defaults to the system default currency (DKK), matching the gated subscription-plan create endpoint.

Example: DKK
defaultBillingDirection
​string · enum

Default billing direction applied to new customer subscriptions created from this plan

Enum values:
advance
arrears
Example: advance

Create a subscription plan › Responses

Subscription plan created successfully

PublicSubscriptionPlanResponse
id
​string · required

Subscription plan ID

Example: 550e8400-e29b-41d4-a716-446655440000
name
​string · required

Subscription plan name

Example: Premium Plan
isActive
​boolean · required

Whether the subscription plan is active

Example: true
currency
​string · required

Currency code (ISO 4217)

Example: DKK
defaultBillingDirection
​string · enum · required

Default billing direction for new customer subscriptions

Enum values:
advance
arrears
Example: advance
​PublicSubscriptionPlanPhase[] · required

Phases configured for this plan

createdAt
​string · required

Date the plan was created

Example: 2024-01-01T00:00:00.000Z
updatedAt
​string · required

Date the plan was last updated

Example: 2024-01-01T00:00:00.000Z
description
​string

Subscription plan description

Example: Our premium subscription plan with all features
POST/v1/subscriptions/plans
curl https://api.ledgerbee.com/api/v1/subscriptions/plans \ --request POST \ --header 'Content-Type: application/json' \ --header 'x-api-key: <api-key>' \ --data '{ "name": "Premium Plan", "description": "Our premium subscription plan with all features", "currency": "DKK", "defaultBillingDirection": "advance", "phases": [ { "name": "Intro promo", "products": [], "discountType": "none", "discountValue": "10.00", "intervalDiscounts": [], "durationValue": 3, "durationUnit": "month" } ] }'
Example Request Body
{ "name": "Premium Plan", "description": "Our premium subscription plan with all features", "currency": "DKK", "defaultBillingDirection": "advance", "phases": [ { "name": "Intro promo", "products": [], "discountType": "none", "discountValue": "10.00", "intervalDiscounts": [], "durationValue": 3, "durationUnit": "month" } ] }
json
application/json
Example Responses
{ "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Premium Plan", "description": "Our premium subscription plan with all features", "isActive": true, "currency": "DKK", "defaultBillingDirection": "advance", "phases": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "sequence": 1, "name": "Intro promo", "discountType": "percentage", "discountValue": "10.00", "durationValue": 3, "durationUnit": "month", "products": [ { "priceId": "550e8400-e29b-41d4-a716-446655440000", "quantity": 1, "customPrice": "89.99" } ], "intervalDiscounts": [ { "billingInterval": "month", "billingIntervalCount": 1, "discountType": "flat", "value": "50.00", "description": "Negotiated rate discount" } ] } ], "createdAt": "2024-01-01T00:00:00.000Z", "updatedAt": "2024-01-01T00:00:00.000Z" }
json
application/json

Archive a subscription plan

POST
https://api.ledgerbee.com/api
/v1/subscriptions/plans/archive/{planId}
x-api-key (header)
or
OAuth 2.0

Archives a subscription plan. Fails if the plan has any active or pending-cancellation customer subscriptions.

Archived plans no longer appear in the plan list.

Required Scope

  • subscriptions-write

Required License

  • Subscription — the tenant must also hold this module license, or the request returns 403 LICENSE.REQUIRED.

Archive a subscription plan › path Parameters

planId
​string · required

The subscription plan ID

Archive a subscription plan › Headers

x-api-idempotency-key
​string · maxLength: 255

Optional idempotency key for safely retrying mutating requests.

Archive a subscription plan › Responses

Subscription plan archived successfully

No data returned
POST/v1/subscriptions/plans/archive/{planId}
curl https://api.ledgerbee.com/api/v1/subscriptions/plans/archive/:planId \ --request POST \ --header 'x-api-key: <api-key>'
Example Responses
No example specified for this content type

QuotesSuppliers