DeveloperWebhooks & Data

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.

ParameterDescription
keyYour Subscribfy API key
topicData type to retrieve

Endpoint

PropertyValue
Base URL{store}.com/apps/subscribfy-api/v1/collection
MethodPOST
Content-Typeapplication/x-www-form-urlencoded

Available Topics

TopicReturns
memberCustomer ID, email, store credits balance
store_credit_historyAll credit earn/redeem transactions
activity_log_mContract changes, plan updates
subscription_contractContract details, billing info, status

Response Format

Success Response

Returns JSON array with requested data.

Error Responses

StatusCause
400Missing or invalid parameters
401API key not found or inactive
404Shop domain not recognized
404No 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

FieldDescription
shopify_customer_gidShopify customer ID (numeric part)
emailCustomer email address
balance_from_subscribfyCurrent store credit balance

Store Credit History Fields

FieldDescription
shopify_customer_gidShopify customer ID
bodyTransaction description
valueAmount (negative for redemptions)
totalBalance after transaction
status0 = pending, 1 = completed
order_nameOrder number (redemptions only)
created_atTimestamp (Y-m-d H:i)

Activity Log Fields

FieldDescription
shopify_customer_gidShopify customer ID
contract_idSubscription contract ID
textActivity description
notesAdditional notes
plan_group_nameSelling plan group name
plan_nameSelling plan name
created_atTimestamp (Y-m-d H:i)

Subscription Contract Fields

FieldDescription
contract_idInternal contract ID
statusactive, paused, cancelled
priceBilling amount
currency_codeCurrency (USD, EUR, etc.)
typeSubscription/membership title
interval_nameday, week, month, year
interval_countBilling frequency
billing_dayDay of month for billing
shopify_customer_gidShopify customer ID
created_atContract 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

On this page