Collection API
The Collection API provides programmatic access to customer data, store credits, activity logs, and subscription contracts. Use this endpoint to export data for analytics, sync with third-party systems, or build custom integrations.
Authentication
All requests require your Subscribfy API key. Generate it in Settings > API.
Parameter | Required | Description |
| Yes | Your Subscribfy API key |
| Yes | Data type to retrieve |
Endpoint
Property | Value |
URL |
|
Method |
|
Content-Type |
|
Available Topics
Topic | Description | Returns |
| All customers with loyalty/credit balances | Customer ID, email, store credits balance |
| Store credit transaction history | All credit earn/redeem transactions |
| Membership activity logs | Contract changes, plan updates |
| All subscription contracts | Contract details, billing info, status |
Response Format
Success Response
Returns JSON array with requested data.
Error Responses
Error | Cause |
| Missing or invalid parameters |
| API key not found or inactive |
| Shop domain not recognized |
| No data matches the query |
Examples
Get All Members
Retrieve all customers with their store credit balances.
curl -X POST "https://your-store.com/apps/subscribfy-api/v1/collection" \ -d "key=your_api_key" \ -d "topic=member"
Response:
[
{
"shopify_customer_gid": "7834521098",
"email": "john@example.com",
"balance_from_subscribfy": "150.00"
},
{
"shopify_customer_gid": "7834521099",
"email": "jane@example.com",
"balance_from_subscribfy": "0.00"
}
]
Get Store Credit History
Retrieve all store credit transactions grouped by customer.
curl -X POST "https://your-store.com/apps/subscribfy-api/v1/collection" \ -d "key=your_api_key" \ -d "topic=store_credit_history"
Response:
{
"7834521098": [
{
"shopify_customer_gid": "7834521098",
"body": "You've earned 29.00 Store Credits!",
"value": "29.00",
"total": "29.00",
"status": "0",
"created_at": "2024-01-15 10:30"
},
{
"shopify_customer_gid": "7834521098",
"body": "Discount Redemption",
"value": "-15.00",
"total": "14.00",
"status": "1",
"order_name": "#1234",
"created_at": "2024-01-20 14:22"
}
]
}
Get Activity Logs
Retrieve membership activity logs.
curl -X POST "https://your-store.com/apps/subscribfy-api/v1/collection" \ -d "key=your_api_key" \ -d "topic=activity_log_m"
Response:
[
{
"shopify_customer_gid": "7834521098",
"contract_id": 456,
"text": "Membership paused",
"notes": "Customer requested pause",
"plan_group_name": "VIP Membership",
"plan_name": "Monthly",
"created_at": "2024-01-18 09:15"
}
]
Get Subscription Contracts
Retrieve all subscription contracts with billing details.
curl -X POST "https://your-store.com/apps/subscribfy-api/v1/collection" \ -d "key=your_api_key" \ -d "topic=subscription_contract"
Response:
[
{
"created_at": "2024-01-01 12:00",
"contract_id": 456,
"status": "active",
"price": "29.99",
"currency_code": "USD",
"price_in_store_currency": "USD",
"type": "VIP Membership",
"interval_name": "month",
"interval_count": 1,
"billing_day": "15",
"shopify_customer_gid": "7834521098"
}
]
Code Examples
PHP
$apiKey = 'your_api_key';
$store = 'your-store.com';$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "https://{$store}/apps/subscribfy-api/v1/collection",
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query([
'key' => $apiKey,
'topic' => 'member'
]),
CURLOPT_RETURNTRANSFER => true
]);$response = curl_exec($ch);
curl_close($ch);$members = json_decode($response, true);
foreach ($members as $member) {
echo $member['email'] . ': $' . $member['balance_from_subscribfy'] . "\n";
}
Node.js
const axios = require('axios');const apiKey = 'your_api_key';
const store = 'your-store.com';async function getMembers() {
const response = await axios.post(
`https://${store}/apps/subscribfy-api/v1/collection`,
new URLSearchParams({
key: apiKey,
topic: 'member'
})
); return response.data;
}getMembers().then(members => {
members.forEach(member => {
console.log(`${member.email}: $${member.balance_from_subscribfy}`);
});
});
Python
import requestsapi_key = 'your_api_key'
store = 'your-store.com'response = requests.post(
f'https://{store}/apps/subscribfy-api/v1/collection',
data={
'key': api_key,
'topic': 'member'
}
)members = response.json()
for member in members:
print(f"{member['email']}: ${member['balance_from_subscribfy']}")
Field Reference
Member Fields
Field | Type | Description |
| string | Shopify customer ID (numeric part) |
| string | Customer email address |
| string | Current store credit balance |
Store Credit History Fields
Field | Type | Description |
| string | Shopify customer ID |
| string | Transaction description |
| string | Amount (negative for redemptions) |
| string | Balance after transaction |
| string | 0 = pending, 1 = completed |
| string | Order number (redemptions only) |
| string | Timestamp (Y-m-d H:i) |
Activity Log Fields
Field | Type | Description |
| string | Shopify customer ID |
| integer | Subscription contract ID |
| string | Activity description |
| string | Additional notes |
| string | Selling plan group name |
| string | Selling plan name |
| string | Timestamp (Y-m-d H:i) |
Subscription Contract Fields
Field | Type | Description |
| integer | Internal contract ID |
| string | active, paused, cancelled |
| string | Billing amount |
| string | Currency (USD, EUR, etc.) |
| string | Subscription/membership title |
| string | day, week, month, year |
| integer | Billing frequency |
| string | Day of month for billing |
| string | Shopify customer ID |
| string | Contract creation date |
Rate Limits
The API does not impose strict rate limits, but we recommend:
Maximum 1 request per second for large stores
Cache responses when possible
Use pagination for very large datasets (contact support)
Best Practices
Store your API key securely - Never expose it in client-side code
Handle errors gracefully - Check for error responses before processing
Use HTTPS only - All requests must use secure connections
Cache when appropriate - Member data doesn't change frequently