Admin Reservation Archive
Admin Reservation Archive
Bulk archive reservations. Archived records retain their original status but are excluded from the main list.
Endpoint
POST /api/admin/reservations/archive
Authentication
Requires Bearer token authentication.
Authorization: Bearer <PREORDER_API_TOKEN>
Request
Headers
| Header | Required | Value |
|---|---|---|
Content-Type | Yes | application/json |
Authorization | Yes | Bearer <token> |
Body
interface AdminBulkArchiveRequest {
ids: Array<{
id: string; // Reservation ID
productSlug: string; // Product slug for the reservation
}>;
}
Example Request
curl -X POST https://preview--takazudomodular.netlify.app/api/admin/reservations/archive \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $PREORDER_API_TOKEN" \
-d '{
"ids": [
{ "id": "res-001", "productSlug": "n32b-slim" },
{ "id": "res-002", "productSlug": "n32b-slim" }
]
}'
Response
Success Response (200)
interface AdminBulkArchiveResponse {
success: true;
archivedCount: number; // Number of successfully archived reservations
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": ["res-001", "res-002"]
}
Partial Success Response
When some items fail to archive:
{
"success": true,
"archivedCount": 1,
"archivedIds": ["res-001"],
"errors": [
{ "id": "res-999", "error": "Reservation 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 reservation ID
- Sets
isArchived: trueandarchivedAttimestamp on each reservation - Preserves the original status (reserved, responded) for historical reference
- Returns summary of archived items and any errors
Data Model
After archiving, a reservation looks like:
interface Reservation {
id: string;
email: string;
name: string;
productSlug: string;
createdAt: string;
status: 'reserved' | 'responded'; // Original status preserved
respondedAt?: string;
isArchived: true; // Added on archive
archivedAt: string; // ISO timestamp when archived
}
Related Endpoints
- Admin Reservations List - List active (non-archived) reservations
- Admin Reservation Archives List - List archived reservations
- Admin Reservation Unarchive - Restore archived reservations
- Admin Reservations Status - Update reservation status