Takazudo Modular Docs

Type to search...

to open search from anywhere

POST /api/reservation

POST /api/reservation

Submit a product reservation request.

Request

Method

POST

Headers

HeaderValue
Content-Typeapplication/json

Body

{
  "name": "山田太郎",
  "email": "user@example.com",
  "productSlug": "oxi-one-mk2"
}

Parameters

FieldTypeRequiredDescription
namestringYesCustomer’s name
emailstringYesCustomer’s email address
productSlugstringYesProduct identifier (must exist in product data)

Response

Success (200)

{
  "success": true,
  "reservationId": "res_550e8400-e29b-41d4-a716-446655440000"
}

The reservationId format is res_[uuid] using crypto.randomUUID() for guaranteed uniqueness.

Validation Error (400)

{
  "success": false,
  "error": "入力内容に問題があります",
  "details": [
    { "field": "name", "message": "お名前を入力してください" },
    { "field": "email", "message": "有効なメールアドレスを入力してください" }
  ]
}

Product Not Found (400)

{
  "success": false,
  "error": "指定された商品が見つかりません"
}

Server Error (500)

{
  "success": false,
  "error": "サーバーエラーが発生しました"
}

Example

cURL

curl -X POST https://takazudomodular.com/api/reservation \
  -H "Content-Type: application/json" \
  -d '{
    "name": "山田太郎",
    "email": "user@example.com",
    "productSlug": "oxi-one-mk2"
  }'

JavaScript (fetch)

const response = await fetch('/api/reservation', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    name: '山田太郎',
    email: 'user@example.com',
    productSlug: 'oxi-one-mk2',
  }),
});

const data = await response.json();

if (data.success) {
  console.log('Reservation ID:', data.reservationId);
} else {
  console.error('Reservation failed:', data.error);
}

Implementation Details

Source File

netlify/functions/reservation.ts

Behavior

  1. Validates name (non-empty, trimmed)
  2. Validates email format
  3. Validates productSlug format (lowercase alphanumeric with hyphens)
  4. Generates unique reservation ID (res_ prefix + UUID)
  5. Normalizes email to lowercase
  6. Stores reservation in Netlify Blobs
  7. Sends notifications in parallel (non-blocking, failures don’t affect response):
  • Slack (reservation channel): Full details (product, name, email, reservation ID, timestamp) for shop management
  • Auto-reply email: Confirmation email to the user via Resend
  • No Discord notification (reservation contains private customer info)
  1. Returns success response with reservation ID

Email Normalization

Emails are normalized to lowercase before storage. This means User@Example.com is stored as user@example.com.

Reservation ID Format

The reservationId is generated with a timestamp-based format for easy sorting:

res_{timestamp}-{random}

Example: res_1706889600000-a1b2c3

Duplicate Handling

Unlike notify-signup, multiple reservations from the same email are currently allowed. This is intentional as customers may want to reserve multiple units of the same product.

Admin Management

Reservations can be managed via the zpreorder admin interface: