Export rentals to CSV
curl --request POST \
--url https://api-eu.flexportal.io/v1/exports/rentals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Tenant-ID: <tenant-id>' \
--data '
{
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"format": "csv",
"includeFields": {
"customerDetails": true,
"deviceDetails": true,
"financialDetails": true,
"customFields": true
},
"customerIds": [
"<string>"
]
}
'import requests
url = "https://api-eu.flexportal.io/v1/exports/rentals"
payload = {
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"format": "csv",
"includeFields": {
"customerDetails": True,
"deviceDetails": True,
"financialDetails": True,
"customFields": True
},
"customerIds": ["<string>"]
}
headers = {
"Tenant-ID": "<tenant-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Tenant-ID': '<tenant-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
startDate: '2023-11-07T05:31:56Z',
endDate: '2023-11-07T05:31:56Z',
format: 'csv',
includeFields: {
customerDetails: true,
deviceDetails: true,
financialDetails: true,
customFields: true
},
customerIds: ['<string>']
})
};
fetch('https://api-eu.flexportal.io/v1/exports/rentals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-eu.flexportal.io/v1/exports/rentals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '2023-11-07T05:31:56Z',
'format' => 'csv',
'includeFields' => [
'customerDetails' => true,
'deviceDetails' => true,
'financialDetails' => true,
'customFields' => true
],
'customerIds' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Tenant-ID: <tenant-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-eu.flexportal.io/v1/exports/rentals"
payload := strings.NewReader("{\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"format\": \"csv\",\n \"includeFields\": {\n \"customerDetails\": true,\n \"deviceDetails\": true,\n \"financialDetails\": true,\n \"customFields\": true\n },\n \"customerIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Tenant-ID", "<tenant-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-eu.flexportal.io/v1/exports/rentals")
.header("Tenant-ID", "<tenant-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"format\": \"csv\",\n \"includeFields\": {\n \"customerDetails\": true,\n \"deviceDetails\": true,\n \"financialDetails\": true,\n \"customFields\": true\n },\n \"customerIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-eu.flexportal.io/v1/exports/rentals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Tenant-ID"] = '<tenant-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"format\": \"csv\",\n \"includeFields\": {\n \"customerDetails\": true,\n \"deviceDetails\": true,\n \"financialDetails\": true,\n \"customFields\": true\n },\n \"customerIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"filename": "<string>",
"csvData": "<string>",
"totalRecords": 123,
"generatedAt": "<string>",
"filters": {},
"totalRentals": 123,
"activeRentals": 123,
"totalRevenue": 123,
"averageMonthlyRevenue": 123
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Exports
Export Subscriptions
Exports rental/subscription data to CSV format with optional date range and field filtering.
POST
/
v1
/
exports
/
rentals
Export rentals to CSV
curl --request POST \
--url https://api-eu.flexportal.io/v1/exports/rentals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Tenant-ID: <tenant-id>' \
--data '
{
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"format": "csv",
"includeFields": {
"customerDetails": true,
"deviceDetails": true,
"financialDetails": true,
"customFields": true
},
"customerIds": [
"<string>"
]
}
'import requests
url = "https://api-eu.flexportal.io/v1/exports/rentals"
payload = {
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"format": "csv",
"includeFields": {
"customerDetails": True,
"deviceDetails": True,
"financialDetails": True,
"customFields": True
},
"customerIds": ["<string>"]
}
headers = {
"Tenant-ID": "<tenant-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Tenant-ID': '<tenant-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
startDate: '2023-11-07T05:31:56Z',
endDate: '2023-11-07T05:31:56Z',
format: 'csv',
includeFields: {
customerDetails: true,
deviceDetails: true,
financialDetails: true,
customFields: true
},
customerIds: ['<string>']
})
};
fetch('https://api-eu.flexportal.io/v1/exports/rentals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-eu.flexportal.io/v1/exports/rentals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '2023-11-07T05:31:56Z',
'format' => 'csv',
'includeFields' => [
'customerDetails' => true,
'deviceDetails' => true,
'financialDetails' => true,
'customFields' => true
],
'customerIds' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Tenant-ID: <tenant-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-eu.flexportal.io/v1/exports/rentals"
payload := strings.NewReader("{\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"format\": \"csv\",\n \"includeFields\": {\n \"customerDetails\": true,\n \"deviceDetails\": true,\n \"financialDetails\": true,\n \"customFields\": true\n },\n \"customerIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Tenant-ID", "<tenant-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-eu.flexportal.io/v1/exports/rentals")
.header("Tenant-ID", "<tenant-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"format\": \"csv\",\n \"includeFields\": {\n \"customerDetails\": true,\n \"deviceDetails\": true,\n \"financialDetails\": true,\n \"customFields\": true\n },\n \"customerIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-eu.flexportal.io/v1/exports/rentals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Tenant-ID"] = '<tenant-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"format\": \"csv\",\n \"includeFields\": {\n \"customerDetails\": true,\n \"deviceDetails\": true,\n \"financialDetails\": true,\n \"customFields\": true\n },\n \"customerIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"filename": "<string>",
"csvData": "<string>",
"totalRecords": 123,
"generatedAt": "<string>",
"filters": {},
"totalRentals": 123,
"activeRentals": 123,
"totalRevenue": 123,
"averageMonthlyRevenue": 123
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Overview
Export subscription data to CSV format. Use this for reporting, data analysis, or importing into external systems like spreadsheets or business intelligence tools.Common Use Cases
Financial Reporting
Export data for revenue analysis and forecasting
Accounting Integration
Import subscription data into accounting software
Business Intelligence
Feed data into BI tools for advanced analytics
Compliance Audits
Generate reports for audit and compliance needs
Request Fields
| Field | Required | Description |
|---|---|---|
status | No | Filter by status: active, ended, etc. |
startDateFrom | No | Filter by start date (from) |
startDateTo | No | Filter by start date (to) |
endDateFrom | No | Filter by end date (from) |
endDateTo | No | Filter by end date (to) |
customerId | No | Filter by customer |
Example: Export All Active Subscriptions
{
"status": "active"
}
Example: Export by Date Range
{
"startDateFrom": "2024-01-01",
"startDateTo": "2024-12-31"
}
Response
The response includes a download URL for the CSV file:{
"success": true,
"downloadUrl": "https://storage.example.com/exports/rentals-2025-01-15.csv?signature=...",
"expiresAt": "2025-01-15T12:00:00Z",
"recordCount": 1250
}
CSV Columns
The exported CSV includes:| Column | Description |
|---|---|
subscriptionId | Subscription ID |
customerId | Customer ID |
customerEmail | Customer email |
customerName | Customer full name |
company | Company name (if business) |
sku | Product SKU |
productName | Product name |
serialNumber | Asset serial number |
status | Subscription status |
startDate | Contract start date |
endDate | Contract end date |
contractLength | Duration in months |
monthlyAmount | Monthly payment |
currency | Currency code |
totalCollected | Total payments collected |
acquisitionCost | Asset acquisition cost |
costRecoveryPercent | Cost recovery percentage |
Example: Monthly Revenue Report
async function generateMonthlyReport(year, month) {
const startDate = `${year}-${month.toString().padStart(2, '0')}-01`;
const endDate = new Date(year, month, 0).toISOString().split('T')[0];
const { downloadUrl, recordCount } = await exportSubscriptions({
status: 'active',
startDateFrom: startDate,
startDateTo: endDate
});
return {
period: `${year}-${month}`,
subscriptions: recordCount,
downloadUrl
};
}
Example: Customer Data Export
async function exportCustomerData(customerId) {
const { downloadUrl, recordCount } = await exportSubscriptions({
customerId
});
return {
customerId,
totalSubscriptions: recordCount,
downloadUrl
};
}
URL Expiration
Download URLs expire after a short period (typically 15-60 minutes). Download the file promptly after generation.Large Exports
For very large exports:- Consider filtering by date range to reduce size
- Export in batches by customer or time period
- Monitor the
recordCountto estimate file size
Related Endpoints
- List Subscriptions - Query subscriptions via API
- Get Subscription - Get individual subscription details
- List Customers - Get customer data
Authorizations
API key obtained from FlexPortal dashboard
Headers
Your tenant identifier
Body
application/json
Response
Export generated
Was this page helpful?