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.
| Parameter | Description |
|---|---|
key | Your Subscribfy API key |
topic | Data type to retrieve |
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
| Field | Description |
|---|---|
shopify_customer_gid | Shopify customer ID (numeric part) |
email | Customer email address |
balance_from_subscribfy | Current store credit balance |
Store Credit History Fields
| Field | Description |
|---|---|
shopify_customer_gid | Shopify customer ID |
body | Transaction description |
value | Amount (negative for redemptions) |
total | Balance after transaction |
status | 0 = pending, 1 = completed |
order_name | Order number (redemptions only) |
created_at | Timestamp (Y-m-d H:i) |
Activity Log Fields
| Field | Description |
|---|---|
shopify_customer_gid | Shopify customer ID |
contract_id | Subscription contract ID |
text | Activity description |
notes | Additional notes |
plan_group_name | Selling plan group name |
plan_name | Selling plan name |
created_at | Timestamp (Y-m-d H:i) |
Subscription Contract Fields
| Field | Description |
|---|---|
contract_id | Internal contract ID |
status | active, paused, cancelled |
price | Billing amount |
currency_code | Currency (USD, EUR, etc.) |
type | Subscription/membership title |
interval_name | day, week, month, year |
interval_count | Billing frequency |
billing_day | Day of month for billing |
shopify_customer_gid | Shopify customer ID |
created_at | 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
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.