Skip to content
Coursey CreativeSign in

POST /auth/refresh

/api/store/[slug]/auth/refresh

Exchanges a Supabase refresh token for a fresh access/refresh token pair so a storefront customer session can outlive the ~1h access-token expiry without re-running the OTP flow.

Public - the refresh token in the request body authenticates the grantHow authentication works

Path parameters

slugstringrequired

Business store slug; 404 if no business matches.

Body parameters

refresh_tokenstringrequired

The Supabase refresh token from a prior verify-code or refresh response. Trimmed, min 20 characters. Rotated on success (the returned token supersedes it).

Responses

200

The request succeeded.

401

The key or customer token is missing, malformed, or no longer valid.

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 401 (invalid/expired refresh token or no matching customer), 404 (business not found), 429 (refresh rate limit).