Takazudo Modular Docs

Type to search...

to open search from anywhere

Admin Notify Unarchive

Admin Notify Unarchive

Bulk unarchive notify subscriptions. Moves archived records back to the active list.

Endpoint

POST /api/admin/notify/unarchive

Authentication

Requires Bearer token authentication.

Authorization: Bearer <PREORDER_API_TOKEN>

Request

Headers

HeaderRequiredValue
Content-TypeYesapplication/json
AuthorizationYesBearer <token>

Body

interface AdminBulkUnarchiveRequest {
  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/unarchive \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PREORDER_API_TOKEN" \
  -d '{
    "ids": [
      { "id": "sub-001", "productSlug": "n32b-slim" },
      { "id": "sub-002", "productSlug": "n32b-slim" }
    ]
  }'

Response

Success Response (200)

interface AdminBulkUnarchiveResponse {
  success: true;
  unarchivedCount: number;       // Number of successfully unarchived subscriptions
  unarchivedIds: string[];       // IDs that were successfully unarchived
  errors?: Array<{               // Optional: any errors that occurred
    id: string;
    error: string;
  }>;
}

Example Success Response

{
  "success": true,
  "unarchivedCount": 2,
  "unarchivedIds": ["sub-001", "sub-002"]
}

Partial Success Response

When some items fail to unarchive:

{
  "success": true,
  "unarchivedCount": 1,
  "unarchivedIds": ["sub-001"],
  "errors": [
    { "id": "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

  1. Validates the request body contains a non-empty ids array
  2. Iterates through each subscription ID
  3. Sets isArchived: false and removes archivedAt timestamp
  4. Returns summary of unarchived items and any errors