Skip to main content

Collection API

Query customer data, store credit history, activity logs, and subscription contracts via the Collection API endpoint.

Updated over 3 weeks ago

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

key

Yes

Your Subscribfy API key

topic

Yes

Data type to retrieve


Endpoint

Property

Value

URL

{store}.com/apps/subscribfy-api/v1/collection

Method

POST

Content-Type

application/x-www-form-urlencoded


Available Topics

Topic

Description

Returns

member

All customers with loyalty/credit balances

Customer ID, email, store credits balance

store_credit_history

Store credit transaction history

All credit earn/redeem transactions

activity_log_m

Membership activity logs

Contract changes, plan updates

subscription_contract

All subscription contracts

Contract details, billing info, status


Response Format

Success Response

Returns JSON array with requested data.

Error Responses

Error

Cause

{"error": "Bad request."}

Missing or invalid parameters

{"error": "Invalid API key."}

API key not found or inactive

{"error": "Store not found."}

Shop domain not recognized

{"error": "No records found."}

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

shopify_customer_gid

string

Shopify customer ID (numeric part)

email

string

Customer email address

balance_from_subscribfy

string

Current store credit balance

Store Credit History Fields

Field

Type

Description

shopify_customer_gid

string

Shopify customer ID

body

string

Transaction description

value

string

Amount (negative for redemptions)

total

string

Balance after transaction

status

string

0 = pending, 1 = completed

order_name

string

Order number (redemptions only)

created_at

string

Timestamp (Y-m-d H:i)

Activity Log Fields

Field

Type

Description

shopify_customer_gid

string

Shopify customer ID

contract_id

integer

Subscription contract ID

text

string

Activity description

notes

string

Additional notes

plan_group_name

string

Selling plan group name

plan_name

string

Selling plan name

created_at

string

Timestamp (Y-m-d H:i)

Subscription Contract Fields

Field

Type

Description

contract_id

integer

Internal contract ID

status

string

active, paused, cancelled

price

string

Billing amount

currency_code

string

Currency (USD, EUR, etc.)

type

string

Subscription/membership title

interval_name

string

day, week, month, year

interval_count

integer

Billing frequency

billing_day

string

Day of month for billing

shopify_customer_gid

string

Shopify customer ID

created_at

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


Did this answer your question?