POST /api/admin-notify-list
POST /api/admin-notify-list
List active (non-archived) notify subscriptions with optional filtering.
This endpoint excludes archived subscriptions. To view archived records, use Admin Notify Archives List.
Request
Method
POST
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {ADMIN_API_TOKEN} |
| Content-Type | application/json |
Body
{
"status": "pending",
"productSlug": "oxi-one-mk2"
}
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
status | string | No | Filter by status: pending, notified, unsubscribed |
productSlug | string | No | Filter by product slug |
All parameters are optional. Omit to return all subscriptions.
Response
Success (200)
{
"success": true,
"subscriptions": [
{
"id": "ntf_1706889600000-a1b2c3",
"email": "user@example.com",
"productSlug": "oxi-one-mk2",
"status": "pending",
"createdAt": "2024-02-02T10:00:00.000Z",
"notifiedAt": null
},
{
"id": "ntf_1706889500000-d4e5f6",
"email": "another@example.com",
"productSlug": "oxi-one-mk2",
"status": "notified",
"createdAt": "2024-02-01T09:00:00.000Z",
"notifiedAt": "2024-02-03T15:30:00.000Z"
}
]
}
Subscription Object
| Field | Type | Description |
|---|---|---|
id | string | Unique subscription ID |
email | string | Subscriber’s email address |
productSlug | string | Product identifier |
status | string | Status: pending, notified, unsubscribed |
createdAt | string | ISO 8601 timestamp of subscription creation |
notifiedAt | string | null | ISO 8601 timestamp when notified, or null |
Unauthorized (401)
{
"success": false,
"error": "Unauthorized"
}
Example
cURL
# Get all subscriptions
curl -X POST https://takazudomodular.com/api/admin-notify-list \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
# Filter by status
curl -X POST https://takazudomodular.com/api/admin-notify-list \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "pending"}'
# Filter by product
curl -X POST https://takazudomodular.com/api/admin-notify-list \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"productSlug": "oxi-one-mk2"}'
JavaScript (fetch)
const response = await fetch('/api/admin-notify-list', {
method: 'POST',
headers: {
'Authorization': `Bearer ${ADMIN_API_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
status: 'pending',
productSlug: 'oxi-one-mk2',
}),
});
const data = await response.json();
if (data.success) {
console.log(`Found ${data.subscriptions.length} subscriptions`);
data.subscriptions.forEach((sub) => {
console.log(`${sub.email} - ${sub.status}`);
});
}
Implementation Details
Source File
netlify/functions/admin-notify-list.ts
Behavior
- Validates Bearer token authentication
- Parses optional filter parameters from request body
- Fetches all notify subscriptions from Netlify Blobs
- Applies filters (status, productSlug) if provided
- Sorts by createdAt descending (newest first)
- Returns filtered subscription list
Sorting
Results are sorted by createdAt in descending order (newest first).
Related
- POST /api/admin-notify-status - Update subscription status
- POST /api/admin-stats - Get dashboard statistics
- Admin Notify Archive - Archive subscriptions
- Admin Notify Archives List - List archived subscriptions