Skip to content
Coursey CreativeSign in

POST /auth/verify-code

/api/store/[slug]/auth/verify-code

Verifies the emailed OTP code and returns Supabase access/refresh tokens plus the storefront customer record (created on first login).

Public - no auth neededRate limit STOREFRONT_OTP_VERIFY: 10 requests per 15 minuteHow authentication works

Path parameters

slugstringrequired

Business store slug; 404 if no business matches.

Body parameters

emailstringrequired

Customer email address. Trimmed and lowercased, valid email, max 255 characters. Must match the email the code was sent to.

codestringrequired

The one-time passcode. Exactly 8 characters, numeric digits only (regex ^\d{8}$).

Responses

200

The request succeeded.

400

A field failed validation. The response names the fields that failed, not just the first.

404

No such store, or no such record inside it.

429

Too many requests. Back off and retry after the window in the response.

What comes back

200: { success: true, access_token, refresh_token, customer: { id, email, created_at } }. Errors: { success: false, error } with 400 (invalid/expired code or validation), 404 (business not found), or 429 (too many attempts; the body also carries retryAfter).