Create a subscription
Subscriptions
Create Subscription
Creates a new subscription by assigning a specific asset (device) to a customer from an order. This is the order fulfillment step - it links a physical device (by serial number) to a line item in an order, creating an active subscription.
POST
Create a subscription
Overview
Create a new subscription to fulfill an order item. This is the key step that activates a customer’s subscription—it assigns a physical asset (by serial number) to an order line item and starts the billing cycle.The Fulfillment Flow
Common Use Cases
Order Fulfillment
Activate subscriptions as devices are shipped to customers
Warehouse Integration
Automatically create subscriptions when assets are scanned for shipping
Bulk Activation
Fulfill multiple-unit orders by creating subscriptions for each item
Migration
Import existing subscriptions when migrating from another platform
Request Fields
| Field | Required | Description |
|---|---|---|
orderId | Yes | The order to fulfill |
assetSerialNumber | Yes | Serial number of the asset to assign |
customerId | Yes | Customer ID for this subscription |
billingGroupId | No | Billing group for consolidated B2B invoicing |
startDate | No | Subscription start date (default: today) |
contractLength | No | Contract duration in months (1-120, default: from order) |
notes | No | Internal notes for this subscription |
Basic Example
Example with Custom Start Date
Fulfilling Multi-Unit Orders
For an order with 3 units of the same product:Asset Requirements
The serial number must reference an asset that:- Exists in your asset inventory
- Matches the SKU from the order item
- Is available (status:
available)
rented_out.
What Gets Created
When you create a subscription:- Subscription record created with billing schedule
- Asset status updated to
rented_out - Order progress updated (rentedDevices count)
- First payment scheduled based on tenant settings
- Customer record updated with new device count
Billing Start Options
Your tenant settings control when billing starts:| Setting | Behavior |
|---|---|
immediate | First payment due immediately |
first_of_next_month | First payment on 1st of next month |
same_day_next_month | First payment same day next month |
Error Handling
| Error Code | Cause | Solution |
|---|---|---|
ORDER_NOT_FOUND | Invalid order ID | Verify order exists |
ORDER_NOT_CONFIRMED | Order not in confirmed status | Confirm order first |
ITEM_FULLY_FULFILLED | All units for this item already have subscriptions | Check order item quantity |
ASSET_NOT_FOUND | Serial number doesn’t exist | Create asset first |
ASSET_NOT_AVAILABLE | Asset already rented or unavailable | Use a different asset |
SKU_MISMATCH | Asset SKU doesn’t match order item | Verify correct asset |
Related Endpoints
- Get Order - Check order details and items
- List Assets - Find available assets
- Create Asset - Add new assets to inventory
- List Subscriptions - View created subscriptions
Authorizations
API key obtained from FlexPortal dashboard
Headers
Your tenant identifier
Body
application/json