Admin Notify Archive
Admin Notify Archive
Bulk archive notify subscriptions. Archived records retain their original status but are excluded from the main list.
Endpoint
POST /api/admin/notify/archive
Authentication
Requires Bearer token authentication.
Authorization: Bearer <ADMIN_API_TOKEN>
Request
Headers
| Header | Required | Value |
|---|---|---|
Content-Type | Yes | application/json |
Authorization | Yes | Bearer <token> |
Body
interface AdminBulkArchiveRequest {
ids: Array<{
id: string; // Subscription ID
productSlug: string; // Product slug for the subscription
}>;
}
Example Request
curl -X POST https://preview--takazudomodular.netlify.app/api/admin/notify/archive \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ADMIN_API_TOKEN" \
-d '{
"ids": [
{ "id": "mock-sub-001", "productSlug": "n32b-slim" },
{ "id": "mock-sub-002", "productSlug": "n32b-slim" }
]
}'
Response
Success Response (200)
interface AdminBulkArchiveResponse {
success: true;
archivedCount: number; // Number of successfully archived subscriptions
archivedIds: string[]; // IDs that were successfully archived
errors?: Array<{ // Optional: any errors that occurred
id: string;
error: string;
}>;
}
Example Success Response
{
"success": true,
"archivedCount": 2,
"archivedIds": ["mock-sub-001", "mock-sub-002"]
}
Partial Success Response
When some items fail to archive:
{
"success": true,
"archivedCount": 1,
"archivedIds": ["mock-sub-001"],
"errors": [
{ "id": "mock-sub-999", "error": "Subscription not found" }
]
}
Error Responses
Validation Error (400)
{
"success": false,
"error": "ids array is required"
}
{
"success": false,
"error": "ids array cannot be empty"
}
Authentication Error (401)
{
"success": false,
"error": "Unauthorized"
}
Behavior
- Validates the request body contains a non-empty
idsarray - Iterates through each subscription ID
- Sets
isArchived: trueandarchivedAttimestamp on each subscription - Preserves the original status (pending, notified, unsubscribed) for historical reference
- Returns summary of archived items and any errors
Data Model
After archiving, a subscription looks like:
interface NotifySubscription {
id: string;
email: string;
productSlug: string;
createdAt: string;
status: 'pending' | 'notified' | 'unsubscribed'; // Original status preserved
notifiedAt?: string;
isArchived: true; // Added on archive
archivedAt: string; // ISO timestamp when archived
}
Related Endpoints
- Admin Notify List - List active (non-archived) subscriptions
- Admin Notify Archives List - List archived subscriptions
- Admin Notify Status - Update subscription status