Collection API
Query customer data, store credit history, activity logs, and subscription contracts via the Collection API endpoint.
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.
Prop
Type
Endpoint
| Property | Value |
|---|---|
| Base URL | {store}.com/apps/subscribfy-api/v1/collection |
| Method | POST |
| Content-Type | application/x-www-form-urlencoded |
Available Topics
| Topic | Returns |
|---|---|
member | Customer ID, email, store credits balance |
store_credit_history | All credit earn/redeem transactions |
activity_log_m | Contract changes, plan updates |
subscription_contract | Contract details, billing info, status |
Response Format
Success Response
Returns JSON array with requested data.
Error Responses
| Status | Cause |
|---|---|
| 400 | Missing or invalid parameters |
| 401 | API key not found or inactive |
| 404 | Shop domain not recognized |
| 404 | 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
$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";
}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}`);
});
});import requests
api_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
Prop
Type
Store Credit History Fields
Prop
Type
Activity Log Fields
Prop
Type
Subscription Contract Fields
Prop
Type
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
Was this page helpful?
Storefront Customer Portal API
Storefront API for customer self-service: pause, cancel, skip, swap products, update billing, and manage subscriptions.
Webhook Events API
Real-time HTTP notifications for customer, subscription, and loyalty events. Includes authentication, payload examples, and code samples.